报错
ValueError: Could not find matching function to call loaded from the SavedModel. Got:
Positional arguments (3 total):
* <_VariantDataset shapes: ((, , , ), ), types: ((tf.float32, tf.float32, tf.float32, tf.float32), tf.float32)>
* False
* None
Keyword arguments: {}
Expected these arguments to match one of the following 4 option(s):
Option 1:
Positional arguments (3 total):
* (TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_1'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_2'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_3'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_4'))
* True
* None
Keyword arguments: {}
Option 2:
Positional arguments (3 total):
* (TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/0'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/1'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/2'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/3'))
* True
* None
Keyword arguments: {}
Option 3:
Positional arguments (3 total):
* (TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/0'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/1'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/2'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/3'))
* False
* None
Keyword arguments: {}
Option 4:
Positional arguments (3 total):
* (TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_1'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_2'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_3'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_4'))
* False
* None
Keyword arguments: {}
解决方法
- 检查输入是否和训练时的输入格式、大小一样
- 如果输入有多个元素,采用tuple作为整体输入