pub fn hinge_embedding_loss_forward<T: Triton, const BLOCK_SIZE: i32>(
inp_ptr: T::Pointer<f32>,
y_ptr: T::Pointer<f32>,
out_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 forward (element-wise).
out[i] = x[i] if y[i] == 1
= max(0, margin - x[i]) if y[i] == -1Grid: [ceil(n / BLOCK_SIZE), 1, 1]