Hello everyone!
I’m trying to build a neural network that can generate label score for classification and use the NLLLoss2d function.
I have 1000 samples, each sample is a vector of 180 entries. Thus the input is a 1000x100 matrix. For each sample in the input, I am trying to generate two 3x5 matrices, containing scores for the two labels. Thus the output should be a 1000x2x3x5 tensor as described in the doc of NLLLoss2d function.
In the network, I used an array of nn.Linear() functions:
class Net(torch.nn.Module):
    def __init__(self):       
        super(Net, self).__init__()
        self.linear = [[torch.nn.Linear(100, 2) for i in range(5)] for j in range(3)]
        
    def forward(self, x):   
        y = [[[0,0] for i in range(5)] for j in range(3)] 
        for i in range(3):
            for j in range(5):
                y[i][j]=torch.nn.functional.log_softmax(nnFunc.relu(self.linear[i][j](x)))                 
        return y

However, the output of the network is a list of dimension 3x5x1000x2. The first two dimensions are of list type, and the last two dimensions are of Variable type.
I am trying to permutate the tensor I got from the network, but I’m not sure it could be used later by the  backward-propagation function.
I would appreciate for any help!