pub fn margin_ranking_loss_forward<T: Triton, const BLOCK_SIZE: i32>(
x1_ptr: T::Pointer<f32>,
x2_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
Margin ranking loss forward (element-wise).
out[i] = max(0, -y[i] * (x1[i] - x2[i]) + margin)
Grid: [ceil(n / BLOCK_SIZE), 1, 1]