Solved by Youyoun in post #2 
              
              
                This flattens your y array completely, removing the first dimension, which is batch_size. Use x = torch.flatten(y, start_dim=1) to keep the batches dimension (as per flatten ). The -1 you see in your summary is supposed to represente the batch_size (same thing as None in your keras model summary). …