31 if attr.type == AttributeProto.TENSOR:
33 numpy_helper.to_array(attr.t))
34 if attr.type == AttributeProto.GRAPH:
37 if attr.type == AttributeProto.TENSORS:
40 if attr.type == AttributeProto.GRAPHS:
43 return helper.get_attribute_value(attr)
77 for node
in onnx_model.graph.node:
78 if node.op_type
in opcodes_dict:
79 opcodes_dict[node.op_type] = opcodes_dict[node.op_type] + 1
81 opcodes_dict[node.op_type] = 1
83 print(
"[Operators] ---------------------------")
85 for opcode_key
in opcodes_dict:
86 print(
"{:>5} {}".format(opcodes_dict[opcode_key], opcode_key))
87 total_nodes = total_nodes + opcodes_dict[opcode_key]
90 print(
"{:>5} {}".format(total_nodes,
'Total'))
139 print(
"[Graph Input/Output]-------------------")
140 for mod_input
in onnx_model.graph.input:
141 io_name =
'"{}"'.format(mod_input.name)
143 shape = mod_input.type.tensor_type.shape
144 input_shape = [dim.dim_value
for dim
in shape.dim]
145 print(
' I: {:<15} {} {}'.format(io_name, dtstr, input_shape))
147 for mod_output
in onnx_model.graph.output:
148 io_name =
'"{}"'.format(mod_output.name)
150 shape = mod_output.type.tensor_type.shape
151 output_shape = [dim.dim_value
for dim
in shape.dim]
152 print(
' O: {:<15} {} {}'.format(io_name, dtstr, output_shape))