Public Member Functions | |
TensorOptions (Layout layout) | |
Constructs a TensorOptions object with the given layout. | |
template<typename T , typename = c10::guts::enable_if_t<std::is_same<c10::guts::decay_t<T>, Device>::value>> | |
TensorOptions (T &&device) | |
Constructs a TensorOptions object with the given device. More... | |
template<typename... Args, typename = c10::guts::enable_if_t<std::is_constructible<Device, Args&&...>::value>> | |
TensorOptions (Args &&...args) | |
Constructs a TensorOptions object from arguments allowed in Device constructors. More... | |
TensorOptions (caffe2::TypeMeta dtype) | |
Constructs a TensorOptions object with the given dtype. | |
TensorOptions (ScalarType dtype) | |
legacy constructor to support ScalarType | |
bool | operator== (const TensorOptions &other) const noexcept |
True if all elements of the TensorOptions match that of the other. | |
bool | operator!= (const TensorOptions &other) const noexcept |
True if any of the elements of this TensorOptions do not match that of the other. More... | |
C10_NODISCARD TensorOptions | device (c10::optional< Device > device) const noexcept |
Return a copy of TensorOptions with device set to the given one, or cleared if device is nullopt . More... | |
template<typename... Args> | |
C10_NODISCARD TensorOptions | device (Args &&...args) const noexcept |
Return a copy of TensorOptions with device set to the given one. More... | |
C10_NODISCARD TensorOptions | device_index (int16_t device_index) const noexcept |
Return a copy of TensorOptions , but with device set to CUDA, and the device index set to the given one. More... | |
C10_NODISCARD TensorOptions | dtype (c10::optional< caffe2::TypeMeta > dtype) const noexcept |
Return a copy of TensorOptions with dtype set to the given one. | |
C10_NODISCARD TensorOptions | dtype (c10::optional< ScalarType > dtype) const noexcept |
template<typename T > | |
TensorOptions & | dtype () |
C10_NODISCARD TensorOptions | layout (c10::optional< Layout > layout) const noexcept |
Sets the layout of the TensorOptions . | |
C10_NODISCARD TensorOptions | requires_grad (c10::optional< bool > requires_grad) const noexcept |
Sets the requires_grad property of the TensorOptions . | |
C10_NODISCARD TensorOptions | is_variable (c10::optional< bool > is_variable) const noexcept |
Sets the is_variable property on the TensorOptions . | |
Device | device () const noexcept |
Returns the device of the TensorOptions . | |
bool | has_device () const noexcept |
Returns whether the device is specified. | |
c10::optional< Device > | device_opt () const noexcept |
Returns the device of the TensorOptions , or c10::nullopt if device is not specified. More... | |
int32_t | device_index () const noexcept |
Returns the device index of the TensorOptions . | |
caffe2::TypeMeta | dtype () const noexcept |
Returns the dtype of the TensorOptions . | |
bool | has_dtype () const noexcept |
Returns whether the dtype is specified. | |
c10::optional< caffe2::TypeMeta > | dtype_opt () const noexcept |
Returns the dtype of the TensorOptions , or c10::nullopt if device is not specified. More... | |
Layout | layout () const noexcept |
Returns the layout of the TensorOptions . | |
bool | has_layout () const noexcept |
Returns whether the layout is specified. | |
c10::optional< Layout > | layout_opt () const noexcept |
Returns the layout of the TensorOptions , or c10::nullopt if layout is not specified. More... | |
bool | requires_grad () const noexcept |
Returns the requires_grad property of the TensorOptions . | |
bool | has_requires_grad () const noexcept |
Returns whether the requires_grad is specified. | |
c10::optional< bool > | requires_grad_opt () const noexcept |
Returns the requires_grad property of the TensorOptions , or c10::nullopt if requires_grad is not specified. More... | |
bool | is_variable () const noexcept |
Returns the is_variable property of the TensorOptions . | |
bool | has_is_variable () const noexcept |
Returns whether the is_variable is specified. | |
c10::optional< bool > | is_variable_opt () const noexcept |
Returns the is_variable property of the TensorOptions , or c10::nullopt if is_variable is not specified. More... | |
Backend | backend () const noexcept |
TensorTypeId | computeTensorTypeId () const |
Definition at line 99 of file TensorOptions.h.
|
inline |
Constructs a TensorOptions
object with the given device.
See NOTE [ TensorOptions Constructors ] on why this is templatized.
Definition at line 119 of file TensorOptions.h.
|
inline |
Constructs a TensorOptions
object from arguments allowed in Device
constructors.
See NOTE [ TensorOptions Constructors ].
NB: Ideally we only allow implicit constructors here. But there is no easy way to detect them. So we have this one that allows explicit constructors too.
Definition at line 133 of file TensorOptions.h.
|
inlinenoexcept |
Return a copy of TensorOptions
with device
set to the given one, or cleared if device
is nullopt
.
Definition at line 169 of file TensorOptions.h.
|
inlinenoexcept |
Return a copy of TensorOptions
with device
set to the given one.
(This overload ensures that variadic template c10::optional constructor for Device work correctly.)
Definition at line 179 of file TensorOptions.h.
|
inlinenoexcept |
Return a copy of TensorOptions
, but with device set to CUDA, and the device index set to the given one.
TODO: This function encourages bad behavior (assuming CUDA is the only device that matters). Get rid of it / rename it.
Definition at line 188 of file TensorOptions.h.
|
inlinenoexcept |
Returns the device of the TensorOptions
, or c10::nullopt
if device is not specified.
Definition at line 247 of file TensorOptions.h.
|
inlinenoexcept |
Returns the dtype of the TensorOptions
, or c10::nullopt
if device is not specified.
Definition at line 268 of file TensorOptions.h.
|
inlinenoexcept |
Returns the is_variable
property of the TensorOptions
, or c10::nullopt
if is_variable
is not specified.
Definition at line 317 of file TensorOptions.h.
|
inlinenoexcept |
Returns the layout of the TensorOptions
, or c10::nullopt
if layout is not specified.
Definition at line 284 of file TensorOptions.h.
|
inlinenoexcept |
True if any of the elements of this TensorOptions
do not match that of the other.
Definition at line 163 of file TensorOptions.h.
|
inlinenoexcept |
Returns the requires_grad
property of the TensorOptions
, or c10::nullopt
if requires_grad
is not specified.
Definition at line 300 of file TensorOptions.h.