mod compute;
#[cfg(test)]
mod tests;
use crate::error::Result;
use crate::tensor::Tensor;
pub struct Expand {
input: Tensor,
target_shape: Vec<usize>,
}
impl Expand {
#[must_use]
pub fn new(input: Tensor, target_shape: Vec<usize>) -> Self {
Self {
input,
target_shape,
}
}
pub fn execute(self) -> Result<Tensor> {
compute::execute_expand(self.input, self.target_shape)
}
}
impl Tensor {
pub fn expand_wgsl(self, target_shape: Vec<usize>) -> Result<Self> {
Expand::new(self, target_shape).execute()
}
}