I assume feature_length=1024 corresponds to the number of classes in the logit tensor?
nn.CrossEntropyLoss expects the output as [batch_size, nb_classes, seq_length] and the target as [batch_size, seq_length]. Based on the target dimension, I assume 1024 is the number of classes, so you would need to permute this tensor via:
logits = logits.permute(0, 2, 1)