pub trait TensorBuilder<B: Backend + ?Sized> {
// Required methods
fn build_from_slice<T: NumericType>(
&self,
data: &[T],
shape: &[usize],
) -> Result<B::Tensor, B::Error>;
fn build_from_vec<T: NumericType>(
&self,
data: Vec<T>,
shape: &[usize],
) -> Result<B::Tensor, B::Error>;
fn zeros(
&self,
shape: &[usize],
dtype: impl DataType,
) -> Result<B::Tensor, B::Error>;
fn ones(
&self,
shape: &[usize],
dtype: impl DataType,
) -> Result<B::Tensor, B::Error>;
fn randn(
&self,
shape: &[usize],
dtype: impl DataType,
) -> Result<B::Tensor, B::Error>;
fn with_device(self, device: B::Device) -> Self;
}
Required Methods§
fn build_from_slice<T: NumericType>( &self, data: &[T], shape: &[usize], ) -> Result<B::Tensor, B::Error>
fn build_from_vec<T: NumericType>( &self, data: Vec<T>, shape: &[usize], ) -> Result<B::Tensor, B::Error>
fn zeros( &self, shape: &[usize], dtype: impl DataType, ) -> Result<B::Tensor, B::Error>
fn ones( &self, shape: &[usize], dtype: impl DataType, ) -> Result<B::Tensor, B::Error>
fn randn( &self, shape: &[usize], dtype: impl DataType, ) -> Result<B::Tensor, B::Error>
fn with_device(self, device: B::Device) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.