Esempio n. 1
0
 def forward(self, x):
     x = M.activation(x, M.PARAM_RELU)
     x1 = self.c1(x)
     x2 = self.c2(x[:, 1:, 1:, :])
     x = torch.cat([x1, x2], axis=1)
     x = self.bn(x)
     return x
Esempio n. 2
0
	def forward(self, x):
		out = [x[0]]
		out.append(self.c1(x[1], x[0].shape[2:4]))
		out.append(self.c2(x[2], x[0].shape[2:4]))
		out.append(self.c3(x[3], x[0].shape[2:4]))
		out = sum(out)
		out = M.activation(out, M.PARAM_RELU)
		return out 
Esempio n. 3
0
 def forward(self, x):
     x = F.interpolate(x,
                       size=None,
                       scale_factor=2,
                       mode='bilinear',
                       align_corners=False)
     x = M.activation(x, M.PARAM_RELU)
     x = self.c1(x)
     return x
Esempio n. 4
0
	def forward(self, x):
		branch = self.c1(x)
		branch = self.c2(branch)
		if self.shortcut:
			sc = self.sc(x)
		else:
			sc = x 
		res = branch + sc
		res = M.activation(res, M.PARAM_RELU)
		return res 
Esempio n. 5
0
    def forward(self, x):
        out = self.c1(x)
        out = self.c2(out)
        out = self.c3(out)

        if self.inchn == self.outchn * 4 and self.stride == 1:
            sc = x
        else:
            sc = self.sc(x)
        out = out + sc
        out = M.activation(out, M.PARAM_RELU)
        return out
Esempio n. 6
0
	def forward(self, x):
		out = []
		for i in range(len(self.branches)): # target
			branch_out = []
			for j in range(len(self.branches)): # source
				if i==j:
					branch_out.append(x[i])
				elif i<j:
					branch_out.append(self.branches[i][j](x[j] , target_shape=x[i].shape[2:4]))
				else:
					branch_out.append(self.branches[i][j](x[j]))
			branch_out = sum(branch_out)
			out.append(M.activation(branch_out, M.PARAM_RELU))
		return out 
Esempio n. 7
0
    def forward(self, x):
        short = x

        # residual branch
        branch = self.bn(x)
        branch = M.activation(branch, M.PARAM_LRELU)
        branch = self.c1(branch)
        branch = self.c2(branch)

        # slicing & shortcut
        branch_shape = branch.shape[-1]
        short_shape = short.shape[-1]
        start = (short_shape - branch_shape) // 2
        short = short[:, :, start:start + branch_shape]
        res = short + branch
        res = F.dropout(res, 0.4, self.training, False)
        return res
Esempio n. 8
0
 def forward(self, x):
     x = M.activation(x, M.PARAM_RELU)
     x = self.c1(x)
     return x