Public Member Functions | |
| at::IntArrayRef | sizes () const override |
| Return a reference to the sizes of this tensor. More... | |
| at::IntArrayRef | strides () const override |
| Return a reference to the strides of this tensor. More... | |
| int64_t | dim () const override |
| Return the number of dimensions of this tensor. More... | |
| const at::Storage & | storage () const override |
| Return the underlying storage of a Tensor. More... | |
Public Member Functions inherited from c10::TensorImpl | |
| TensorImpl (TensorTypeId type_id, const caffe2::TypeMeta &data_type, Allocator *allocator, bool is_variable) | |
| Construct a 1-dim 0-size tensor with the given settings. More... | |
| TensorImpl (Storage &&storage, TensorTypeId type_id, bool is_variable) | |
| Construct a 1-dim 0-size tensor backed by the given storage. | |
| TensorImpl (const TensorImpl &)=delete | |
| TensorImpl & | operator= (const TensorImpl &)=delete |
| TensorImpl (TensorImpl &&)=default | |
| TensorImpl & | operator= (TensorImpl &&)=default |
| virtual void | release_resources () override |
| Release (decref) storage, and any other external allocations. More... | |
| TensorTypeId | type_id () const |
| Return the TensorTypeId corresponding to this Tensor. More... | |
| virtual bool | has_storage () const |
| True if this tensor has storage. More... | |
| virtual int64_t | numel () const |
| The number of elements in a tensor. More... | |
| virtual bool | is_contiguous () const |
| Whether or not a tensor is laid out in contiguous memory. More... | |
| bool | is_sparse () const |
| bool | is_cuda () const |
| bool | is_hip () const |
| int64_t | get_device () const |
| Device | device () const |
| Layout | layout () const |
| virtual TensorImpl * | maybe_zero_dim (bool condition_when_zero_dim) |
If condition_when_zero_dim is true, and the tensor is a 1-dim, 1-size tensor, reshape the tensor into a 0-dim tensor (scalar). More... | |
| bool | is_wrapped_number () const |
| True if a tensor was auto-wrapped from a C++ or Python number. More... | |
| void | set_wrapped_number (bool value) |
| Set whether or not a tensor was auto-wrapped from a C++ or Python number. More... | |
| void | set_requires_grad (bool requires_grad) |
| Set whether or not a tensor requires gradient. More... | |
| bool | requires_grad () const |
| True if a tensor requires gradient. More... | |
| at::Tensor & | grad () |
| Return a mutable reference to the gradient. More... | |
| const at::Tensor & | grad () const |
| Return the accumulated gradient of a tensor. More... | |
| template<typename T > | |
| T * | data () const |
| Return a typed data pointer to the actual data which this tensor refers to. More... | |
| void * | data () const |
| Return a void* data pointer to the actual data which this tensor refers to. More... | |
| virtual void * | slow_data () const |
| This is just like data(), except it works with Variables. More... | |
| template<typename T > | |
| T * | unsafe_data () const |
| Like data<T>(), but performs no checks. More... | |
| const caffe2::TypeMeta & | dtype () const |
| Returns the TypeMeta of a tensor, which describes what data type it is (e.g., int, float, ...) | |
| size_t | itemsize () const |
| Return the size of a single element of this tensor in bytes. | |
| virtual int64_t | storage_offset () const |
| Return the offset in number of elements into the storage that this tensor points to. More... | |
| bool | is_empty () const |
| True if a tensor has no elements (e.g., numel() == 0). | |
| virtual void | resize_dim (int64_t ndim) |
| Change the dimensionality of a tensor. More... | |
| virtual void | set_size (int64_t dim, int64_t new_size) |
| Change the size at some dimension. More... | |
| virtual void | set_stride (int64_t dim, int64_t new_stride) |
| Change the stride at some dimension. More... | |
| virtual void | set_storage_offset (int64_t storage_offset) |
| Set the offset into the storage of this tensor. More... | |
| void | set_sizes_contiguous (IntArrayRef new_size) |
| Like set_sizes_and_strides but assumes contiguous strides. More... | |
| void | set_sizes_and_strides (IntArrayRef new_size, IntArrayRef new_stride) |
| Set the sizes and strides of a tensor. More... | |
| virtual int64_t | size (int64_t d) const |
| Return the size of a tensor at some dimension. | |
| virtual int64_t | stride (int64_t d) const |
| Return the stride of a tensor at some dimension. | |
| bool | is_variable () const |
| True if a tensor is a variable. More... | |
| virtual void | set_allow_tensor_metadata_change (bool value) |
| Set whether a tensor allows changes to its metadata (e.g. More... | |
| virtual bool | allow_tensor_metadata_change () const |
| True if a tensor allows changes to its metadata (e.g. More... | |
| void | set_autograd_meta (std::unique_ptr< c10::AutogradMetaInterface > autograd_meta) |
| Set the pointer to autograd metadata. | |
| c10::AutogradMetaInterface * | autograd_meta () const |
| Return the pointer to autograd metadata. | |
| std::unique_ptr< c10::AutogradMetaInterface > | detach_autograd_meta () |
| Detach the autograd metadata unique_ptr from this tensor, and return it. | |
| virtual c10::intrusive_ptr< TensorImpl > | shallow_copy_and_detach () const |
| DeviceType | device_type () const |
| The device type of a Tensor, e.g., DeviceType::CPU or DeviceType::CUDA. | |
| Device | GetDevice () const |
| The device of a Tensor; e.g., Device(kCUDA, 1) (the 1-index CUDA device). | |
| void | Extend (int64_t num, float growthPct) |
| Extends the outer-most dimension of this tensor by num elements, preserving the existing data. More... | |
| template<class T > | |
| void | ReserveSpace (const T &outer_dim) |
| Reserve space for the underlying tensor. More... | |
| template<typename... Ts> | |
| void | Resize (Ts...dim_source) |
| Resizes a tensor. More... | |
| void | Reshape (const std::vector< int64_t > &dims) |
| Resizes the tensor without touching underlying storage. More... | |
| void | FreeMemory () |
| Release whatever memory the tensor was holding but keep size and type information. More... | |
| void | ShareData (const TensorImpl &src) |
| Shares the data with another tensor. More... | |
| void | ShareExternalPointer (DataPtr &&data_ptr, const caffe2::TypeMeta &data_type, size_t capacity) |
| void * | raw_mutable_data (const caffe2::TypeMeta &meta) |
| Returns a mutable raw pointer of the underlying storage. More... | |
| template<typename T > | |
| T * | mutable_data () |
| Returns a typed pointer of the underlying storage. More... | |
| bool | storage_initialized () const noexcept |
| True if a tensor is storage initialized. More... | |
| bool | dtype_initialized () const noexcept |
| True if a tensor is dtype initialized. More... | |
| void | set_storage (at::Storage storage) |
Additional Inherited Members | |
Protected Member Functions inherited from c10::TensorImpl | |
| void | refresh_numel () |
| Recompute the cached numel of a tensor. More... | |
| void | refresh_contiguous () |
| Recompute the cached contiguity of a tensor. More... | |
Protected Member Functions inherited from c10::intrusive_ptr_target | |
| intrusive_ptr_target (intrusive_ptr_target &&other) noexcept | |
| intrusive_ptr_target & | operator= (intrusive_ptr_target &&other) noexcept |
| intrusive_ptr_target (const intrusive_ptr_target &other) noexcept | |
| intrusive_ptr_target & | operator= (const intrusive_ptr_target &other) noexcept |
Protected Attributes inherited from c10::TensorImpl | |
| Storage | storage_ |
| std::unique_ptr< c10::AutogradMetaInterface > | autograd_meta_ = nullptr |
| SmallVector< int64_t, 5 > | sizes_ |
| SmallVector< int64_t, 5 > | strides_ |
| int64_t | storage_offset_ = 0 |
| int64_t | numel_ = 1 |
| caffe2::TypeMeta | data_type_ |
| TensorTypeId | type_id_ |
| bool | is_contiguous_ = true |
| bool | is_variable_ = false |
| bool | is_wrapped_number_ = false |
| bool | allow_tensor_metadata_change_ = true |
| bool | reserved_ = false |
Definition at line 317 of file interpreter.cpp.
|
inlineoverridevirtual |
Return the number of dimensions of this tensor.
Note that 0-dimension represents a Tensor that is a Scalar, e.g., one that has a single element.
Reimplemented from c10::TensorImpl.
Definition at line 333 of file interpreter.cpp.
|
inlineoverridevirtual |
Return a reference to the sizes of this tensor.
This reference remains valid as long as the tensor is live and not resized.
Reimplemented from c10::TensorImpl.
Definition at line 327 of file interpreter.cpp.
|
inlineoverridevirtual |
Return the underlying storage of a Tensor.
Multiple tensors may share a single storage. A Storage is an impoverished, Tensor-like class which supports far less operations than Tensor.
Avoid using this method if possible; try to use only Tensor APIs to perform operations.
Reimplemented from c10::TensorImpl.
Definition at line 336 of file interpreter.cpp.
|
inlineoverridevirtual |
Return a reference to the strides of this tensor.
This reference remains valid as long as the tensor is live and not restrided.
Reimplemented from c10::TensorImpl.
Definition at line 330 of file interpreter.cpp.
1.8.11