Runtime error of PRelu
When I use nn.PReLU(num_parameters=1, init=0.25), it gives me an error
return torch.prelu(input, weight) RuntimeError: expected scalar type Half but found Float
My apex setting is
with self.amp_handle.scale_loss(loss, self.optimizer) as scaled_loss:
scaled_loss.backward()
I tried to set weight.type_as(input), but it does not work.
Is anybody can help me to fix this problem? I am very appreciate that.
It looks like you're using the deprecated API. You should move to the new API as soon as possible, and be sure to call amp.initialize() on your model and optimizer before attempting to call with amp.scale_loss...
https://nvidia.github.io/apex/amp.html
https://nvidia.github.io/apex/amp.html#transition-guide-for-old-api-users
This may resolve your issue.
It looks like you're using the deprecated API. You should move to the new API as soon as possible, and be sure to call
amp.initialize()on your model and optimizer before attempting to callwith amp.scale_loss...https://nvidia.github.io/apex/amp.html https://nvidia.github.io/apex/amp.html#transition-guide-for-old-api-users This may resolve your issue.
Yes, it helps. I reinstall apex and it works. Thank you.