Fix subgradient for element-wise max and min (#59669)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/59669
Fixes #56734
Test Plan: Imported from OSS
Reviewed By: albanD
Differential Revision: D28975531
fbshipit-source-id: 4e774dc8c6e095bc66962ce2411466de3880c2d3