As far as I understood, the cause of the problem as follows:
batch_size = 64
seq_len = 5
n_features = 1
n_class = 1
model = ModuleLSTM(n_features, n_class)

If I feed the setup above with the ‘x’ below, there is no problem as you’ve said:
x = torch.randn(batch_size, seq_len, n_features)

BUT the problem is, in the same setup above, my real data comes into ‘x’ with shape (64, 5, 2), not with (64, 5, 1). This is because of the way I generate the data I guess, but I don’t know how to fix it. Let me explain you step by step:
1-> I create X_train, y_train, X_val, y_val, X_test, y_test, I scale the X… parts. Nothing unusual. In the rest, I will just mention the training data. I merge the scaled X_train with y_train:
trainData = pd.concat([X_train_scaled, y_train],axis=1)

2-> I create my data sequences with the function below. It fetches the first “seq_len” amount of feature rows, saves into “sequence”, fetches the “seq_len+1”-th label and appends this sequence and label together to “sequences” list. Then moves into the next sequence-label pair (till the end)
def create_sequences(input_data, target_name, sequence_length):
  sequences = []
  for i in range(0, len(input_data) - sequence_length, sequence_length):
    sequence = input_data[i : i + sequence_length]
    label    = input_data.iloc[i + sequence_length][target_name]
    sequences.append((sequence, label))
  return sequences

trainSequences = create_sequences(trainData, 'gamestageEMA', seq_len)  

3-> I pass the sequences to my “DataModule” class which inherits the pl.LightningDataModule. (You can see this class and the rest in my Colab)
dataModule = DataModule(trainSequences, valSequences, testSequences, BATCH_SIZE)

it first passes “trainSequences” to my “DoomFrameDataset” class which inherits torch Dataset and as a result, it’s “self.trainDataset” is filled. Then it returns Train DataLoader in the following way:
DataLoader(self.trainDataset, batch_size=self.batchSize, shuffle=False, num_workers=cpu_count())

4->  I create the model:
model = GamestagePredictor(n_features = 1, n_classes = 1)

and you know the rest. My GameStagePredictor class fetches the sequence and label pairs and passes them to LSTM:
def training_step(self, batch, batch_idx):               
    sequences, labels = batch["sequence"], batch["label"]
    loss, outputs = self(sequences, labels)
    ...

I am sorry for this long message, I just wanted to be more specific. Concisely, the problem is about the way I pass my sequence and label pairs to my model. Since set n_features = 1 and n_classes = 1, it wants to see the input with shape (64, 5, 1), but receives (64, 5, 2) instead. I don’t know how to deal with this.