In my forward function, I resize and concatenate 2 output from 2 LSTM, then I put this concatenated tensor into a  connected network with Relu and Sigmoid. I am wondering whether Pytotch is able to track gradient after I resize and concatenate the output from 2 LSTM. Since even the loss is decreasing after back propagation, but the accuracy on the test set is not improving.
        output_allhiden_1,(final_hidden_state_1,final_cell_state_1)=self.LSTM_1(input_1)
        output_allhiden_2,(final_hidden_state_2,final_cell_state_2)=self.LSTM_2(input_2)
        final_hidden_state_1=final_hidden_state_1.view(num_layers,batchsize,-1)
        final_hidden_state_2=final_hidden_state_2.view(num_layers,batchsize,-1)
        concat=torch.cat((final_hidden_state_1[num_layers-1],final_hidden_state_2[num_layers-1]),dim=1)
        output_p=self.output1(concat)
        tanhoutput=self.relu(output_p)
        output_p2=self.output2(tanhoutput)
        sigput_p2=self.sig(output_p2)