Last active
October 29, 2018 20:59
-
-
Save lukmanr/5bbac6ef9c5b49c600475e5b4628d254 to your computer and use it in GitHub Desktop.
TF Model Optimization code 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def describe_graph(graph_def, show_nodes=False): | |
print('Input Feature Nodes: {}'.format( | |
[node.name for node in graph_def.node if node.op=='Placeholder'])) | |
print('') | |
print('Unused Nodes: {}'.format( | |
[node.name for node in graph_def.node if 'unused' in node.name])) | |
print('') | |
print('Output Nodes: {}'.format( | |
[node.name for node in graph_def.node if ( | |
'predictions' in node.name or 'softmax' in node.name)])) | |
print('') | |
print('Quantization Nodes: {}'.format( | |
[node.name for node in graph_def.node if 'quant' in node.name])) | |
print('') | |
print('Constant Count: {}'.format( | |
len([node for node in graph_def.node if node.op=='Const']))) | |
print('') | |
print('Variable Count: {}'.format( | |
len([node for node in graph_def.node if 'Variable' in node.op]))) | |
print('') | |
print('Identity Count: {}'.format( | |
len([node for node in graph_def.node if node.op=='Identity']))) | |
print('', 'Total nodes: {}'.format(len(graph_def.node)), '') | |
if show_nodes==True: | |
for node in graph_def.node: | |
print('Op:{} - Name: {}'.format(node.op, node.name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment