我的目标是使用tf.estimator.export_saved_model.
我有两个功能,我们称它们为feature_1
和feature_2
。每个形状均为(5, 181)
。它们是顺序特征,所以5 =时间步长,181 = 181个浮点的向量。
feature_columns = []
keys = ['feature_1', 'feature_2']
for key in keys:
col = tf.contrib.feature_column.sequence_numeric_column(key,shape=(5, 181))
feature_columns.append(col)
features = tf.feature_column.make_parse_example_spec(feature_columns)
recvfn = tf.estimator.export.build_parsing_serving_input_receiver_fn(features)
estimator.export_saved_model(path_to_saved_model, recvfn)
我收到此错误ValueError: Input 0 of layer sequential is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: [None, None]
,我怀疑与批次大小有关,但我不确定。
通常,我会扩大输入的尺寸以解决批次大小,但是在这种情况下我不知道如何处理。