I want to reorganize the nodes of tensorflow .pb model,so I first get NodeDef from GraphDef, and get attr use NodeDef.attr().for the node of "Conv2D". I can get parameters such as strides,padding,data_format,use_cudnn_on_gpu from attr, but cann't get the weights format parameters. The language I use is c++. How to get it! Thank you!
8
votes
1 Answers
4
votes
Conv2D
has two inputs: the first one is data and the second one is filter
(or weights), so you can simply check the format of the second input of Conv2D
. If you are using C++, you can try this:
# Assuming inputs: conv2d_node, node_map.
filter_node_name = conv2d_node.input(1)
filter_node = node_map[filter_node_name]
# You might need to check identity node here.
# Get the shape of filter_node using NodeDef.attr()