litert:: TensorBufferRequirements
#include <litert_tensor_buffer_requirements.h>
Represents the requirements for allocating a TensorBuffer.
Summary
This class is the C++ equivalent of LiteRtTensorBufferRequirements and is typically specified by a hardware accelerator for a given I/O tensor.
TODO(b/483479493): Combine this with LiteRtTensorBufferRequirementsT.
Constructors and Destructors |
|
|---|---|
TensorBufferRequirements()
|
Public functions |
|
|---|---|
Alignment() const
|
Expected< size_t >
|
BufferSize() const
|
Expected< size_t >
|
Strides() const
|
Expected< absl::Span< const uint32_t > >
|
SupportedType(int index) const
|
Expected< TensorBufferType >
|
SupportedTypes() const
|
Expected< std::vector< TensorBufferType > >
|
Public static functions |
|
|---|---|
Create(absl::Span< const TensorBufferType > buffer_types, size_t buffer_size, absl::Span< const uint32_t > strides)
|
|
CreateWithAlignment(absl::Span< const TensorBufferType > buffer_types, size_t buffer_size, size_t alignment, absl::Span< const uint32_t > strides)
|
|
Friend classes |
|
|---|---|
Join
|
friend Expected< TensorBufferRequirements >
Joins two
TensorBufferRequirements into a single one. |
Public functions
Alignment
Expected< size_t > Alignment() const
BufferSize
Expected< size_t > BufferSize() const
Strides
Expected< absl::Span< const uint32_t > > Strides() const
SupportedType
Expected< TensorBufferType > SupportedType( int index ) const
SupportedTypes
Expected< std::vector< TensorBufferType > > SupportedTypes() const
TensorBufferRequirements
TensorBufferRequirements()=default
Public static functions
Create
Expected< TensorBufferRequirements > Create( absl::Span< const TensorBufferType > buffer_types, size_t buffer_size, absl::Span< const uint32_t > strides )
CreateWithAlignment
Expected< TensorBufferRequirements > CreateWithAlignment( absl::Span< const TensorBufferType > buffer_types, size_t buffer_size, size_t alignment, absl::Span< const uint32_t > strides )
Friend classes
Join
friend Expected< TensorBufferRequirements > Join(const TensorBufferRequirements &src1, const TensorBufferRequirements &src2)
Joins two TensorBufferRequirements into a single one.
The joined requirements will have the common supported types, the maximum buffer size, the maximum alignment, and the same strides of the two requirements. If the two requirements are incompatible, an error is returned.