Chiara:

        # transforms X to dimensions: n_steps X batch_size X n_inputs
        X = X.permute(1, 0, 2) 

        # The data flows through the RNN layer and then through the fully-connected layer.        
        self.batch_size = X.size(1) # size of 2nd element of X



You permuted X to make batch the second dimension. Going by that, the self.hidden has to be permuted back to make batch the first dimension before feeding to self.FC.