Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
)
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',
}
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,
)
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,
)
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,
)
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',
}
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',
}
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,
}