Solved by ziqipang in post #2 
              
              
                Sorry if my suggestion does not work, but you may try function “view” in this case. 
You may find a lot of code using view for reshaping the tensors.