pub fn hinge_embedding_loss_backward<T: Triton, const BLOCK_SIZE: i32>(
dy_ptr: T::Pointer<f32>,
inp_ptr: T::Pointer<f32>,
y_ptr: T::Pointer<f32>,
dx_ptr: T::Pointer<f32>,
n_elements: i32,
margin: f32,
)where
T::I32Tensor: Tensor<i32, 1> + Comparison<i32, BoolTensor = T::BoolTensor>,
T::Pointer<f32>: AddOffsets<i32, 1, T::I32Tensor, Output = T::Tensor<T::Pointer<f32>>>,Expand description
Hinge embedding loss backward (element-wise).
dx[i] = dy[i] if y[i] == 1
= -dy[i] if y[i] == -1 and margin - x[i] > 0
= 0 otherwise