n*m*3 input image to an nxm label in PyTorch
The input to my network is an RGB image with dimensions nm, how can I get the output to have dimensions of nm.

class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(3, 20, kernel_size = 5)
        self.conv2 = nn.Conv2d(20, 50, kernel_size = 3)
        self.conv3 = nn.ConvTranspose2d(50,20, kernel_size = 5)
        self.conv4 = nn.ConvTranspose2d(20,1, kernel_size = 3)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        x = F.relu(self.conv2(x))
        x = F.relu(self.conv3(x))
        x = F.relu(self.conv4(x))
    return x


I currently output a 1 * n * m. How can I output an n*m?

If you want to reshape a Tensor into a different size but with the same number of elements, generally you can use torch.view.

For your case, there is an even simpler solution: torch.squeeze returns a Tensor with all dimensions of size 1 removed. 
