'Loading subclassed model from seperate file fails
I train and save a subclassed keras Model in one file, say file A and want to load it in another file B. The problem that I have is that in file A I can save the model and even load the model back in with no problems, but the moment that I try to load the model in a different file (e.g. file B) I get the following error:
ValueError: Could not find matching concrete function to call loaded from the SavedModel.
Got:
Positional arguments (1 total):
* [<tf.Tensor 'inputs:0' shape=(?, 4498) dtype=float32>, <tf.Tensor 'inputs_1:0'
shape=(?, 4) dtype=float32>]
Keyword arguments: {}
Expected these arguments to match one of the following 2 option(s):
Option 1:
Positional arguments (1 total):
* (TensorSpec(shape=(?, 4498), dtype=tf.float32, name='inputs/0'),
TensorSpec(shape=(?, 4), dtype=tf.float32, name='inputs/1'))
Keyword arguments: {}
Option 2:
Positional arguments (1 total):
* (TensorSpec(shape=(?, 4498), dtype=tf.float32, name='input_1'),
TensorSpec(shape=(?, 4), dtype=tf.float32, name='input_2'))
Keyword arguments: {}
Does anybody have an idea how to fix this? Or what might cause the problem?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
