Solved by albanD in post #2 
              
              
                Hi, 
I think the simplest would be: 
unw = torch.pow(unw, powers.view(-1, 1, 1).expand_as(unw))

That removes both the inplace and the for-loop