How to access tensor_content values ββin TensorProto in TensorFlow?
How How to access values ββin protos in TensorFlow? but not suitable for this case.
I can see the attribute bytes tensor_content
in TensorProto . I am trying to get information about nodes via:
for node in tf.get_default_graph().as_graph_def().node:
node.attr['value'].tensor.tensor_content # decode these bytes
For information, the print node looks something like this:
name: "conv2d/convolution/Shape"
op: "Const"
device: "/device:GPU:0"
attr {
key: "dtype"
value {
type: DT_INT32
}
}
attr {
key: "value"
value {
tensor {
dtype: DT_INT32
tensor_shape {
dim {
size: 4
}
}
tensor_content: "\003\000\000\000\003\000\000\000\001\000\000\000 \000\000\000"
}
}
}
+3
source to share