I assume you are working on a multi-class classification use case based on the target shape.
If that’s the case, then the model output should have the shape [batch_size=30, nb_classes=7].
I don’t know where the 315 is coming from, but you might need to “remove” it. E.g. if it’s a temporal dimension, you could either use the last time step by simply indexing it in dim1 or you could also reduce this dimension via e.g. torch.mean etc.