fn
positive_mask_storage
→Storageint positive_mask_storage(const int & s, int numel, Dtype dt, Device device)Mask elements that are strictly positive: (s > 0) ? 1 : 0.
Used by the ReLU backward pass to gate the gradient through positive activations.
Parameters
sconst Storage&Input buffer (typically the ReLU's saved input).
numelstd::size_tNumber of elements.
dtDtypeOutput dtype.
deviceDeviceTarget device.
Returns
StorageNew storage holding the {0, 1} gate.