Browse Source

Graph.Operation: Throw ValueError exception when `Current graph is not default graph.`

tags/v0.12
Eli Belash 6 years ago
parent
commit
8cb647082c
1 changed files with 8 additions and 6 deletions
  1. +8
    -6
      src/TensorFlowNET.Core/Graphs/Graph.Operation.cs

+ 8
- 6
src/TensorFlowNET.Core/Graphs/Graph.Operation.cs View File

@@ -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);
}



Loading…
Cancel
Save