use super::kernel::elementwise_binary;
use crate::backend_ops::{BinaryOp, ElementwiseOps};
use coeus_core::Scalar;
use coeus_tensor::Tensor;
#[inline]
pub fn eq<T: Scalar, B: ElementwiseOps<T>>(
a: &Tensor<T, B>,
b: &Tensor<T, B>,
backend: &B,
) -> Result<Tensor<T, B>, B::Error> {
elementwise_binary(a, b, backend, BinaryOp::Eq)
}
#[inline]
pub fn ne<T: Scalar, B: ElementwiseOps<T>>(
a: &Tensor<T, B>,
b: &Tensor<T, B>,
backend: &B,
) -> Result<Tensor<T, B>, B::Error> {
elementwise_binary(a, b, backend, BinaryOp::Ne)
}
#[inline]
pub fn lt<T: Scalar, B: ElementwiseOps<T>>(
a: &Tensor<T, B>,
b: &Tensor<T, B>,
backend: &B,
) -> Result<Tensor<T, B>, B::Error> {
elementwise_binary(a, b, backend, BinaryOp::Lt)
}
#[inline]
pub fn gt<T: Scalar, B: ElementwiseOps<T>>(
a: &Tensor<T, B>,
b: &Tensor<T, B>,
backend: &B,
) -> Result<Tensor<T, B>, B::Error> {
elementwise_binary(a, b, backend, BinaryOp::Gt)
}
#[inline]
pub fn le<T: Scalar, B: ElementwiseOps<T>>(
a: &Tensor<T, B>,
b: &Tensor<T, B>,
backend: &B,
) -> Result<Tensor<T, B>, B::Error> {
elementwise_binary(a, b, backend, BinaryOp::Le)
}
#[inline]
pub fn ge<T: Scalar, B: ElementwiseOps<T>>(
a: &Tensor<T, B>,
b: &Tensor<T, B>,
backend: &B,
) -> Result<Tensor<T, B>, B::Error> {
elementwise_binary(a, b, backend, BinaryOp::Ge)
}