use crate::matrix::{MoeExpertPlan, TopKResult};
use crate::{Matrix, Result};
impl Matrix {
pub fn add(&self, right: &Matrix) -> Result<Self> {
crate::matrix::add(self, right)
}
pub fn sub(&self, right: &Matrix) -> Result<Self> {
crate::matrix::sub(self, right)
}
pub fn mul(&self, right: &Matrix) -> Result<Self> {
crate::matrix::mul(self, right)
}
pub fn div(&self, right: &Matrix) -> Result<Self> {
crate::matrix::div(self, right)
}
pub fn scale(&self, scalar: f32) -> Result<Self> {
crate::matrix::scale(self, scalar)
}
pub fn neg(&self) -> Result<Self> {
crate::matrix::neg(self)
}
pub fn abs(&self) -> Result<Self> {
crate::matrix::abs(self)
}
pub fn log(&self) -> Result<Self> {
crate::matrix::log(self)
}
pub fn sqrt(&self) -> Result<Self> {
crate::matrix::sqrt(self)
}
pub fn pow(&self, exponent: f32) -> Result<Self> {
crate::matrix::pow(self, exponent)
}
pub fn add_scalar(&self, scalar: f32) -> Result<Self> {
crate::matrix::add_scalar(self, scalar)
}
pub fn sub_scalar(&self, scalar: f32) -> Result<Self> {
crate::matrix::sub_scalar(self, scalar)
}
pub fn div_scalar(&self, scalar: f32) -> Result<Self> {
crate::matrix::div_scalar(self, scalar)
}
pub fn exp(&self) -> Result<Self> {
crate::matrix::exp(self)
}
pub fn sin(&self) -> Result<Self> {
crate::matrix::sin(self)
}
pub fn cos(&self) -> Result<Self> {
crate::matrix::cos(self)
}
pub fn reciprocal(&self) -> Result<Self> {
crate::matrix::reciprocal(self)
}
pub fn clamp_max(&self, maximum: f32) -> Result<Self> {
crate::matrix::clamp_max(self, maximum)
}
pub fn clamp_min(&self, minimum: f32) -> Result<Self> {
crate::matrix::clamp_min(self, minimum)
}
pub fn copy(&self) -> Result<Self> {
crate::matrix::copy(self)
}
pub fn mat_mul_nt(&self, right: &Matrix) -> Result<Self> {
crate::matrix::mat_mul_nt(self, right)
}
pub fn softmax(&self, dim: i32) -> Result<Self> {
crate::matrix::softmax(self, dim)
}
pub fn log_softmax(&self, dim: i32) -> Result<Self> {
crate::matrix::log_softmax(self, dim)
}
pub fn sum(&self, dim: i32) -> Result<Self> {
crate::matrix::sum(self, dim)
}
pub fn categorical_accuracy_count(&self, labels: &Matrix) -> Result<Self> {
crate::matrix::categorical_accuracy_count(self, labels)
}
pub fn masked_categorical_accuracy_count(&self, labels: &Matrix, mask: &Matrix) -> Result<Self> {
crate::matrix::masked_categorical_accuracy_count(self, labels, mask)
}
pub fn philox_uniform(&self, low: f32, high: f32, seed: u64) -> Result<Self> {
crate::matrix::philox_uniform(self, low, high, seed)
}
pub fn philox_normal(&self, mean: f32, stddev: f32, seed: u64) -> Result<Self> {
crate::matrix::philox_normal(self, mean, stddev, seed)
}
pub fn dropout(&self, probability: f32, seed: u64) -> Result<Self> {
crate::matrix::dropout(self, probability, seed)
}
pub fn sample_logits(&self, temperature: f32, top_k: i32, top_p: f32, seed: u64) -> Result<Self> {
crate::matrix::sample_logits(self, temperature, top_k, top_p, seed)
}
pub fn top_k(&self, k: i32, dim: i32) -> Result<TopKResult> {
crate::matrix::top_k(self, k, dim)
}
pub fn top_k_mask(&self, num_experts: usize) -> Result<Self> {
crate::matrix::top_k_mask(self, num_experts)
}
pub fn moe_expert_plan(&self, num_experts: usize) -> Result<MoeExpertPlan> {
crate::matrix::moe_expert_plan(self, num_experts)
}
pub fn moe_routing_bias_update(
&self,
bias: &Matrix,
experts_per_token: usize,
gamma: f32,
) -> Result<()> {
crate::matrix::moe_routing_bias_update(self, bias, experts_per_token, gamma)
}
pub fn slice(&self, dim: i32, start: i64, end: i64) -> Result<Self> {
crate::matrix::slice(self, dim, start, end)
}
pub fn repeat_interleave(&self, repeats: usize, dim: i32) -> Result<Self> {
crate::matrix::repeat_interleave(self, repeats, dim)
}
pub fn gather(&self, indices: &Matrix) -> Result<Self> {
crate::matrix::gather(self, indices)
}
pub fn gather_last_dim(&self, indices: &Matrix) -> Result<Self> {
crate::matrix::gather_last_dim(self, indices)
}
pub fn transpose(&self, dim0: i32, dim1: i32) -> Result<Self> {
crate::matrix::transpose(self, dim0, dim1)
}
pub fn equal(&self, value: f32) -> Result<Self> {
crate::matrix::equal(self, value)
}
pub fn reshape(&self, shape: impl Into<Vec<usize>>) -> Result<Self> {
crate::matrix::reshape(self, shape)
}
}
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = crate::matrix::add;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = Matrix::add;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = crate::matrix::sub;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = Matrix::sub;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = crate::matrix::mul;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = Matrix::mul;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = crate::matrix::div;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = Matrix::div;
const _: fn(&Matrix, f32) -> Result<Matrix> = crate::matrix::scale;
const _: fn(&Matrix, f32) -> Result<Matrix> = Matrix::scale;
const _: fn(&Matrix) -> Result<Matrix> = crate::matrix::neg;
const _: fn(&Matrix) -> Result<Matrix> = Matrix::neg;
const _: fn(&Matrix) -> Result<Matrix> = crate::matrix::abs;
const _: fn(&Matrix) -> Result<Matrix> = Matrix::abs;
const _: fn(&Matrix) -> Result<Matrix> = crate::matrix::log;
const _: fn(&Matrix) -> Result<Matrix> = Matrix::log;
const _: fn(&Matrix) -> Result<Matrix> = crate::matrix::sqrt;
const _: fn(&Matrix) -> Result<Matrix> = Matrix::sqrt;
const _: fn(&Matrix, f32) -> Result<Matrix> = crate::matrix::pow;
const _: fn(&Matrix, f32) -> Result<Matrix> = Matrix::pow;
const _: fn(&Matrix, f32) -> Result<Matrix> = crate::matrix::add_scalar;
const _: fn(&Matrix, f32) -> Result<Matrix> = Matrix::add_scalar;
const _: fn(&Matrix, f32) -> Result<Matrix> = crate::matrix::sub_scalar;
const _: fn(&Matrix, f32) -> Result<Matrix> = Matrix::sub_scalar;
const _: fn(&Matrix, f32) -> Result<Matrix> = crate::matrix::div_scalar;
const _: fn(&Matrix, f32) -> Result<Matrix> = Matrix::div_scalar;
const _: fn(&Matrix) -> Result<Matrix> = crate::matrix::exp;
const _: fn(&Matrix) -> Result<Matrix> = Matrix::exp;
const _: fn(&Matrix) -> Result<Matrix> = crate::matrix::sin;
const _: fn(&Matrix) -> Result<Matrix> = Matrix::sin;
const _: fn(&Matrix) -> Result<Matrix> = crate::matrix::cos;
const _: fn(&Matrix) -> Result<Matrix> = Matrix::cos;
const _: fn(&Matrix) -> Result<Matrix> = crate::matrix::reciprocal;
const _: fn(&Matrix) -> Result<Matrix> = Matrix::reciprocal;
const _: fn(&Matrix, f32) -> Result<Matrix> = crate::matrix::clamp_max;
const _: fn(&Matrix, f32) -> Result<Matrix> = Matrix::clamp_max;
const _: fn(&Matrix, f32) -> Result<Matrix> = crate::matrix::clamp_min;
const _: fn(&Matrix, f32) -> Result<Matrix> = Matrix::clamp_min;
const _: fn(&Matrix) -> Result<Matrix> = crate::matrix::copy;
const _: fn(&Matrix) -> Result<Matrix> = Matrix::copy;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = crate::matrix::mat_mul_nt;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = Matrix::mat_mul_nt;
const _: fn(&Matrix, i32) -> Result<Matrix> = crate::matrix::softmax;
const _: fn(&Matrix, i32) -> Result<Matrix> = Matrix::softmax;
const _: fn(&Matrix, i32) -> Result<Matrix> = crate::matrix::log_softmax;
const _: fn(&Matrix, i32) -> Result<Matrix> = Matrix::log_softmax;
const _: fn(&Matrix, i32) -> Result<Matrix> = crate::matrix::sum;
const _: fn(&Matrix, i32) -> Result<Matrix> = Matrix::sum;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = crate::matrix::categorical_accuracy_count;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = Matrix::categorical_accuracy_count;
const _: fn(&Matrix, &Matrix, &Matrix) -> Result<Matrix> =
crate::matrix::masked_categorical_accuracy_count;
const _: fn(&Matrix, &Matrix, &Matrix) -> Result<Matrix> =
Matrix::masked_categorical_accuracy_count;
const _: fn(&Matrix, f32, f32, u64) -> Result<Matrix> = crate::matrix::philox_uniform;
const _: fn(&Matrix, f32, f32, u64) -> Result<Matrix> = Matrix::philox_uniform;
const _: fn(&Matrix, f32, f32, u64) -> Result<Matrix> = crate::matrix::philox_normal;
const _: fn(&Matrix, f32, f32, u64) -> Result<Matrix> = Matrix::philox_normal;
const _: fn(&Matrix, f32, u64) -> Result<Matrix> = crate::matrix::dropout;
const _: fn(&Matrix, f32, u64) -> Result<Matrix> = Matrix::dropout;
const _: fn(&Matrix, f32, i32, f32, u64) -> Result<Matrix> = crate::matrix::sample_logits;
const _: fn(&Matrix, f32, i32, f32, u64) -> Result<Matrix> = Matrix::sample_logits;
const _: fn(&Matrix, i32, i32) -> Result<TopKResult> = crate::matrix::top_k;
const _: fn(&Matrix, i32, i32) -> Result<TopKResult> = Matrix::top_k;
const _: fn(&Matrix, usize) -> Result<Matrix> = crate::matrix::top_k_mask;
const _: fn(&Matrix, usize) -> Result<Matrix> = Matrix::top_k_mask;
const _: fn(&Matrix, usize) -> Result<MoeExpertPlan> = crate::matrix::moe_expert_plan;
const _: fn(&Matrix, usize) -> Result<MoeExpertPlan> = Matrix::moe_expert_plan;
const _: fn(&Matrix, &Matrix, usize, f32) -> Result<()> = crate::matrix::moe_routing_bias_update;
const _: fn(&Matrix, &Matrix, usize, f32) -> Result<()> = Matrix::moe_routing_bias_update;
const _: fn(&Matrix, i32, i64, i64) -> Result<Matrix> = crate::matrix::slice;
const _: fn(&Matrix, i32, i64, i64) -> Result<Matrix> = Matrix::slice;
const _: fn(&Matrix, usize, i32) -> Result<Matrix> = crate::matrix::repeat_interleave;
const _: fn(&Matrix, usize, i32) -> Result<Matrix> = Matrix::repeat_interleave;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = crate::matrix::gather;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = Matrix::gather;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = crate::matrix::gather_last_dim;
const _: fn(&Matrix, &Matrix) -> Result<Matrix> = Matrix::gather_last_dim;
const _: fn(&Matrix, i32, i32) -> Result<Matrix> = crate::matrix::transpose;
const _: fn(&Matrix, i32, i32) -> Result<Matrix> = Matrix::transpose;
const _: fn(&Matrix, f32) -> Result<Matrix> = crate::matrix::equal;
const _: fn(&Matrix, f32) -> Result<Matrix> = Matrix::equal;