Browse Source

meta_graph.py.cs: fixed nullref exception

tags/v0.9
Meinrad Recheis 6 years ago
parent
commit
26e78cd14c
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      src/TensorFlowNET.Core/Framework/meta_graph.py.cs

+ 6
- 3
src/TensorFlowNET.Core/Framework/meta_graph.py.cs View File

@@ -136,11 +136,14 @@ namespace Tensorflow
var graph = ops.get_default_graph(); var graph = ops.get_default_graph();


var var_list = new Dictionary<string, RefVariable>(); var var_list = new Dictionary<string, RefVariable>();
var variables = graph.get_collection(ops.GraphKeys.GLOBAL_VARIABLES);
var variables = graph.get_collection(ops.GraphKeys.GLOBAL_VARIABLES) as List<RefVariable>;


foreach(var v in variables as List<RefVariable>)
if (variables != null)
{ {
var_list[v.name] = v;
foreach (var v in variables)
{
var_list[v.name] = v;
}
} }


var scoped_meta_graph_def = create_meta_graph_def( var scoped_meta_graph_def = create_meta_graph_def(


Loading…
Cancel
Save