How to transform pyinnn Conv2dDepthWise to pytorch same api?

#21 · open · 1 comments

View on GitHub ↗

lucasjinreal

I got some old codes have Conv2dDepthWise in pyinn, how to change it to newest pytorch api?

Comments

lucasjinreal

``` from pyinn.modules import Conv2dDepthwise class BasicSepConv(nn.Module): def __init__(self, in_planes, kernel_size, stride=1, padding=0, dilation=1, groups=1, relu=True, bn=True, bias=False): super(BasicSepConv, self).__init__() self.out_channels = in_planes self.conv = Conv2dDepthwise(in_planes, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, bias=bias) self.bn = nn.BatchNorm2d(in_planes, eps=1e-5, momentum=0.01, affine=True) if bn else None self.relu = nn.ReLU(inplace=True) if relu else None def forward(self, x): x = self.conv(x) if self.bn is not None: x = self.bn(x) if self.relu is not None: x = self.relu(x) return x ```