get a onnx node from singa _Conv2d and _Pooling2d operator Args: op: a given operator Args: op_t: the tensor of the operator Returns: the onnx node
(cls, op, op_t)
| 621 | |
| 622 | @classmethod |
| 623 | def _create_conv_pool(cls, op, op_t): |
| 624 | """ |
| 625 | get a onnx node from singa _Conv2d and _Pooling2d operator |
| 626 | Args: |
| 627 | op: a given operator |
| 628 | Args: |
| 629 | op_t: the tensor of the operator |
| 630 | Returns: |
| 631 | the onnx node |
| 632 | """ |
| 633 | node = cls._common_singa_tensor_to_onnx_node(op, op_t) |
| 634 | |
| 635 | k = [op.handle.kernel_h, op.handle.kernel_w] |
| 636 | s = [op.handle.stride_h, op.handle.stride_w] |
| 637 | oddp = op.odd_padding |
| 638 | p = [ |
| 639 | op.handle.pad_h + oddp[0], |
| 640 | op.handle.pad_w + oddp[1], |
| 641 | op.handle.pad_w + oddp[2], |
| 642 | op.handle.pad_h + oddp[3], |
| 643 | ] |
| 644 | |
| 645 | node.attribute.extend([ |
| 646 | helper.make_attribute('kernel_shape', k), |
| 647 | helper.make_attribute('pads', p), |
| 648 | helper.make_attribute('strides', s), |
| 649 | ]) |
| 650 | if cls._get_singa_op_type(op) == '_Conv2d': |
| 651 | node.op_type = cls._rename_operators.get('_Conv2d') |
| 652 | node.attribute.extend([ |
| 653 | helper.make_attribute('group', op.handle.group), |
| 654 | helper.make_attribute('auto_pad', 'NOTSET'), |
| 655 | ]) |
| 656 | |
| 657 | elif op.handle.is_max_pooling: |
| 658 | node.op_type = cls._rename_operators.get('MaxPool2d') |
| 659 | else: |
| 660 | node.op_type = cls._rename_operators.get('AvgPool2d') |
| 661 | return node |
| 662 | |
| 663 | @classmethod |
| 664 | def _get_singa_op_inputs_outputs(cls, op): |
nothing calls this directly
no test coverage detected