|
Mila
Deep Neural Network Library
|
Base tensor pointer class that wraps a raw pointer with memory-type safety. More...
Public Member Functions | |
| TensorPtr (T *ptr) noexcept | |
| Constructs a new TensorPtr. | |
| T * | get () const noexcept |
| Gets the raw pointer (explicit conversion) | |
| operator T* () const | |
| Explicit conversion to raw pointer for CUDA kernels. | |
| T & | operator* () const |
| Host-only: Dereference operator. | |
| TensorPtr | operator+ (size_t offset) const |
| Host-only: Pointer addition. | |
| T & | operator[] (size_t index) const |
| Host-only: Subscript operator. | |
Private Attributes | |
| T * | ptr_ |
Base tensor pointer class that wraps a raw pointer with memory-type safety.
| TPrecision | Element type |
| IsHostAccessible | Whether the pointer points to host-accessible memory |
|
inlineexplicitnoexcept |
Constructs a new TensorPtr.
| ptr | Raw pointer to wrap |
|
inlinenoexcept |
Gets the raw pointer (explicit conversion)

|
inline |
Explicit conversion to raw pointer for CUDA kernels.
|
inline |
Host-only: Dereference operator.
| std::runtime_error | if memory is not host-accessible |
|
inline |
Host-only: Pointer addition.
| offset | Offset to add |
| std::runtime_error | if memory is not host-accessible |
|
inline |
Host-only: Subscript operator.
| index | Element index |
| std::runtime_error | if memory is not host-accessible |
|
private |