Enum tch::IValue

source ·
#[non_exhaustive]
pub enum IValue {
Show 15 variants None, Tensor(Tensor), Double(f64), Int(i64), Bool(bool), Tuple(Vec<IValue>), IntList(Vec<i64>), DoubleList(Vec<f64>), BoolList(Vec<bool>), String(String), StringList(Vec<String>), TensorList(Vec<Tensor>), GenericList(Vec<IValue>), GenericDict(Vec<(IValue, IValue)>), Object(Object),
}
Expand description

Argument and output values for JIT models. These represent arbitrary values, e.g. tensors, atomic values, pairs of values, etc.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

None

§

Tensor(Tensor)

§

Double(f64)

§

Int(i64)

§

Bool(bool)

§

Tuple(Vec<IValue>)

§

IntList(Vec<i64>)

§

DoubleList(Vec<f64>)

§

BoolList(Vec<bool>)

§

String(String)

§

StringList(Vec<String>)

§

TensorList(Vec<Tensor>)

§

GenericList(Vec<IValue>)

§

GenericDict(Vec<(IValue, IValue)>)

§

Object(Object)

Trait Implementations§

source§

impl Debug for IValue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&str> for IValue

source§

fn from(s: &str) -> Self

Converts to this type from the input type.
source§

impl From<()> for IValue

source§

fn from((): ()) -> Self

Converts to this type from the input type.
source§

impl<T1: Into<IValue>, T2: Into<IValue>> From<(T1, T2)> for IValue

source§

fn from((p1, p2): (T1, T2)) -> Self

Converts to this type from the input type.
source§

impl<T1: Into<IValue>, T2: Into<IValue>, T3: Into<IValue>> From<(T1, T2, T3)> for IValue

source§

fn from((p1, p2, p3): (T1, T2, T3)) -> Self

Converts to this type from the input type.
source§

impl<T1: Into<IValue>, T2: Into<IValue>, T3: Into<IValue>, T4: Into<IValue>> From<(T1, T2, T3, T4)> for IValue

source§

fn from((p1, p2, p3, p4): (T1, T2, T3, T4)) -> Self

Converts to this type from the input type.
source§

impl From<Object> for IValue

source§

fn from(v: Object) -> Self

Converts to this type from the input type.
source§

impl From<String> for IValue

source§

fn from(v: String) -> Self

Converts to this type from the input type.
source§

impl From<Tensor> for IValue

source§

fn from(v: Tensor) -> Self

Converts to this type from the input type.
source§

impl From<Vec<(IValue, IValue)>> for IValue

source§

fn from(v: Vec<(IValue, IValue)>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<IValue>> for IValue

source§

fn from(v: Vec<IValue>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<String>> for IValue

source§

fn from(v: Vec<String>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Tensor>> for IValue

source§

fn from(v: Vec<Tensor>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<bool>> for IValue

source§

fn from(v: Vec<bool>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<f64>> for IValue

source§

fn from(v: Vec<f64>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<i64>> for IValue

source§

fn from(v: Vec<i64>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for IValue

source§

fn from(v: bool) -> Self

Converts to this type from the input type.
source§

impl From<f64> for IValue

source§

fn from(v: f64) -> Self

Converts to this type from the input type.
source§

impl From<i64> for IValue

source§

fn from(v: i64) -> Self

Converts to this type from the input type.
source§

impl PartialEq for IValue

source§

fn eq(&self, other: &IValue) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T1, T2, T1E, T2E> TryFrom<IValue> for (T1, T2)
where T1: TryFrom<IValue, Error = T1E>, TchError: From<T1E> + From<T2E>, T2: TryFrom<IValue, Error = T2E>,

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl<T1, T2, T3, T1E, T2E, T3E> TryFrom<IValue> for (T1, T2, T3)
where T1: TryFrom<IValue, Error = T1E>, TchError: From<T1E> + From<T2E> + From<T3E>, T2: TryFrom<IValue, Error = T2E>, T3: TryFrom<IValue, Error = T3E>,

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl<T1, T2, T3, T4, T1E, T2E, T3E, T4E> TryFrom<IValue> for (T1, T2, T3, T4)
where T1: TryFrom<IValue, Error = T1E>, TchError: From<T1E> + From<T2E> + From<T3E> + From<T4E>, T2: TryFrom<IValue, Error = T2E>, T3: TryFrom<IValue, Error = T3E>, T4: TryFrom<IValue, Error = T4E>,

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Object

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Object, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<Object>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<String>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<Tensor>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<Vec<(IValue, IValue)>>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<Vec<IValue>>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<Vec<String>>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<Vec<Tensor>>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<Vec<bool>>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<Vec<f64>>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<Vec<i64>>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<bool>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<f64>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Option<i64>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Self, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for String

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<String, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Tensor

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Tensor, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Vec<(IValue, IValue)>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Vec<(IValue, IValue)>, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Vec<IValue>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Vec<IValue>, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Vec<String>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Vec<String>, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Vec<Tensor>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Vec<Tensor>, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Vec<bool>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Vec<bool>, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Vec<f64>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Vec<f64>, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for Vec<i64>

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<Vec<i64>, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for bool

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<bool, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for f64

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<f64, TchError>

Performs the conversion.
source§

impl TryFrom<IValue> for i64

§

type Error = TchError

The type returned in the event of a conversion error.
source§

fn try_from(value: IValue) -> Result<i64, TchError>

Performs the conversion.
source§

impl StructuralPartialEq for IValue

Auto Trait Implementations§

§

impl Freeze for IValue

§

impl RefUnwindSafe for IValue

§

impl !Send for IValue

§

impl !Sync for IValue

§

impl Unpin for IValue

§

impl UnwindSafe for IValue

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V