def relu_backward

bendtorch-core@0.1.0.0 · src/tensor/elementwise.bend:59

import bendtorch-core@0.1.0.0/src/tensor/elementwise.bend as Elementwise
import Base

59# PyTorch's relu gradient, threshold_backward(g, relu(x), 0): +0.0 where
60# x <= 0, else g's own word. At x = +0.0 and -0.0 it is +0.0; at a NaN x it
61# is g.
62def relu_backward(+x: F32, g: F32) -> F32:
63  zero_if(at_most_zero(x), g)

Uses (3)

Used by (1)