(self)
| 413 | @register_class |
| 414 | class Pad(CaffeOpExporter): |
| 415 | def set_attr(self): |
| 416 | mode = refine_value(self.op.attributes.get('mode', 'constant')) |
| 417 | if mode != 'reflect': |
| 418 | raise TypeError(f'Unsupport pad mode {mode} in caffe op') |
| 419 | |
| 420 | pads = convert_any_to_numpy(self.op.inputs[1].value) if len(self.op.inputs) > 1 else refine_value(self.op.attributes['pads']) |
| 421 | if len(pads) == 2: |
| 422 | pads = [pads[0], 0, pads[1], 0] |
| 423 | phs, pws, phe, pwe = pads |
| 424 | assert phs == phe and pws == pwe |
| 425 | self.layer.pad_param.pad_h = phs |
| 426 | self.layer.pad_param.pad_w = pws |
| 427 | |
| 428 | |
| 429 | # TODO: InterP and other cases |
nothing calls this directly
no test coverage detected