class
#include <tensor.hpp>
Tensor A base class for representing a tensor object.
Contents
This class defines the interface for a tensor object, providing methods to retrieve information about the tensor such as its name, type, dimensions, size, and data.
Derived classes
- class TensorImpl final
- Concrete implementation of the Tensor interface for QNN.
- class TensorImpl final
- Concrete implementation of the Tensor interface for TensorFlow Lite.
Constructors, destructors, conversion operators
Public functions
- auto operator=(const Tensor&) -> Tensor & defaulted
- Copy assignment operator for Tensor.
- auto operator=(Tensor&&) -> Tensor & defaulted
- Move assignment operator for Tensor.
- auto getName() const -> std::string pure virtual
- Get the name of the tensor.
- auto getType() const -> TensorType pure virtual
- Get the type of the tensor.
- auto getDimensions() const -> std::vector< size_t > pure virtual
- Get the dimensions of the tensor.
- auto getSize() const -> size_t pure virtual
- Get the total size of the tensor.
-
template<typename T>auto getTensorAs() -> nonstd::span< T >
- Get a non-owning span of the tensor data casted to type T.
Protected functions
- auto getDataPtr() -> void * pure virtual
- Get a pointer to the raw data of the tensor.
- auto getNumBytes() -> size_t pure virtual
- Get the total number of bytes in the tensor data.
Function documentation
auto edge:: Tensor:: getName() const -> std::string pure virtual
Get the name of the tensor.
Returns | The name of the tensor as a string |
---|
auto edge:: Tensor:: getType() const -> TensorType pure virtual
Get the type of the tensor.
Returns | The type of the tensor as a TensorType enum |
---|
auto edge:: Tensor:: getDimensions() const -> std::vector< size_t > pure virtual
Get the dimensions of the tensor.
Returns | A vector of size_t representing the dimensions of the tensor |
---|
auto edge:: Tensor:: getSize() const -> size_t pure virtual
Get the total size of the tensor.
Returns | The total size of the tensor as a size_t |
---|
template<typename T>
auto edge:: Tensor:: getTensorAs() -> nonstd::span< T >
Get a non-owning span of the tensor data casted to type T.
Template parameters | |
---|---|
T | The type to cast the tensor data to |
Returns | A non-owning span of type T representing the tensor data |
Use getType() to ensure data is accessed correctly
auto edge:: Tensor:: getDataPtr() -> void * pure virtual protected
Get a pointer to the raw data of the tensor.
Returns | A void pointer to the raw data of the tensor |
---|
auto edge:: Tensor:: getNumBytes() -> size_t pure virtual protected
Get the total number of bytes in the tensor data.
Returns | The total number of bytes in the tensor data as a size_t |
---|