1 importtorch.nn as nn2 importtorch3
4 classconv2DBatchNormRelu(nn.Module):5 def __init__(self,in_channels,out_channels,kernel_size,stride,padding,6 bias=True,dilation=1,is_batchnorm=True):7 super(conv2DBatchNormRelu,self).__init__()8 ifis_batchnorm:9 self.cbr_unit=nn.Sequential(10 nn.Conv2d(in_channels,out_channels,kernel_size=kernel_size,stride=stride,padding=padding,11 bias=bias,dilation=dilation),12 nn.BatchNorm2d(out_channels),13 nn.ReLU(inplace=True),14 )15 else:16 self.cbr_unit=nn.Sequential(17 nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, stride=stride, padding=padding,18 bias=bias, dilation=dilation),19 nn.ReLU(inplace=True)20 )21
22 defforward(self,inputs):23 outputs=self.cbr_unit(inputs)24 returnoutputs25
26 classsegnetDown2(nn.Module):27 def __init__(self,in_channels,out_channels):28 super(segnetDown2,self).__init__()29 self.c