Solved by ptrblck in post #4 
              
              
                Thanks for the code. 
self.rec = torch.nn.Parameter(torch.from_numpy(init)) is creating a tensor, which is not contiguous due to the moveaxis operation on the numpy array. 
Use: 
self.rec = torch.nn.Parameter(torch.from_numpy(init).contiguous())

and the code should work. 
You can add code snippets …