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

Method set_attr

ppq/parser/caffe/caffe_export_utils.py:415–426  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

413@register_class
414class 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

Callers

nothing calls this directly

Calls 2

convert_any_to_numpyFunction · 0.90
refine_valueFunction · 0.85

Tested by

no test coverage detected