'how to score part of the neural network once and the rest multiple times caching the intermediate layer?
I train a model A and try to use the output of the intermediate layer with the name="layer_x" as an additional input for model B. model A is using input1, and model B is using modelA intermediate layer concatenated with input2 to make a prediction (output2). When it comes to prediction, input1 does not change frequently, whereas inout2 changes. For example, input1 is age and genre of the user and input2 is the time of day, so for the same age and gender, we would like to score the model 24 times for different hours of the day. Since "layer_x" does not change for the same age and gender, I would like to predict "layer_x" once and then compute output2 for different hours of the day. Is there any standard way of doing this in TF2?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|