Is there anything wrong in my NN

My NN is defined as follows:

class Char_CNN(nn.Module):
def __init__(self):
    super(Char_CNN, self).__init__()
    self.convdx = torch.nn.Sequential(OrderedDict([
        ('convx', nn.Conv1d(1, 12, 20)),
        ('poolx', nn.MaxPool1d(3)),
        ('xre', nn.ReLU(True))
        ]))
    self.convdy = torch.nn.Sequential(OrderedDict([
        ('convy', nn.Conv1d(1, 12, 20)),
        ('pooly', nn.MaxPool1d(3)),
        ('yre', nn.ReLU(True))
        ]))
    self.convdz = torch.nn.Sequential(OrderedDict([
        ('convz', nn.Conv1d(1, 12, 20)),
        ('poolz', nn.MaxPool1d(3)),
        ('zre', nn.ReLU(True))
        ]))

    self.fc = nn.Sequential(
        nn.Linear(540, 1024),
        # nn.Dropout(0.5),
        nn.BatchNorm1d(1024),
        nn.ReLU(True),
        nn.Linear(1024, 30),
        nn.Dropout(0.5),
        nn.BatchNorm1d(30),
        nn.ReLU(True),
        nn.Linear(30, 13)
    )

def forward(self, x):
    after_convd = (self.convdx(x[:, :, 0]), self.convdy(x[:, :, 1]), self.convdz(x[:, :, 2]))  # 卷积

    x = torch.cat(after_convd, 2)  # 拼接,更新x
    x = x.view(x.size(0), -1)  # 展开成一维
    x = self.fc(x)
    # x = F.softmax(x)
    return x

And I choose the CrossEntropyLoss as my loss function.
However, during the training, it can’t work well.
In fact, the accuracy was only 0.07, and the loss was keeping at 012825 from start to end.
As a noviciate to deep learning and pytorch, I’ve done everything I can.
Appreciate deeply for any help!

I’m very confused by your code. What is the shape of your x? Is it an image with #channel at dim2? If so, why are you doing conv1d on each channel? That is like conv on the width dimension only.

The input is a matrix which shaped (200, 1, 3, 64) where the former two are batch size and channel number. Consider the three dimension is independent so I impose conv1d on each row.

So each data contains three independent vectors? If they are really independent, then it makes no sense to cat them together later. What is the data really? 3x64 single channel image? Or should I think of the dim2 as #channel because you are doing conv at only the last dimention?

You are right, it’s not independent completely. But my poor expression cannot make it clear. The input are accelerations from sensors in three axis (x, y, z) and the target is 13 activities, then the convolution between xyz is meaningless. For clear, the loss function used is CrossEntropy.