Enum tract_pulse::internal::tract_core::value::TValue
pub enum TValue {
Const(Arc<Tensor>),
Var(Rc<Tensor>),
}
Variants§
Implementations§
§impl TValue
impl TValue
pub fn is_exclusive(&self) -> bool
pub fn from_const(t: Arc<Tensor>) -> TValue
Methods from Deref<Target = Tensor>§
pub fn broadcast_scalar_to_shape( &self, shape: &[usize] ) -> Result<Tensor, Error>
pub fn datum_type(&self) -> DatumType
pub fn datum_type(&self) -> DatumType
Get the datum type of the tensor.
pub fn dump(&self, force_full: bool) -> Result<String, Error>
pub fn dump(&self, force_full: bool) -> Result<String, Error>
Dump the tensor in a human readable form.
force_full
will force the tensor to be dump in full even if it is big.
pub fn close_enough(
&self,
other: &Tensor,
approx: impl Into<Approximation> + Debug
) -> Result<(), Error>
pub fn close_enough( &self, other: &Tensor, approx: impl Into<Approximation> + Debug ) -> Result<(), Error>
Compare two tensors, allowing for rounding errors.
pub fn to_array_view<D>(
&self
) -> Result<ArrayBase<ViewRepr<&D>, Dim<IxDynImpl>>, Error>where
D: Datum,
pub fn to_array_view<D>( &self ) -> Result<ArrayBase<ViewRepr<&D>, Dim<IxDynImpl>>, Error>where D: Datum,
Transform the data as a ndarray::Array
.
pub unsafe fn to_array_view_unchecked<D>(
&self
) -> ArrayBase<ViewRepr<&D>, Dim<IxDynImpl>>where
D: Datum,
pub unsafe fn to_array_view_unchecked<D>( &self ) -> ArrayBase<ViewRepr<&D>, Dim<IxDynImpl>>where D: Datum,
Transform the data as a ndarray::Array
.
pub unsafe fn as_ptr_unchecked<D>(&self) -> *const Dwhere
D: Datum,
pub unsafe fn as_ptr_unchecked<D>(&self) -> *const Dwhere D: Datum,
Access the data as a pointer.
pub unsafe fn as_slice_unchecked<D>(&self) -> &[D]where
D: Datum,
pub unsafe fn as_slice_unchecked<D>(&self) -> &[D]where D: Datum,
Access the data as a slice.
pub fn to_scalar_tensor(&self) -> Result<Tensor, Error>
pub fn to_scalar_tensor(&self) -> Result<Tensor, Error>
Make the tensor a scalar tensor (assumes it contains a single value).
pub unsafe fn to_scalar_unchecked<D>(&self) -> &Dwhere
D: Datum,
pub unsafe fn to_scalar_unchecked<D>(&self) -> &Dwhere D: Datum,
Access the data as a scalar.
pub unsafe fn as_bytes(&self) -> &[u8] ⓘ
pub fn is_uniform(&self) -> bool
pub fn as_uniform(&self) -> Option<Tensor>
pub fn is_zero(&self) -> Result<bool, Error>
pub fn cast_to<D>(&self) -> Result<Cow<'_, Tensor>, Error>where
D: Datum,
pub fn cast_to<D>(&self) -> Result<Cow<'_, Tensor>, Error>where D: Datum,
Optionnaly convert data to a tensor for a new DatumType.
pub fn cast_to_dt(&self, dst_dt: DatumType) -> Result<Cow<'_, Tensor>, Error>
pub fn cast_to_dt(&self, dst_dt: DatumType) -> Result<Cow<'_, Tensor>, Error>
Optionnaly convert data to a tensor for a new DatumType.
pub fn cast_to_scalar<D>(&self) -> Result<D, Error>where
D: Datum + Copy,
pub fn cast_to_scalar<D>(&self) -> Result<D, Error>where D: Datum + Copy,
Access the data as a scalar, after a cast.
pub fn nth(&self, nth: usize) -> Result<Tensor, Error>
pub fn nth(&self, nth: usize) -> Result<Tensor, Error>
Access the nth element of the tensor, returned as a 0-rank Tensor
pub fn deep_clone(&self) -> Tensor
pub fn slice( &self, axis: usize, start: usize, end: usize ) -> Result<Tensor, Error>
pub fn view(&self) -> TensorView<'_>
pub fn view_at_prefix(&self, prefix: &[usize]) -> Result<TensorView<'_>, Error>
pub fn view_offsetting(&self, coords: &[usize]) -> Result<TensorView<'_>, Error>
pub unsafe fn view_offsetting_unchecked( &self, coords: &[usize] ) -> TensorView<'_>
pub fn offset_u8_as_i8(self: &Arc<Tensor>) -> Arc<Tensor>
pub fn offset_u8_as_i8(self: &Arc<Tensor>) -> Arc<Tensor>
Offsets the tensor as an i8 type if it’s an u8 type, otherwise passes it unchanged.
Trait Implementations§
§impl IntoArcTensor for TValue
impl IntoArcTensor for TValue
§fn into_arc_tensor(self) -> Arc<Tensor>
fn into_arc_tensor(self) -> Arc<Tensor>
Convert Self to a Arc. Read more
§impl IntoTensor for TValue
impl IntoTensor for TValue
§fn into_tensor(self) -> Tensor
fn into_tensor(self) -> Tensor
Convert Self to a Tensor. Read more
impl Eq for TValue
impl StructuralEq for TValue
impl StructuralPartialEq for TValue
Auto Trait Implementations§
impl RefUnwindSafe for TValue
impl !Send for TValue
impl !Sync for TValue
impl Unpin for TValue
impl UnwindSafe for TValue
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.