I am trying to load a Sequential Model that I trained in Python and saved using “tf.saved_model.save()”. When I attempt to load the model in Java using the SavedModelBundle class and use it to predict output based on an input, I am running into issues if my model has Convolution or Max Pooling layers. I get the following error:
org.tensorflow.exceptions.TFInvalidArgumentException: Input to reshape is a tensor with 4282281 values, but the requested shape has 2569368600
Also, when compiling and saving the model in Python, I get these warnings which might be relevant:
WARNING:absl:Found untraced functions such as _jit_compiled_convolution_op while saving (showing 1 of 1). These functions will not be directly callable after loading.```
If I don’t use MaxPooling or Convolution layers everything works as intended.
How can I execute models that have these types of layers in Java?