Conv 2d operator Args: handle (object): ConvHandle for cpu or CudnnConvHandle for gpu x (Tensor): input W (Tensor): weight b (Tensor): bias odd_padding (tuple of four ints):, the odd paddding is the value that cannot be handled by the tupl
(handle, x, W, b=None, odd_padding=(0, 0, 0, 0))
| 1719 | |
| 1720 | |
| 1721 | def conv2d(handle, x, W, b=None, odd_padding=(0, 0, 0, 0)): |
| 1722 | """ |
| 1723 | Conv 2d operator |
| 1724 | Args: |
| 1725 | handle (object): ConvHandle for cpu or CudnnConvHandle for gpu |
| 1726 | x (Tensor): input |
| 1727 | W (Tensor): weight |
| 1728 | b (Tensor): bias |
| 1729 | odd_padding (tuple of four ints):, the odd paddding is the value |
| 1730 | that cannot be handled by the tuple padding (w, h) mode so |
| 1731 | we need to firstly handle the input, then use the nomal padding |
| 1732 | method. |
| 1733 | """ |
| 1734 | if b is None: |
| 1735 | return _Conv2d(handle, odd_padding)(x, W)[0] |
| 1736 | else: |
| 1737 | return _Conv2d(handle, odd_padding)(x, W, b)[0] |
| 1738 | |
| 1739 | |
| 1740 | class _BatchNorm2d(Operator): |