对于不同的模型格式, pad 算子将有两种不同的输入格式: for different models, possibly Pad op has the following input formats 1. pads 参数由第二个输入变量给出 pads parameter is given by the second input variable 2. pads 参数被放置于 operation.attribute 中
(self)
| 229 | self.__add_constant_input(slice, convert_any_to_torch_tensor(axes)) |
| 230 | |
| 231 | def format_pad(self) -> None: |
| 232 | """ |
| 233 | 对于不同的模型格式, pad 算子将有两种不同的输入格式: |
| 234 | for different models, possibly Pad op has the following input formats |
| 235 | 1. pads 参数由第二个输入变量给出 |
| 236 | pads parameter is given by the second input variable |
| 237 | 2. pads 参数被放置于 operation.attribute 中 |
| 238 | pads parameter is set in attribute |
| 239 | 此函数统一 pad 算子行为:所有 pad 算子的 pads 参数均由第二个输入给出 |
| 240 | """ |
| 241 | for op in self.graph.operations.values(): |
| 242 | if op.type == 'Pad' and 'pads' in op.attributes: |
| 243 | self.graph.create_variable(value=torch.tensor(op.attributes['pads']), is_parameter=True, dest_ops=[op]) |
| 244 | op.attributes.clear() |
| 245 | |
| 246 | def format_resize(self) -> None: |
| 247 | """ |
no test coverage detected