Commit 8cba2160 authored by E144069X's avatar E144069X

Removed reflect padding

parent 3e8fb033
......@@ -34,7 +34,7 @@ model_urls = {
def conv3x3(in_planes, out_planes, stride=1,dilation=1,groups=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=0, bias=False,dilation=dilation,groups=groups)
padding=dilation, bias=False,dilation=dilation,groups=groups)
def conv1x1(in_planes, out_planes, stride=1):
......@@ -60,21 +60,13 @@ class BasicBlock(nn.Module):
self.feat = feat
self.p2d = (1, 1, 1, 1)
if type(stride) is int:
stride = [stride,stride]
self.p2d_stri = (stride[0]==1, 1, stride[1]==1, 1)
def forward(self, x):
identity = x
out = self.conv1(x)
out = F.pad(out, self.p2d_stri, "reflect")
out = self.bn1(out)
out = self.relu(out)
out = self.conv2(out)
out = F.pad(out, self.p2d, "reflect")
out = self.bn2(out)
if self.downsample is not None:
......@@ -106,13 +98,6 @@ class Bottleneck(nn.Module):
self.feat = feat
self.p2d = (1, 1, 1, 1)
if type(stride) is int:
stride = [stride,stride]
self.p2d_stri = (stride[0]==1, 1, stride[1]==1, 1)
def forward(self, x):
identity = x
......@@ -121,7 +106,6 @@ class Bottleneck(nn.Module):
out = self.relu(out)
out = self.conv2(out)
out = F.pad(out, self.p2d_stri, "reflect")
out = self.bn2(out)
out = self.relu(out)
......@@ -157,7 +141,7 @@ class ResNet(nn.Module):
if norm_layer is None:
norm_layer = nn.BatchNorm2d
self.inplanes = chan
self.conv1 = nn.Conv2d(inChan, chan, kernel_size=7, stride=1 if not preLayerSizeReduce else stride,bias=False)
self.conv1 = nn.Conv2d(inChan, chan, kernel_size=7, stride=1 if not preLayerSizeReduce else stride,bias=False,padding=3)
self.bn1 = norm_layer(chan)
self.relu = nn.ReLU(inplace=True)
self.maxpool = nn.MaxPool2d(kernel_size=maxPoolKer, stride=1 if not preLayerSizeReduce else stride, padding=maxPoolPad)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment