`torch.clamp` / `torch.clamp_min` / `torch.clamp_max` return gradient 1.0 at boundary points where `F.relu6` and `F.hardtanh` return 0.0 for the same mathematical function

May 20, 2026 · #184574
View on GitHub
Python Difficulty: Medium

Labels

triage review module: autograd module: derivatives module: correctness (silent) bot-triaged
Ready to work on this? Walk through the full fork-to-PR workflow so your first contribution goes smoothly.

Sign in required

Authenticate to use favourites & bookmarks

5