MCPcopy
hub / github.com/OpenPPL/ppq / process

Method process

ppq/IR/morph.py:174–201  ·  view source on GitHub ↗
(self, command: GraphCommand)

Source from the content-addressed store, hash-verified

172 ]
173
174 def process(self, command: GraphCommand) -> Any:
175 if command.command_type == GraphCommandType.FORMAT_CLIP:
176 return self.format_clip()
177 if command.command_type == GraphCommandType.FORMAT_PAD:
178 return self.format_pad()
179 if command.command_type == GraphCommandType.FORMAT_GATHER:
180 return self.format_gather()
181 if command.command_type == GraphCommandType.FORMAT_CAST:
182 return self.format_cast()
183 if command.command_type == GraphCommandType.DELETE_ISOLATED:
184 return self.delete_isolated()
185 if command.command_type == GraphCommandType.FORMAT_INT64_CONSTANT:
186 return self.format_int64_constant()
187 if command.command_type == GraphCommandType.FORMAT_PARAMETERS:
188 return self.format_parameter()
189 if command.command_type == GraphCommandType.FORMAT_CONSTANT_INPUT:
190 return self.remove_constant_input()
191 if command.command_type == GraphCommandType.FORMAT_SLICE:
192 return self.format_slice()
193 if command.command_type == GraphCommandType.FORMAT_RESIZE:
194 return self.format_resize()
195 if command.command_type == GraphCommandType.TRUNCATE_ON_VAR:
196 assert isinstance(command, TruncateGraphCommand), f'Use TruncateGraphCommand here.'
197 return self.truncate_on_var(command.var, command.mark_as_output)
198 if command.command_type == GraphCommandType.REMOVE_IDENTITY:
199 return self.remove_identity()
200 if command.command_type == GraphCommandType.CONVERT_TO_TENSOR:
201 return self.convert_to_tensor()
202
203 def format_slice(self) -> None:
204 """

Callers

nothing calls this directly

Calls 13

format_clipMethod · 0.95
format_padMethod · 0.95
format_gatherMethod · 0.95
format_castMethod · 0.95
delete_isolatedMethod · 0.95
format_int64_constantMethod · 0.95
format_parameterMethod · 0.95
remove_constant_inputMethod · 0.95
format_sliceMethod · 0.95
format_resizeMethod · 0.95
truncate_on_varMethod · 0.95
remove_identityMethod · 0.95

Tested by

no test coverage detected