How to use the dragon.vm.torch.nn.modules.utils._pair function in dragon

To help you get started, we’ve selected a few dragon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github seetaresearch / Dragon / Dragon / python / dragon / vm / torch / nn / modules / conv.py View on Github external
def __init__(
        self,
        in_channels,
        out_channels,
        kernel_size,
        stride=1,
        padding=0,
        output_padding=0,
        groups=1,
        bias=True,
        dilation=1,
    ):
        kernel_size = _pair(kernel_size)
        stride = _pair(stride)
        padding = _pair(padding)
        dilation = _pair(dilation)
        super(ConvTranspose2d, self).__init__(
            in_channels, out_channels,
            kernel_size, stride, padding, dilation,
            True, _pair(output_padding), groups, bias,
        )
github seetaresearch / Dragon / Dragon / python / dragon / vm / torch / nn / modules / depthwise_conv.py View on Github external
def register_op(self):
        self.op_meta = {
            'op_type': 'DepthwiseConv{}d'.format(len(self.kernel_size)),
            'arguments': {
                'num_output': self.weight.shape[0],
                'kernel_shape': self.weight.shape[2:],
                'strides': _pair(self.stride),
                'pads': _pair(self.padding),
                'dilations': _pair(self.dilation),
                'data_format': 'NCHW',
            }
github seetaresearch / Dragon / Dragon / python / dragon / vm / torch / nn / modules / conv.py View on Github external
def __init__(
        self,
        in_channels,
        out_channels,
        kernel_size,
        stride=1,
        padding=0,
        output_padding=0,
        groups=1,
        bias=True,
        dilation=1,
    ):
        kernel_size = _pair(kernel_size)
        stride = _pair(stride)
        padding = _pair(padding)
        dilation = _pair(dilation)
        super(ConvTranspose2d, self).__init__(
            in_channels, out_channels,
            kernel_size, stride, padding, dilation,
            True, _pair(output_padding), groups, bias,
        )
github seetaresearch / Dragon / Dragon / python / dragon / vm / torch / nn / modules / depthwise_conv.py View on Github external
def __init__(
        self,
        in_channels,
        out_channels,
        kernel_size,
        stride=1,
        padding=0,
        dilation=1,
        bias=True,
    ):
        kernel_size = _pair(kernel_size)
        stride = _pair(stride)
        padding = _pair(padding)
        super(DepthwiseConv2d, self).__init__(
            in_channels, out_channels, kernel_size,
            stride, padding, dilation, bias,
        )
github seetaresearch / Dragon / Dragon / python / dragon / vm / torch / nn / modules / conv.py View on Github external
kernel_size,
        stride=1,
        padding=0,
        output_padding=0,
        groups=1,
        bias=True,
        dilation=1,
    ):
        kernel_size = _pair(kernel_size)
        stride = _pair(stride)
        padding = _pair(padding)
        dilation = _pair(dilation)
        super(ConvTranspose2d, self).__init__(
            in_channels, out_channels,
            kernel_size, stride, padding, dilation,
            True, _pair(output_padding), groups, bias,
        )
github seetaresearch / Dragon / Dragon / python / dragon / vm / torch / nn / modules / depthwise_conv.py View on Github external
def register_op(self):
        self.op_meta = {
            'op_type': 'DepthwiseConv{}d'.format(len(self.kernel_size)),
            'arguments': {
                'num_output': self.weight.shape[0],
                'kernel_shape': self.weight.shape[2:],
                'strides': _pair(self.stride),
                'pads': _pair(self.padding),
                'dilations': _pair(self.dilation),
                'data_format': 'NCHW',
            }
github seetaresearch / Dragon / Dragon / python / dragon / vm / torch / nn / modules / conv.py View on Github external
def register_op(self):
        self.op_meta = {
            'op_type': 'Conv{}{}d'.format(
                'Transpose' if self.transposed else '',
                len(self.kernel_size)),
            'arguments': {
                'num_output':
                    self.weight.shape[1] if self.transposed
                    else self.weight.shape[0],
                'kernel_shape': self.weight.shape[2:],
                'strides': _pair(self.stride),
                'pads': _pair(self.padding),
                'dilations': _pair(self.dilation),
                'output_padding': self.output_padding,
                'group': self.groups,
                'data_format': 'NCHW',
            }
github seetaresearch / Dragon / Dragon / python / dragon / vm / torch / nn / modules / pooling.py View on Github external
def register_op(self):
        self.op_meta = {
            'op_type': 'Pool2d',
            'arguments': {
                'kernel_shape': _pair(self.kernel_size),
                'strides': _pair(self.stride) if self.stride else _pair(self.kernel_size),
                'pads': _pair(self.padding),
                'mode': 'MAX',
                'data_format': 'NCHW',
                'ceil_mode': self.ceil_mode,
            }