TensorRT 10.16.1
nvinfer2::safe::TypedArray Class Reference

A standard_layout and trivially_copyable typed array that knows the data type and size it is holding. More...

#include <NvInferSafeRuntime.h>

Public Member Functions

 TypedArray () noexcept
 
 TypedArray (TypedArray const &)=default
 
 TypedArray (TypedArray &&)=default
 
TypedArrayoperator= (TypedArray const &) &=default
 
TypedArrayoperator= (TypedArray &&) &=default
 
 ~TypedArray () noexcept=default
 
 TypedArray (float *ptr, uint64_t const bufferSize) noexcept
 sets the data to a float ptr. It also sets the current type to kFLOAT More...
 
 TypedArray (half_t *ptr, uint64_t const bufferSize) noexcept
 sets the data to a half_t ptr. It also sets the current type to kHALF More...
 
 TypedArray (int64_t *ptr, uint64_t const bufferSize) noexcept
 sets the data to a int64_t ptr. It also sets the current type to kINT64 More...
 
 TypedArray (int32_t *ptr, uint64_t const bufferSize) noexcept
 sets the data to a int32_t ptr. It also sets the current type to kINT32 More...
 
 TypedArray (int8_t *ptr, uint64_t const bufferSize) noexcept
 sets the data to a int8_t ptr. It also sets the current type to kINT8 More...
 
 TypedArray (uint8_t *ptr, uint64_t const bufferSize) noexcept
 sets the data to a uint8_t ptr. It also sets the current type to kUINT8 More...
 
 TypedArray (bool *ptr, uint64_t const bufferSize) noexcept
 sets the data to a bool ptr. It also sets the current type to kBOOL More...
 
DataType getType () const noexcept
 This method returns the current type of the data. More...
 
float * getFloat () const noexcept
 Retrieves the data as float*. It should only be called when the current type is kFLOAT. Returns nullptr otherwise. More...
 
half_tgetHalf () const noexcept
 Retrieves the data as half_t*. It should only be called when the current type is kFLOAT. Returns nullptr otherwise. More...
 
int64_t * getInt64 () const noexcept
 Retrieves the data as int64_t*. It should only be called when the current type is kINT64. Returns nullptr otherwise. More...
 
int32_t * getInt32 () const noexcept
 Retrieves the data as int32_t*. It should only be called when the current type is kINT32. Returns nullptr otherwise. More...
 
int8_t * getInt8 () const noexcept
 Retrieves the data as int8_t*. It should only be called when the current type is kINT8. Returns nullptr otherwise. More...
 
uint8_t * getUint8 () const noexcept
 Retrieves the data as uint8_t*. It should only be called when the current type is kUINT8. Returns nullptr otherwise. More...
 
bool * getBool () const noexcept
 Retrieves the data as bool*. It should only be called when the current type is kBOOL. Returns nullptr otherwise. More...
 
uint64_t getSize () const noexcept
 Retrieves the size of the array in bytes. More...
 
void * getData () const noexcept
 Retrieves the data regardless of the type. More...
 

Detailed Description

A standard_layout and trivially_copyable typed array that knows the data type and size it is holding.

Warning
The user of this class is responsible for making sure the data pointer is set to a valid piece of memory
Precondition
user provides a valid data ptr for this object before passing it to TRT's API

Constructor & Destructor Documentation

◆ TypedArray() [1/10]

nvinfer2::safe::TypedArray::TypedArray ( )
inlinenoexcept

◆ TypedArray() [2/10]

nvinfer2::safe::TypedArray::TypedArray ( TypedArray const &  )
default

◆ TypedArray() [3/10]

nvinfer2::safe::TypedArray::TypedArray ( TypedArray &&  )
default

◆ ~TypedArray()

nvinfer2::safe::TypedArray::~TypedArray ( )
defaultnoexcept

◆ TypedArray() [4/10]

nvinfer2::safe::TypedArray::TypedArray ( float *  ptr,
uint64_t const  bufferSize 
)
inlinenoexcept

sets the data to a float ptr. It also sets the current type to kFLOAT

◆ TypedArray() [5/10]

nvinfer2::safe::TypedArray::TypedArray ( half_t ptr,
uint64_t const  bufferSize 
)
inlinenoexcept

sets the data to a half_t ptr. It also sets the current type to kHALF

◆ TypedArray() [6/10]

nvinfer2::safe::TypedArray::TypedArray ( int64_t *  ptr,
uint64_t const  bufferSize 
)
inlinenoexcept

sets the data to a int64_t ptr. It also sets the current type to kINT64

◆ TypedArray() [7/10]

nvinfer2::safe::TypedArray::TypedArray ( int32_t *  ptr,
uint64_t const  bufferSize 
)
inlinenoexcept

sets the data to a int32_t ptr. It also sets the current type to kINT32

◆ TypedArray() [8/10]

nvinfer2::safe::TypedArray::TypedArray ( int8_t *  ptr,
uint64_t const  bufferSize 
)
inlinenoexcept

sets the data to a int8_t ptr. It also sets the current type to kINT8

◆ TypedArray() [9/10]

nvinfer2::safe::TypedArray::TypedArray ( uint8_t *  ptr,
uint64_t const  bufferSize 
)
inlinenoexcept

sets the data to a uint8_t ptr. It also sets the current type to kUINT8

◆ TypedArray() [10/10]

nvinfer2::safe::TypedArray::TypedArray ( bool *  ptr,
uint64_t const  bufferSize 
)
inlinenoexcept

sets the data to a bool ptr. It also sets the current type to kBOOL

Member Function Documentation

◆ getBool()

bool * nvinfer2::safe::TypedArray::getBool ( ) const
inlinenoexcept

Retrieves the data as bool*. It should only be called when the current type is kBOOL. Returns nullptr otherwise.

◆ getData()

void * nvinfer2::safe::TypedArray::getData ( ) const
inlinenoexcept

Retrieves the data regardless of the type.

Note
This is an internal method, not to be used outside of TensorRT safe runtime APIs.

◆ getFloat()

float * nvinfer2::safe::TypedArray::getFloat ( ) const
inlinenoexcept

Retrieves the data as float*. It should only be called when the current type is kFLOAT. Returns nullptr otherwise.

◆ getHalf()

half_t * nvinfer2::safe::TypedArray::getHalf ( ) const
inlinenoexcept

Retrieves the data as half_t*. It should only be called when the current type is kFLOAT. Returns nullptr otherwise.

◆ getInt32()

int32_t * nvinfer2::safe::TypedArray::getInt32 ( ) const
inlinenoexcept

Retrieves the data as int32_t*. It should only be called when the current type is kINT32. Returns nullptr otherwise.

◆ getInt64()

int64_t * nvinfer2::safe::TypedArray::getInt64 ( ) const
inlinenoexcept

Retrieves the data as int64_t*. It should only be called when the current type is kINT64. Returns nullptr otherwise.

◆ getInt8()

int8_t * nvinfer2::safe::TypedArray::getInt8 ( ) const
inlinenoexcept

Retrieves the data as int8_t*. It should only be called when the current type is kINT8. Returns nullptr otherwise.

◆ getSize()

uint64_t nvinfer2::safe::TypedArray::getSize ( ) const
inlinenoexcept

Retrieves the size of the array in bytes.

◆ getType()

DataType nvinfer2::safe::TypedArray::getType ( ) const
inlinenoexcept

This method returns the current type of the data.

◆ getUint8()

uint8_t * nvinfer2::safe::TypedArray::getUint8 ( ) const
inlinenoexcept

Retrieves the data as uint8_t*. It should only be called when the current type is kUINT8. Returns nullptr otherwise.

◆ operator=() [1/2]

TypedArray & nvinfer2::safe::TypedArray::operator= ( TypedArray &&  ) &
default

◆ operator=() [2/2]

TypedArray & nvinfer2::safe::TypedArray::operator= ( TypedArray const &  ) &
default

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

  Copyright © 2024 NVIDIA Corporation
  Privacy Policy | Manage My Privacy | Do Not Sell or Share My Data | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact