in src/neuron-gatherinfo/tf_neuron_check_model.py [0:0]
def __init__(self):
self.parser = argparse.ArgumentParser()
self.parser.add_argument('model_path', type=str, help='a TensorFlow SavedModel directory (currently supporting TensorFlow v1 SaveModel only).')
self.parser.add_argument('--show_names', action='store_true', help='list operation by name instead of summarizing by type (caution: this option will generate many lines of output for a large model).')
self.parser.add_argument('--expand_subgraph', action='store_true', help='show subgraph operations.')
self.parser_args = self.parser.parse_args()
self.neuronop_info = {}
self.total_pipeline_cores = 0
self.min_required_pipeline_cores = 0
path = self.parser_args.model_path
if os.path.exists(path + '-symbol.json'):
self.load_mxnet_model(path)
elif os.path.isdir(path):
self.load_tensorflow_model(path)
else:
raise RuntimeError('Cannot determine framework type from model path argument.')
self.supported = self.get_neuron_supported()
self.supported.extend(self.addl_support)
for name, executable, (sg_nodetypes, sg_nodenames) in self.neuron_nodes:
num_cores, requested_cores, _ = self.get_cores_from_executable(executable)
self.neuronop_info[name] = (num_cores, requested_cores, sg_nodetypes, sg_nodenames)
self.total_pipeline_cores += num_cores
if num_cores > self.min_required_pipeline_cores:
self.min_required_pipeline_cores = num_cores