TensorFlowSharp
TensorFlowSharp copied to clipboard
You must feed a value for placeholder tensor 'X_1' with dtype float and shape [?,3]
I've wrote a very simple model through the Jupyter Notebook
n_input = 3
X = tf.placeholder(tf.float32, [None, n_input], name="X")
decoder = tf.matmul(X, [[2.0,3.0],[2.0,3.0],[2.0,3.0]], name='decoder')
init = tf.global_variables_initializer()
sess = tf.Session()
sess.run(init)
values = sess.run(decoder, feed_dict={X: df_norm[:10]})
graph = tf.get_default_graph()
tf.train.write_graph(graph, './model/','saved_model.pbtxt', as_text=False)
Then I loaded it with the TensorflowSharp
using (var graph = new TFGraph())
{
var bytes = File.ReadAllBytes(@".\model\saved_model.pbtxt");
graph.Import(bytes);
var session = new TFSession(graph);
var runner = session.GetRunner();
runner.AddInput(graph["X"][0], new float[] { 176.75f, 7.95f, 40397.00f });
runner.Fetch(graph["decoder"][0]);
var output = runner.Run();
// Fetch the results from output:
TFTensor result = output[0];
}
Finally, I got the exception below:
TensorFlow.TFException HResult=0x80131500 메시지=You must feed a value for placeholder tensor 'X_1' with dtype float and shape [?,3] [[{{node X_1}} = Placeholderdtype=DT_FLOAT, shape=[?,3], _device="/job:localhost/replica:0/task:0/device:CPU:0"]] 소스=TensorFlowSharp StackTrace: at TensorFlow.TFStatus.CheckMaybeRaise(TFStatus incomingStatus, Boolean last) at TensorFlow.TFSession.Run(TFOutput[] inputs, TFTensor[] inputValues, TFOutput[] outputs, TFOperation[] targetOpers, TFBuffer runMetadata, TFBuffer runOptions, TFStatus status) at TensorFlow.TFSession.Runner.Run(TFStatus status) at tensorflowsharp_model_restore.Program.Main(String[] args) in G:\tensorflow\tensorflowsharp\tensorflowsharp_model_restore\tensorflowsharp_model_restore\Program.cs:line 29
did you solve it?