我想重组tensorflow .pb模型的节点,所以我首先从GraphDef获取NodeDef,并使用NodeDef.attr()获取attr。对于“Conv2D”的节点。 我可以从 attr 获取 strides,padding,data_format,use_cudnn_on_gpu 等参数,但无法获取权重格式参数。 我使用的语言是c++。 如何获得!谢谢!
最佳答案
Conv2D
有两个输入:第一个是数据,第二个是filter
(或权重),因此您可以简单地检查第二个输入的格式Conv2D
。如果你使用的是 C++,你可以试试这个:
# 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()
关于c++ - 如何从 TensorFlow .pb 模型中获取权重格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45051627/