尝试通过tensorflowjs_转换器将TF.Estimator模型转换为Tensorflow.js时出错

尝试通过tensorflowjs_转换器将TF.Estimator模型转换为Tensorflow.js时出错,tensorflow,tensorflow-estimator,tensorflowjs-converter,Tensorflow,Tensorflow Estimator,Tensorflowjs Converter,我有一个tf估计模型 model=tf.estimator.DNNClassifier(隐藏单元=[5,4],特征列=专长列,n类=2) 通过出口 feature_spec = tf.feature_column.make_parse_example_spec(feat_cols) serving_input_receiver_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(feature_spec) export

我有一个tf估计模型

model=tf.estimator.DNNClassifier(隐藏单元=[5,4],特征列=专长列,n类=2)

通过出口

feature_spec = tf.feature_column.make_parse_example_spec(feat_cols)
serving_input_receiver_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(feature_spec)
export_dir = model.export_savedmodel('export', serving_input_receiver_fn)
我可以通过

predict_fn = tf.contrib.predictor.from_saved_model(export_dir)
当我运行tensorflowjs_转换器时

tensorflowjs_converter --input_format=tf_saved_model --output_format=tensorflowjs ./1553869899 ./web_model
我明白了

ValueError: Unsupported Ops in the model before optimization
ParseExample, AsString
我四处看了看,发现这个例子和AsString都是不受支持的操作。我使用的是非常普通的代码,不直接调用ParseExample或AsString。我不打算重写tensorflow的部分内容,这似乎是对其他问题的回答所要求的

问题:有办法解决这个问题吗?我是否需要放弃tf.estimator并通过较低级别的API对其进行编码?导出tf.estimator模型或转换它是否有其他可行的方法


谢谢。

我在Keras中实现了一个等效模型,并能够在tensorflowjs中保存和加载它。最初的问题仍然是相关的,尽管不那么紧迫。我在Keras中实现了一个等效模型,并能够在tensorflowjs中保存和加载它。最初的问题仍然相关,尽管不那么紧迫。