[Bug]: torch frontend inconsistent gradient behaviour of torch.nn.relu6 #10584
Labels
Bug Report
Report bugs detected in Ivy.
PyTorch Frontend
Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist
Bug Explanation
the implementation of torch.nn.relu6 in Pytorch Frontend uses
ivy.minimum
andivy.maximum
, this implementation is identical toivy.clip
which usestorch.clamp
when using torch backend.The problem arises when calculating gradients because
torch.clamp
has a gradient of 1 when the input is 0 or 6 whiletorch.nn.relu6
has a gradient of 0 when the input is 0 or 6 (at the non-differentiable point)Steps to Reproduce Bug
Environment
Windows 11 using Docker and VS Code
Ivy Version
v1.1.9
Backend
Device
No response
The text was updated successfully, but these errors were encountered: