triton_cpp v1.2.1
Header-only C++ wrapper for NVIDIA Triton Inference Server clients
Loading...
Searching...
No Matches
triton_cpp::InputOutputMetaData Struct Reference

Shape, datatype, and byte-size metadata for one model tensor. More...

#include <types.hpp>

Public Member Functions

 InputOutputMetaData (const std::vector< int64_t > &shape, const inference::DataType &datatype)
 Build metadata and calculate the required tensor byte size.
 

Public Attributes

const std::vector< int64_t > shape
 
const inference::DataType datatype
 
const int64_t bytesize
 

Detailed Description

Shape, datatype, and byte-size metadata for one model tensor.

Definition at line 272 of file types.hpp.

Constructor & Destructor Documentation

◆ InputOutputMetaData()

triton_cpp::InputOutputMetaData::InputOutputMetaData ( const std::vector< int64_t > & shape,
const inference::DataType & datatype )
inline

Build metadata and calculate the required tensor byte size.

Parameters
shapeTensor dimensions. Dynamic dimensions contribute one to the size.
datatypeTriton tensor datatype.
Exceptions
std::invalid_argumentif datatype is unsupported.

Definition at line 287 of file types.hpp.

288 : shape{shape},
290 bytesize{accumulate_shape(shape.begin(), shape.end()) *
291 std::visit([](auto&& arg) { return static_cast<std::int64_t>(sizeof(arg)); }, getZero(datatype))} {}
TritonDataType getZero(inference::DataType type)
Get a zero value in the correct C++ type, given a Triton datatype.
Definition types.hpp:79
std::int64_t accumulate_shape(It begin, It end)
Compute the element count represented by a tensor shape.
Definition utils.hpp:55
const inference::DataType datatype
Definition types.hpp:276
const std::vector< int64_t > shape
Definition types.hpp:274

Member Data Documentation

◆ bytesize

const int64_t triton_cpp::InputOutputMetaData::bytesize

Total tensor buffer size in bytes.

Definition at line 278 of file types.hpp.

◆ datatype

const inference::DataType triton_cpp::InputOutputMetaData::datatype

Triton tensor datatype.

Definition at line 276 of file types.hpp.

◆ shape

const std::vector<int64_t> triton_cpp::InputOutputMetaData::shape

Tensor dimensions reported by Triton or supplied by the caller.

Definition at line 274 of file types.hpp.


The documentation for this struct was generated from the following file: