`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
Python
Difficulty: Medium
Labels
triage review module: autograd module: derivatives module: correctness (silent) bot-triaged
Parent Repository
pytorch/pytorch
Python repository
100,083 27,851
Ready to work on this? Walk through the full fork-to-PR workflow so your first contribution goes smoothly.