Solved by albanD in post #4 
              
              
                I’m afraid, you might see the same problem as https://github.com/pytorch/pytorch/issues/15506 
Can you try to run _x = torch.where(_x <= 0.008856, 9.033 * _x, 1.16 * (_x.abs()+epsilon).pow(1 / 3) - 0.16) 
This should give the same value but avoid any nan gradients.