def _extract_model_args(args, unknown_args, temp_filename): unknown_args.extend(['--framework', args.dstFramework]) unknown_args.extend(['--inputNetwork', temp_filename + '.pb']) unknown_args.extend(['--inputWeight', temp_filename + '.npy']) unknown_args.extend(['--output', args.outputModel]) model_parser = IRToModel._get_parser() return model_parser.parse_known_args(unknown_args)
def _main(): parser = _get_parser() args, unknown_args = parser.parse_known_args() temp_filename = uuid.uuid4().hex ir_args, unknown_args = _extract_ir_args(args, unknown_args, temp_filename) ret = convertToIR._convert(ir_args) if int(ret) != 0: _sys.exit(int(ret)) if args.dstFramework != 'coreml': network_filename = get_network_filename(args.dstFramework, temp_filename, args.outputModel) code_args, unknown_args = _extract_code_args(args, unknown_args, temp_filename, network_filename) ret = IRToCode._convert(code_args) if int(ret) != 0: _sys.exit(int(ret)) from mmdnn.conversion._script.dump_code import dump_code dump_code(args.dstFramework, network_filename + '.py', temp_filename + '.npy', args.outputModel, args.dump_tag) #remove_temp_files(temp_filename) else: model_args, unknown_args = _extract_model_args(args, unknown_args, temp_filename) ret = IRToModel._convert(model_args) #remove_temp_files(temp_filename) _sys.exit(int(ret))
def _main(): parser = _get_parser() args, unknown_args = parser.parse_known_args() temp_filename = uuid.uuid4().hex ir_args, unknown_args = _extract_ir_args(args, unknown_args, temp_filename) ret = convertToIR._convert(ir_args) if int(ret) != 0: _sys.exit(int(ret)) if args.dstFramework != 'coreml': code_args, unknown_args = _extract_code_args(args, unknown_args, temp_filename) ret = IRToCode._convert(code_args) if int(ret) != 0: _sys.exit(int(ret)) from mmdnn.conversion._script.dump_code import dump_code dump_code(args.dstFramework, temp_filename + '.py', temp_filename + '.npy', args.outputModel) remove_temp_files(temp_filename) elif args.dstType == 'model': model_args, unknown_args = _extract_model_args(args, unknown_args, temp_filename) ret = IRToModel._convert(model_args) remove_temp_files(temp_filename) _sys.exit(int(ret))