An owning tensor that manages its own memory via a std::vector<uint8_t> buffer.
More...
#include <tensor_bridge.hpp>
An owning tensor that manages its own memory via a std::vector<uint8_t> buffer.
Move-only; use clone() for explicit deep copies.
Provides the same access interface as TensorView. Obtain a non-owning view via view() for passing to functions that accept TensorView.
Definition at line 531 of file tensor_bridge.hpp.
◆ OwnedTensor() [1/5]
| signet::forge::OwnedTensor::OwnedTensor |
( |
| ) |
|
|
default |
Default constructor: creates an invalid (empty) tensor.
◆ OwnedTensor() [2/5]
Allocate an uninitialized tensor with the given shape and type.
Definition at line 537 of file tensor_bridge.hpp.
◆ OwnedTensor() [3/5]
Allocate and copy data into the tensor.
- Parameters
-
| data | Pointer to source data (must contain at least shape.num_elements() * tensor_element_size(dtype) bytes). |
| shape | Shape of the tensor. |
| dtype | Element type. |
Definition at line 556 of file tensor_bridge.hpp.
◆ OwnedTensor() [4/5]
| signet::forge::OwnedTensor::OwnedTensor |
( |
OwnedTensor && |
| ) |
|
|
defaultnoexcept |
◆ OwnedTensor() [5/5]
| signet::forge::OwnedTensor::OwnedTensor |
( |
const OwnedTensor & |
| ) |
|
|
delete |
◆ byte_size()
| size_t signet::forge::OwnedTensor::byte_size |
( |
| ) |
const |
|
inlinenoexcept |
◆ clone()
| OwnedTensor signet::forge::OwnedTensor::clone |
( |
| ) |
const |
|
inline |
◆ data() [1/2]
| const void * signet::forge::OwnedTensor::data |
( |
| ) |
const |
|
inlinenoexcept |
◆ data() [2/2]
| void * signet::forge::OwnedTensor::data |
( |
| ) |
|
|
inlinenoexcept |
◆ dtype()
◆ is_valid()
| bool signet::forge::OwnedTensor::is_valid |
( |
| ) |
const |
|
inlinenoexcept |
True if the tensor has been allocated (non-empty buffer).
Definition at line 636 of file tensor_bridge.hpp.
◆ num_elements()
| int64_t signet::forge::OwnedTensor::num_elements |
( |
| ) |
const |
|
inlinenoexcept |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ shape()
| const TensorShape & signet::forge::OwnedTensor::shape |
( |
| ) |
const |
|
inlinenoexcept |
◆ typed_data() [1/2]
template<typename T >
| const T * signet::forge::OwnedTensor::typed_data |
( |
| ) |
const |
|
inlinenoexcept |
Typed const pointer to the tensor buffer.
- Template Parameters
-
| T | Element type (must match dtype()). |
Definition at line 618 of file tensor_bridge.hpp.
◆ typed_data() [2/2]
template<typename T >
| T * signet::forge::OwnedTensor::typed_data |
( |
| ) |
|
|
inlinenoexcept |
Typed mutable pointer to the tensor buffer.
- Template Parameters
-
| T | Element type (must match dtype()). |
Definition at line 611 of file tensor_bridge.hpp.
◆ view() [1/2]
◆ view() [2/2]
| TensorView signet::forge::OwnedTensor::view |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following file: