pub enum IValueKind {
Tensor,
Bool,
Int,
IntList,
Double,
String,
TensorList,
Device,
None,
Other,
}
Expand description
Enum representing the different internal types an IValue
can hold.
Check each variant docs to see what the internal storage in C++ is, and what the cost of moving across the Rust<>C++ boundary is.
Variants§
Tensor
- C++ type:
at::Tensor
- Rust type:
Tensor
Bool
- C++ type:
bool
- Rust type:
bool
Int
- C++ type:
int64_t
- Rust type:
i64
IntList
- C++ type:
c10::List<int64_t>
- Rust type:
Vec<i64>
Passing across the C++-Rust boundary will copy the vector.
Double
- C++ type:
double
- Rust type:
f64
String
- C++ type:
c10::intrusive_ptr<ConstantString>
- Rust type:
String
Passing across the C++-Rust boundary will copy the string.
TensorList
- C++ type:
c10::List<at::Tensor>
- Rust type:
Vec<Tensor>
Passing across the C++-Rust boundary will copy the vector.
Device
- C++ type:
c10::Device
- Rust type:
Device
None
Other
Catch-all for all other types. This is used for types that are not natively supported in rust and can remain as opaque IValues for interacting with torch apis. There is an overhead associated with tracking alias and borrows for any trivial IValues being converted to this type so they should be natively supported. Most of them are already supported.
Trait Implementations§
Source§impl Clone for IValueKind
impl Clone for IValueKind
Source§fn clone(&self) -> IValueKind
fn clone(&self) -> IValueKind
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for IValueKind
impl Debug for IValueKind
Source§impl PartialEq for IValueKind
impl PartialEq for IValueKind
impl Copy for IValueKind
impl Eq for IValueKind
impl StructuralPartialEq for IValueKind
Auto Trait Implementations§
impl Freeze for IValueKind
impl RefUnwindSafe for IValueKind
impl Send for IValueKind
impl Sync for IValueKind
impl Unpin for IValueKind
impl UnwindSafe for IValueKind
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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