我使用以下代码:
import tensorflow as tf
from tensorflow import keras
keras_model = keras.models.load_model('.../model_1.h5')
estimator_model = tf.keras.estimator.model_to_estimator(keras_model=keras_model)
estimator_model.export_savedmodel(export_dir_base, serving_input_receiver_fn)
我收到以下错误:
File ".../python3.6/site-packages/tensorflow/python/layers/core.py", line 129, in build
raise ValueError('The last dimension of the inputs to `Dense` '
ValueError: The last dimension of the inputs to `Dense` should be defined. Found `None`.
最后一层具有形状(无,2),但它传递给函数
def build(self, input_shape):
input_shape = tensor_shape.TensorShape(input_shape)
if input_shape[-1].value is None:
raise ValueError('The last dimension of the inputs to `Dense` '
'should be defined. Found `None`.')
core.py 中的为(无,无)!