pub enum DefaultScalarsRef<'a> {
Tensor(&'a DefaultScalars),
View(DefaultScalarsView<'a>),
}Expand description
Core-neutral tensor input reference.
§Examples
use tenferro_tensor::{DefaultScalars, DefaultScalarsRef};
let tensor = DefaultScalars::from_vec_col_major(vec![1], vec![1.0_f32])?;
let reference = DefaultScalarsRef::Tensor(&tensor);
assert_eq!(reference.shape(), &[1]);Variants§
Tensor(&'a DefaultScalars)
View(DefaultScalarsView<'a>)
Implementations§
Source§impl<'a> DefaultScalarsRef<'a>
impl<'a> DefaultScalarsRef<'a>
Sourcepub fn dtype(&self) -> DType
pub fn dtype(&self) -> DType
Return the referenced dtype.
§Examples
use tenferro_tensor::{DefaultScalars, DefaultScalarsRef, DType};
let tensor = DefaultScalars::from_vec_col_major(vec![1], vec![1_i64])?;
assert_eq!(DefaultScalarsRef::Tensor(&tensor).dtype(), DType::I64);Sourcepub fn shape(&self) -> &[usize]
pub fn shape(&self) -> &[usize]
Borrow the referenced shape.
§Examples
use tenferro_tensor::{DefaultScalars, DefaultScalarsRef};
let tensor = DefaultScalars::from_vec_col_major(vec![1], vec![1_i64])?;
assert_eq!(DefaultScalarsRef::Tensor(&tensor).shape(), &[1]);Trait Implementations§
Source§impl<'a> Clone for DefaultScalarsRef<'a>
impl<'a> Clone for DefaultScalarsRef<'a>
Source§fn clone(&self) -> DefaultScalarsRef<'a>
fn clone(&self) -> DefaultScalarsRef<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> !RefUnwindSafe for DefaultScalarsRef<'a>
impl<'a> !UnwindSafe for DefaultScalarsRef<'a>
impl<'a> Freeze for DefaultScalarsRef<'a>
impl<'a> Send for DefaultScalarsRef<'a>
impl<'a> Sync for DefaultScalarsRef<'a>
impl<'a> Unpin for DefaultScalarsRef<'a>
impl<'a> UnsafeUnpin for DefaultScalarsRef<'a>
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