cast op 的参数 to 默认为 int,使用该函数将其封装为 ppq.core.DataType.
(self)
| 315 | operation.attributes.pop('indices') |
| 316 | |
| 317 | def format_cast(self) -> None: |
| 318 | """cast op 的参数 to 默认为 int,使用该函数将其封装为 ppq.core.DataType.""" |
| 319 | interested_ops = [] |
| 320 | for _, operation in self.graph.operations.items(): |
| 321 | assert isinstance(operation, Operation) |
| 322 | if operation.type == 'Cast': interested_ops.append(operation) |
| 323 | for operation in interested_ops: |
| 324 | assert isinstance(operation, Operation) |
| 325 | assert 'to' in operation.attributes |
| 326 | operation.attributes['to'] = DataType.convert_from_numpy(operation.attributes['to']) |
| 327 | |
| 328 | def format_int64_constant(self) -> None: |
| 329 | """convert all int64 constants to int32, check if direct dtype cast is |
no test coverage detected