diff --git a/src/TensorFlowNET.Core/Graphs/Graph.Operation.cs b/src/TensorFlowNET.Core/Graphs/Graph.Operation.cs index 0e28dd9a..3cda8074 100644 --- a/src/TensorFlowNET.Core/Graphs/Graph.Operation.cs +++ b/src/TensorFlowNET.Core/Graphs/Graph.Operation.cs @@ -54,19 +54,21 @@ namespace Tensorflow var handle = return_oper_handle.node + tf_op_size * i; return_opers[i] = new Operation(*(IntPtr*)handle); } - } - + } + return return_opers; } public Operation OperationByName(string operName) { var handle = c_api.TF_GraphOperationByName(_handle, operName); - if(graph_key != tf.get_default_graph().graph_key) - { - Console.WriteLine($"Current graph is not default graph."); - // throw new ValueError($"Current graph is not default graph."); + var defaultKey = tf.get_default_graph().graph_key; + if (graph_key != defaultKey) + { + //Console.WriteLine($"Current graph is not default graph."); + throw new ValueError($"Current graph is not default graph. Default Graph Key: {defaultKey}, Current Graph Key: {graph_key}"); } + return new Operation(handle, g: this); }