If I’m not wrong , you want x to change from None,64,1,151 to None,1,64,151 right? I am not quite sure how pytorch would compute the backwards gradient graph after one changes the data dimensions…
Back propogation is calculated using chain rule and probably will not work in case of change in dimensions and might not work as intended.I am of course not certian though and you could think in this direction for the solution to your problem.