PyTorch
|
IValue (Interpreter Value) is a tagged union over the types supported by the TorchScript interpreter. More...
#include <ivalue.h>
Classes | |
struct | CompAliasedIValues |
struct | HashAliasedIValue |
Public Types | |
template<class T > | |
using | enable_if_ivalue_constructible = std::enable_if_t< std::is_constructible< IValue, T >::value, std::nullptr_t > |
template<class T > | |
using | enable_if_list_is_ivalue_constructible = std::enable_if_t< std::is_constructible< IValue, T >::value &&!std::is_same< T, c10::SymInt >::value, std::nullptr_t > |
template<class T > | |
using | enable_if_symint = std::enable_if_t< std::is_same< T, c10::SymInt >::value, std::nullptr_t > |
template<class T > | |
using | enable_if_ilist_is_ivalue_constructible = std::enable_if_t< std::is_constructible< IValue, T >::value &&std::is_constructible< IValue, typename IListRef< T >::boxed_type >::value &&!std::is_same< T, c10::SymInt >::value, std::nullptr_t > |
using | HashAliasedIValues = std::unordered_set< IValue, HashAliasedIValue, CompAliasedIValues > |
using | HashAliasedIValueMap = std::unordered_map< IValue, IValue, HashAliasedIValue, CompAliasedIValues > |
Public Member Functions | |
IValue (const IValue &rhs) | |
IValue (IValue &&rhs) noexcept | |
IValue & | operator= (IValue &&rhs) &noexcept |
IValue & | operator= (IValue const &rhs) & |
void | dump () const |
IValue | equals (const IValue &rhs) const |
Equality comparison. More... | |
bool | is (const IValue &rhs) const |
Identity comparison. More... | |
IValue | hash () const |
Hashing for IValues. More... | |
IValue (at::TensorBase t) | |
bool | isTensor () const |
at::Tensor | toTensor () && |
at::Tensor & | toTensor () & |
const at::Tensor & | toTensor () const & |
at::TensorImpl * | unsafeToTensorImpl () const |
IValue (at::Storage s) | |
bool | isStorage () const |
c10::Storage | toStorage () && |
c10::Storage | toStorage () const & |
const IValue & | toIValue () const |
IValue & | toIValue () |
bool | isCapsule () const |
c10::intrusive_ptr< torch::CustomClassHolder > | toCapsule () && |
c10::intrusive_ptr< torch::CustomClassHolder > | toCapsule () const & |
template<typename T , std::enable_if_t< std::is_base_of< torch::CustomClassHolder, T >::value, int > = 0> | |
IValue (intrusive_ptr< T > custom_class) | |
bool | isCustomClass () const |
template<typename T > | |
c10::intrusive_ptr< T > | toCustomClass () && |
template<typename T > | |
c10::intrusive_ptr< T > | toCustomClass () const & |
IValue (c10::intrusive_ptr< ivalue::Tuple > v) | |
template<typename... Args, std::enable_if_t< !guts::disjunction< std::is_lvalue_reference< Args >..., guts::negation< std::is_constructible< IValue, Args > >... >::value, std::nullptr_t > = nullptr> | |
IValue (const std::tuple< Args... > &t) | |
template<typename... Args, std::enable_if_t< !guts::disjunction< std::is_lvalue_reference< Args >..., guts::negation< std::is_constructible< IValue, Args > >... >::value, std::nullptr_t > = nullptr> | |
IValue (std::tuple< Args... > &&t) | |
bool | isTuple () const |
c10::intrusive_ptr< ivalue::Tuple > | toTuple () && |
c10::intrusive_ptr< ivalue::Tuple > | toTuple () const & |
ivalue::Tuple & | toTupleRef () const |
IValue (double d) | |
bool | isDouble () const |
double | toDouble () const |
template<typename T > | |
IValue (c10::complex< T > c) | |
bool | isComplexDouble () const |
c10::complex< double > | toComplexDouble () const |
IValue (c10::intrusive_ptr< ivalue::Future > v) | |
bool | isFuture () const |
c10::intrusive_ptr< ivalue::Future > | toFuture () && |
c10::intrusive_ptr< ivalue::Future > | toFuture () const & |
IValue (c10::intrusive_ptr< ivalue::Await > v) | |
bool | isAwait () const |
c10::intrusive_ptr< ivalue::Await > | toAwait () && |
c10::intrusive_ptr< ivalue::Await > | toAwait () const & |
IValue (c10::intrusive_ptr< c10::RRefInterface > v) | |
bool | isRRef () const |
c10::intrusive_ptr< c10::RRefInterface > | toRRef () && |
c10::intrusive_ptr< c10::RRefInterface > | toRRef () const & |
IValue (c10::intrusive_ptr< at::Quantizer > v) | |
bool | isQuantizer () const |
c10::intrusive_ptr< at::Quantizer > | toQuantizer () && |
c10::intrusive_ptr< at::Quantizer > | toQuantizer () const & |
IValue (int64_t i) | |
IValue (c10::SymInt i) | |
bool | isSymInt () const |
c10::SymInt | toSymInt () && |
c10::SymInt | toSymInt () const & |
IValue (c10::SymFloat i) | |
bool | isSymFloat () const |
c10::SymFloat | toSymFloat () && |
c10::SymFloat | toSymFloat () const & |
IValue (int32_t i) | |
bool | isInt () const |
int64_t | toInt () const |
IValue (bool b) | |
bool | isBool () const |
bool | toBool () const |
bool | isIntList () const |
c10::List< int64_t > | toIntList () && |
c10::List< int64_t > | toIntList () const & |
std::vector< int64_t > | toIntVector () const |
at::DimVector | toDimVector () const |
IValue (c10::intrusive_ptr< ivalue::ConstantString > v) | |
IValue (std::string v) | |
IValue (const char *v) | |
IValue (c10::string_view v) | |
bool | isString () const |
c10::intrusive_ptr< ivalue::ConstantString > | toString () && |
c10::intrusive_ptr< ivalue::ConstantString > | toString () const & |
const std::string & | toStringRef () const |
c10::optional< std::reference_wrapper< const std::string > > | toOptionalStringRef () const |
c10::string_view | toStringView () const |
bool | isDoubleList () const |
c10::List< double > | toDoubleList () && |
c10::List< double > | toDoubleList () const & |
std::vector< double > | toDoubleVector () const |
bool | isComplexDoubleList () const |
c10::List< c10::complex< double > > | toComplexDoubleList () && |
c10::List< c10::complex< double > > | toComplexDoubleList () const & |
std::vector< c10::complex< double > > | toComplexDoubleVector () const |
bool | isBoolList () const |
c10::List< bool > | toBoolList () && |
c10::List< bool > | toBoolList () const & |
bool | isTensorList () const |
c10::List< at::Tensor > | toTensorList () && |
c10::List< at::Tensor > | toTensorList () const & |
std::vector< at::Tensor > | toTensorVector () const |
bool | isOptionalTensorList () const |
c10::List< c10::optional< at::Tensor > > | toOptionalTensorList () && |
c10::List< c10::optional< at::Tensor > > | toOptionalTensorList () const & |
std::vector< c10::optional< at::Tensor > > | toOptionalTensorVector () const |
IValue (c10::List< IValue > v) | |
bool | isList () const |
c10::List< IValue > | toList () && |
c10::List< IValue > | toList () const & |
c10::ArrayRef< IValue > | toListRef () const |
template<class T , enable_if_list_is_ivalue_constructible< T > = nullptr> | |
IValue (c10::List< T > &&v) | |
template<class T , enable_if_list_is_ivalue_constructible< T > = nullptr> | |
IValue (const c10::List< T > &v) | |
template<class T , enable_if_list_is_ivalue_constructible< T > = nullptr> | |
IValue (at::ArrayRef< T > v) | |
template<class T , enable_if_list_is_ivalue_constructible< T > = nullptr> | |
IValue (const std::vector< T > &v) | |
template<class T , size_t N> | |
IValue (std::array< T, N > v) | |
template<class T , enable_if_symint< T > = nullptr> | |
IValue (at::ArrayRef< T > v) | |
template<class T , enable_if_symint< T > = nullptr> | |
IValue (at::OptionalArrayRef< T > v) | |
template<class T , enable_if_symint< T > = nullptr> | |
IValue (const std::vector< T > &v) | |
template<class T , enable_if_ilist_is_ivalue_constructible< T > = nullptr> | |
IValue (c10::IListRef< T > v) | |
IValue (c10::Dict< IValue, IValue > v) | |
bool | isGenericDict () const |
c10::Dict< IValue, IValue > | toGenericDict () && |
c10::Dict< IValue, IValue > | toGenericDict () const & |
template<class Key , class Value > | |
IValue (c10::Dict< Key, Value > v) | |
template<class Key , class Value > | |
IValue (std::unordered_map< Key, Value > v) | |
template<class T , enable_if_ivalue_constructible< T > = nullptr> | |
IValue (c10::optional< T > v) | |
template<class T , enable_if_list_is_ivalue_constructible< T > = nullptr> | |
IValue (c10::OptionalArrayRef< T > v) | |
IValue (c10::nullopt_t) | |
IValue (c10::intrusive_ptr< ivalue::Object > v) | |
bool | isObject () const |
c10::intrusive_ptr< ivalue::Object > | toObject () && |
c10::intrusive_ptr< ivalue::Object > | toObject () const & |
ivalue::Object & | toObjectRef () const |
torch::jit::Module | toModule () const |
bool | isModule () const |
IValue (c10::intrusive_ptr< ivalue::PyObjectHolder > v) | |
bool | isPyObject () const |
c10::intrusive_ptr< ivalue::PyObjectHolder > | toPyObjectHolder () && |
c10::intrusive_ptr< ivalue::PyObjectHolder > | toPyObjectHolder () const & |
PyObject * | toPyObject () const |
IValue (c10::intrusive_ptr< ivalue::EnumHolder > v) | |
bool | isEnum () const |
c10::intrusive_ptr< ivalue::EnumHolder > | toEnumHolder () && |
c10::intrusive_ptr< ivalue::EnumHolder > | toEnumHolder () const & |
IValue () | |
bool | isNone () const |
std::string | toNone () const |
IValue (const at::Scalar &s) | |
bool | isScalar () const |
at::Scalar | toScalar () const |
IValue (c10::Device d) | |
bool | isDevice () const |
c10::Device | toDevice () const |
IValue (c10::Stream s) | |
c10::Stream | toStream () && |
c10::Stream | toStream () const & |
bool | isStream () const |
IValue (ScalarType t) | |
at::ScalarType | toScalarType () const |
IValue (Layout l) | |
at::Layout | toLayout () const |
IValue (MemoryFormat m) | |
at::MemoryFormat | toMemoryFormat () const |
IValue (at::QScheme qscheme) | |
at::QScheme | toQScheme () const |
IValue (at::Dimname dimname) | |
at::Dimname | toDimname () const |
IValue (at::Generator g) | |
bool | isGenerator () const |
at::Generator | toGenerator () && |
at::Generator | toGenerator () const & |
std::string | tagKind () const |
template<typename T > | |
T | to () && |
template<typename T > | |
c10::detail::ivalue_to_const_ref_overload_return< T >::type | to () const & |
template<typename T > | |
optional< T > | toOptional () |
template<typename T > | |
optional< T > | toOptional () const |
std::ostream & | repr (std::ostream &stream, std::function< bool(std::ostream &, const IValue &v)> customFormatter) const |
bool | isPtrType () const |
template<typename T = c10::PlatformType> | |
TypePtr | type () const |
bool | overlaps (const IValue &rhs) const |
void | getSubValues (HashAliasedIValues &subValues) const |
void | visit (const std::function< bool(const IValue &)> &visitor) const |
IValue | deepcopy () const |
IValue | deepcopy (HashAliasedIValueMap &memo) const |
Static Public Member Functions | |
static size_t | hash (const IValue &iv) |
static IValue | make_capsule (intrusive_ptr< torch::CustomClassHolder > blob) |
static IValue | uninitialized () |
Friends | |
struct | WeakIValue |
bool | operator== (const IValue &lhs, const IValue &rhs) |
This implements the same semantics as bool(lhs == rhs) in Python. More... | |
bool | operator!= (const IValue &lhs, const IValue &rhs) |
bool | _fastEqualsForContainer (const IValue &lhs, const IValue &rhs) |
[doxygen private] [container equality] This is an equality implementation that assumes objects with the same identity equal themselves, for efficiency reasons. More... | |
std::ostream & | operator<< (std::ostream &out, const IValue &v) |
IValue (Interpreter Value) is a tagged union over the types supported by the TorchScript interpreter.
IValues contain their values as an IValue::Payload
, which holds primitive types (int64_t
, bool
, double
, Device
) and Tensor
as values, and all other types as a c10::intrusive_ptr
. In order to optimize performance of the destructor and related operations by making the Tensor
and c10::intrusive_ptr
paths generate the same code, we represent a null c10::intrusive_ptr
as UndefinedTensorImpl::singleton()
, not nullptr
.
IValues are used as inputs to and outputs from the TorchScript interpreter. To retrieve the value contained within an IValue, use the .toX()
methods, where X
is the type you are trying to get. Note that neither the .toX()
methods nor the templated .to<T>
functions do any kind of casting, they only unwrap the contained value. For example:
embed:rst:leading-asterisk * .. code-block:: cpp * * // Make the IValue * torch::IValue my_ivalue(26); * std::cout << my_ivalue << "\n"; * * // Unwrap the IValue * int64_t my_int = my_ivalue.toInt(); * std::cout << my_int << "\n"; * * // This will throw an error! * // `my_ivalue` is tagged as an int and cannot be used as another type * torch::Tensor my_tensor = my_ivalue.toTensor(); *
using c10::IValue::enable_if_ilist_is_ivalue_constructible = std::enable_if_t< std::is_constructible<IValue, T>::value && std::is_constructible<IValue, typename IListRef<T>::boxed_type>::value && !std::is_same<T, c10::SymInt>::value, std::nullptr_t> |
using c10::IValue::enable_if_ivalue_constructible = std::enable_if_t<std::is_constructible<IValue, T>::value, std::nullptr_t> |
using c10::IValue::enable_if_list_is_ivalue_constructible = std::enable_if_t<std::is_constructible<IValue, T>::value && !std::is_same<T, c10::SymInt>::value, std::nullptr_t> |
using c10::IValue::enable_if_symint = std::enable_if_t<std::is_same<T, c10::SymInt>::value, std::nullptr_t> |
using c10::IValue::HashAliasedIValueMap = std::unordered_map<IValue, IValue, HashAliasedIValue, CompAliasedIValues> |
using c10::IValue::HashAliasedIValues = std::unordered_set<IValue, HashAliasedIValue, CompAliasedIValues> |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
c10::IValue::IValue | ( | intrusive_ptr< T > | custom_class | ) |
c10::IValue::IValue | ( | c10::intrusive_ptr< ivalue::Tuple > | v | ) |
c10::IValue::IValue | ( | const std::tuple< Args... > & | t | ) |
c10::IValue::IValue | ( | std::tuple< Args... > && | t | ) |
|
inline |
c10::IValue::IValue | ( | c10::complex< T > | c | ) |
c10::IValue::IValue | ( | c10::intrusive_ptr< ivalue::Future > | v | ) |
c10::IValue::IValue | ( | c10::intrusive_ptr< ivalue::Await > | v | ) |
c10::IValue::IValue | ( | c10::intrusive_ptr< c10::RRefInterface > | v | ) |
c10::IValue::IValue | ( | c10::intrusive_ptr< at::Quantizer > | v | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
c10::IValue::IValue | ( | c10::intrusive_ptr< ivalue::ConstantString > | v | ) |
c10::IValue::IValue | ( | std::string | v | ) |
|
inline |
|
inline |
c10::IValue::IValue | ( | c10::List< T > && | v | ) |
c10::IValue::IValue | ( | const c10::List< T > & | v | ) |
c10::IValue::IValue | ( | at::ArrayRef< T > | v | ) |
c10::IValue::IValue | ( | const std::vector< T > & | v | ) |
c10::IValue::IValue | ( | std::array< T, N > | v | ) |
c10::IValue::IValue | ( | at::ArrayRef< T > | v | ) |
c10::IValue::IValue | ( | at::OptionalArrayRef< T > | v | ) |
c10::IValue::IValue | ( | const std::vector< T > & | v | ) |
c10::IValue::IValue | ( | c10::IListRef< T > | v | ) |
c10::IValue::IValue | ( | c10::Dict< Key, Value > | v | ) |
c10::IValue::IValue | ( | std::unordered_map< Key, Value > | v | ) |
c10::IValue::IValue | ( | c10::optional< T > | v | ) |
c10::IValue::IValue | ( | c10::OptionalArrayRef< T > | v | ) |
c10::IValue::IValue | ( | c10::nullopt_t | ) |
c10::IValue::IValue | ( | c10::intrusive_ptr< ivalue::Object > | v | ) |
c10::IValue::IValue | ( | c10::intrusive_ptr< ivalue::PyObjectHolder > | v | ) |
|
explicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
IValue c10::IValue::deepcopy | ( | ) | const |
IValue c10::IValue::deepcopy | ( | HashAliasedIValueMap & | memo | ) | const |
void c10::IValue::dump | ( | ) | const |
Equality comparison.
The semantics are the same as Python's ==
:
torch.eq()
)Why does this return an IValue instead of a bool? Because in PyTorch, tensor1 == tensor2
returns a BoolTensor
, not a bool.
NOTE: we (like Python) assume that identity equality implies value equality for efficiency. TODO: need to support customizing equality
void c10::IValue::getSubValues | ( | HashAliasedIValues & | subValues | ) | const |
|
inline |
Hashing for IValues.
Returns an IValue-boxed int.
Some notes:
hash()
on these types will throw.
|
static |
bool c10::IValue::is | ( | const IValue & | rhs | ) | const |
Identity comparison.
Checks if this
is the same object as rhs
. The semantics are the same as Python's is
operator.
NOTE: Like in Python, this operation is poorly defined for primitive types like numbers and strings. Prefer to use ==
unless you really want to check identity equality.
|
inline |
|
inline |
bool c10::IValue::isBoolList | ( | ) | const |
|
inline |
|
inline |
bool c10::IValue::isComplexDoubleList | ( | ) | const |
bool c10::IValue::isCustomClass | ( | ) | const |
|
inline |
|
inline |
bool c10::IValue::isDoubleList | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool c10::IValue::isIntList | ( | ) | const |
|
inline |
bool c10::IValue::isModule | ( | ) | const |
|
inline |
|
inline |
bool c10::IValue::isOptionalTensorList | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool c10::IValue::isTensorList | ( | ) | const |
|
inline |
|
inlinestatic |
bool c10::IValue::overlaps | ( | const IValue & | rhs | ) | const |
std::ostream & c10::IValue::repr | ( | std::ostream & | stream, |
std::function< bool(std::ostream &, const IValue &v)> | customFormatter | ||
) | const |
|
inline |
T c10::IValue::to | ( | ) | && |
c10::detail::ivalue_to_const_ref_overload_return< T >::type c10::IValue::to | ( | ) | const & |
c10::intrusive_ptr< ivalue::Await > c10::IValue::toAwait | ( | ) | && |
c10::intrusive_ptr< ivalue::Await > c10::IValue::toAwait | ( | ) | const & |
|
inline |
c10::List< bool > c10::IValue::toBoolList | ( | ) | && |
c10::List< bool > c10::IValue::toBoolList | ( | ) | const & |
c10::intrusive_ptr< torch::CustomClassHolder > c10::IValue::toCapsule | ( | ) | && |
c10::intrusive_ptr< torch::CustomClassHolder > c10::IValue::toCapsule | ( | ) | const & |
c10::complex< double > c10::IValue::toComplexDouble | ( | ) | const |
c10::List< c10::complex< double > > c10::IValue::toComplexDoubleList | ( | ) | && |
c10::List< c10::complex< double > > c10::IValue::toComplexDoubleList | ( | ) | const & |
std::vector< c10::complex< double > > c10::IValue::toComplexDoubleVector | ( | ) | const |
c10::intrusive_ptr< T > c10::IValue::toCustomClass | ( | ) | && |
c10::intrusive_ptr< T > c10::IValue::toCustomClass | ( | ) | const & |
|
inline |
|
inline |
at::DimVector c10::IValue::toDimVector | ( | ) | const |
|
inline |
c10::List< double > c10::IValue::toDoubleList | ( | ) | && |
c10::List< double > c10::IValue::toDoubleList | ( | ) | const & |
std::vector< double > c10::IValue::toDoubleVector | ( | ) | const |
c10::intrusive_ptr< ivalue::EnumHolder > c10::IValue::toEnumHolder | ( | ) | && |
c10::intrusive_ptr< ivalue::EnumHolder > c10::IValue::toEnumHolder | ( | ) | const & |
c10::intrusive_ptr< ivalue::Future > c10::IValue::toFuture | ( | ) | && |
c10::intrusive_ptr< ivalue::Future > c10::IValue::toFuture | ( | ) | const & |
at::Generator c10::IValue::toGenerator | ( | ) | && |
at::Generator c10::IValue::toGenerator | ( | ) | const & |
|
inline |
c10::List< int64_t > c10::IValue::toIntList | ( | ) | && |
c10::List< int64_t > c10::IValue::toIntList | ( | ) | const & |
std::vector< int64_t > c10::IValue::toIntVector | ( | ) | const |
|
inline |
|
inline |
|
inline |
c10::ArrayRef< IValue > c10::IValue::toListRef | ( | ) | const |
|
inline |
torch::jit::Module c10::IValue::toModule | ( | ) | const |
|
inline |
c10::intrusive_ptr< ivalue::Object > c10::IValue::toObject | ( | ) | && |
c10::intrusive_ptr< ivalue::Object > c10::IValue::toObject | ( | ) | const & |
ivalue::Object & c10::IValue::toObjectRef | ( | ) | const |
optional< T > c10::IValue::toOptional | ( | ) |
optional< T > c10::IValue::toOptional | ( | ) | const |
c10::optional< std::reference_wrapper< const std::string > > c10::IValue::toOptionalStringRef | ( | ) | const |
c10::List< c10::optional< at::Tensor > > c10::IValue::toOptionalTensorList | ( | ) | && |
c10::List< c10::optional< at::Tensor > > c10::IValue::toOptionalTensorList | ( | ) | const & |
std::vector< c10::optional< at::Tensor > > c10::IValue::toOptionalTensorVector | ( | ) | const |
PyObject * c10::IValue::toPyObject | ( | ) | const |
c10::intrusive_ptr< ivalue::PyObjectHolder > c10::IValue::toPyObjectHolder | ( | ) | && |
c10::intrusive_ptr< ivalue::PyObjectHolder > c10::IValue::toPyObjectHolder | ( | ) | const & |
|
inline |
c10::intrusive_ptr< at::Quantizer > c10::IValue::toQuantizer | ( | ) | && |
c10::intrusive_ptr< at::Quantizer > c10::IValue::toQuantizer | ( | ) | const & |
c10::intrusive_ptr< c10::RRefInterface > c10::IValue::toRRef | ( | ) | && |
c10::intrusive_ptr< c10::RRefInterface > c10::IValue::toRRef | ( | ) | const & |
|
inline |
|
inline |
c10::Storage c10::IValue::toStorage | ( | ) | && |
c10::Storage c10::IValue::toStorage | ( | ) | const & |
c10::Stream c10::IValue::toStream | ( | ) | && |
c10::Stream c10::IValue::toStream | ( | ) | const & |
c10::intrusive_ptr< ivalue::ConstantString > c10::IValue::toString | ( | ) | && |
c10::intrusive_ptr< ivalue::ConstantString > c10::IValue::toString | ( | ) | const & |
const std::string & c10::IValue::toStringRef | ( | ) | const |
c10::string_view c10::IValue::toStringView | ( | ) | const |
c10::SymFloat c10::IValue::toSymFloat | ( | ) | && |
c10::SymFloat c10::IValue::toSymFloat | ( | ) | const & |
c10::SymInt c10::IValue::toSymInt | ( | ) | && |
c10::SymInt c10::IValue::toSymInt | ( | ) | const & |
at::Tensor & c10::IValue::toTensor | ( | ) | & |
at::Tensor c10::IValue::toTensor | ( | ) | && |
const at::Tensor & c10::IValue::toTensor | ( | ) | const & |
c10::List< at::Tensor > c10::IValue::toTensorList | ( | ) | && |
c10::List< at::Tensor > c10::IValue::toTensorList | ( | ) | const & |
std::vector< at::Tensor > c10::IValue::toTensorVector | ( | ) | const |
c10::intrusive_ptr< ivalue::Tuple > c10::IValue::toTuple | ( | ) | && |
c10::intrusive_ptr< ivalue::Tuple > c10::IValue::toTuple | ( | ) | const & |
ivalue::Tuple & c10::IValue::toTupleRef | ( | ) | const |
TypePtr c10::IValue::type | ( | ) | const |
|
inlinestatic |
|
inline |
void c10::IValue::visit | ( | const std::function< bool(const IValue &)> & | visitor | ) | const |
[doxygen private] [container equality] This is an equality implementation that assumes objects with the same identity equal themselves, for efficiency reasons.
We primarily have this for consistency, because Python does the same thing. This actually provokes user-visible changes in behavior due to quirks in torch: [tensor1] == [tensor1] -> True (because container equality will first compare identity) [tensor1] == [tensor1_copy] -> RuntimeError: Boolean value of Tensor with more than one value is ambiguous
|
friend |
This implements the same semantics as bool(lhs == rhs)
in Python.
which is the same as equals()
except for Tensor types.
|
friend |