Closed hansely closed 5 years ago
No, this is not a bug. If you give it the folder path, it loads the graph and the weights (variables). If you just give it the graph file, it only loads the graph, without the weights, that is why there is no data in it. The readme describes this behavior under "Using the Python module".
Then is there a way to load the weights as well?
What do you mean? You said in the beginning, that if you give it the path to the NNEF folder, then it successfully loaded the weights. So what is the problem?
I mean I want to load the weights by giving the graph itself instead of the path.
Well, the graph itself does not contain the variables data, so it cannot load it just based on that info. It's the path that contains the whole info.
But I don't quite get what you want to achieve, why is it not good enough to give the path. Think about it as a container that contains multiple pieces of info. You need to point to the container if you want to mean the whole.
I get it. I think path would be good enough. Thanks.
When I load graph using the nnef graph path,
graph = nnef.load_graph(path) nnef.infer_shapes(nnef_graph)
I was able to get the data and the data type of the variable tensor as follows:
if operation.name == 'variable': tensor_name = nnef_operation.outputs['output'] tensor = nnef_graph.tensors[tensor_name] data = tensor.data dtype = tensor.data.dtype
However, if I load graph using the nnef graph file itself,
graph = nnef.load_graph(nnef.graph) nnef.infer_shapes(nnef_graph)
the data comes out as None.
Is this a bug?