Input-depending model on TensorFlow
I'm working on a TensorFlow model, and I would like to have different logic in the model depending on the input. My question is if it's possible to have a dispatch layer in TensorFlow that depending on the input uses one model or another?
Simplified example:
Imagine your input has two fields a: int
and b: Optional[int]
. This means b
can be defined or not.
If b
is not None
you want to execute some layers, and if it's None
you want to execute some other layers.
My idea was to have a dispatch layer that depending on the input executes one branch of the model or another one. Something like the architecture in the image below:
With this architecture, you'll have one only model (which is easier to deploy) with polymorphism depending on the input.
Thank you very much for your help :)
Topic tensorflow deep-learning python
Category Data Science