pub struct CandleTensorFactory { /* private fields */ }Expand description
Candle tensor factory
Implementations§
Trait Implementations§
Source§impl Debug for CandleTensorFactory
impl Debug for CandleTensorFactory
Source§impl TensorFactory for CandleTensorFactory
impl TensorFactory for CandleTensorFactory
Source§fn empty(
&self,
shape: &[usize],
dtype: DataType,
device: Device,
) -> Result<TensorRef>
fn empty( &self, shape: &[usize], dtype: DataType, device: Device, ) -> Result<TensorRef>
创建指定形状/数据类型的空张量(
[MVP])Source§fn from_slice(
&self,
data: &[f32],
shape: &[usize],
dtype: DataType,
device: Device,
) -> Result<TensorRef>
fn from_slice( &self, data: &[f32], shape: &[usize], dtype: DataType, device: Device, ) -> Result<TensorRef>
通过 slice 数据创建张量(
[MVP])Source§fn narrow(
&self,
tensor: &TensorRef,
dim: usize,
start: usize,
length: usize,
) -> Result<TensorRef>
fn narrow( &self, tensor: &TensorRef, dim: usize, start: usize, length: usize, ) -> Result<TensorRef>
执行窄视图操作(
[MVP])Source§fn zeros(
&self,
shape: &[usize],
dtype: DataType,
device: &Device,
) -> Result<TensorRef>
fn zeros( &self, shape: &[usize], dtype: DataType, device: &Device, ) -> Result<TensorRef>
Create tensor filled with zeros(
[Phase 2+] 可选实现)Source§fn ones(
&self,
shape: &[usize],
dtype: DataType,
device: &Device,
) -> Result<TensorRef>
fn ones( &self, shape: &[usize], dtype: DataType, device: &Device, ) -> Result<TensorRef>
Create tensor filled with ones(
[Phase 2+])Source§fn uniform(
&self,
shape: &[usize],
low: f32,
high: f32,
dtype: DataType,
device: &Device,
) -> Result<TensorRef>
fn uniform( &self, shape: &[usize], low: f32, high: f32, dtype: DataType, device: &Device, ) -> Result<TensorRef>
Create tensor from uniform random distribution(
[Phase 2+])Auto Trait Implementations§
impl Freeze for CandleTensorFactory
impl RefUnwindSafe for CandleTensorFactory
impl Send for CandleTensorFactory
impl Sync for CandleTensorFactory
impl Unpin for CandleTensorFactory
impl UnsafeUnpin for CandleTensorFactory
impl UnwindSafe for CandleTensorFactory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more