TensorRT  7.2.1.6
NVIDIA TensorRT
Looking for a C++ dev who knows TensorRT?
I'm looking for work. Hire me!
samplesCommon Namespace Reference

Classes

struct  Args
 /brief Struct to maintain command-line arguments. More...
 
struct  BBox
 
class  BufferManager
 The BufferManager class handles host and device buffer allocation and deallocation. More...
 
struct  CaffeSampleParams
 The CaffeSampleParams structure groups the additional parameters required by networks that use caffe. More...
 
class  CpuTimer
 
class  DeviceAllocator
 
class  DeviceFree
 
class  GenericBuffer
 The GenericBuffer class is a templated class for buffers. More...
 
class  GpuTimer
 
class  HostAllocator
 
class  HostFree
 
class  HostMemory
 
struct  InferDeleter
 
class  ManagedBuffer
 The ManagedBuffer class groups together a pair of corresponding device and host buffers. More...
 
struct  OnnxSampleParams
 The OnnxSampleParams structure groups the additional parameters required by networks that use ONNX. More...
 
struct  PPM
 
struct  SampleParams
 The SampleParams structure groups the basic parameters required by all sample networks. More...
 
class  TimerBase
 
class  TypedHostMemory
 
struct  UffSampleParams
 The UffSampleParams structure groups the additional parameters required by networks that use Uff. More...
 
struct  vPPM
 

Typedefs

using DeviceBuffer = GenericBuffer< DeviceAllocator, DeviceFree >
 
using HostBuffer = GenericBuffer< HostAllocator, HostFree >
 
using FloatMemory = TypedHostMemory< float, DataType::kFLOAT >
 
using HalfMemory = TypedHostMemory< uint16_t, DataType::kHALF >
 
using ByteMemory = TypedHostMemory< uint8_t, DataType::kINT8 >
 
using PreciseCpuTimer = CpuTimer< std::chrono::high_resolution_clock >
 

Functions

bool parseArgs (Args &args, int32_t argc, char *argv[])
 Populates the Args struct with the provided command-line parameters. More...
 
template<typename T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0>
swapEndianness (const T &value)
 
void * safeCudaMalloc (size_t memSize)
 
bool isDebug ()
 
template<typename T >
std::shared_ptr< T > infer_object (T *obj)
 
template<class Iter >
std::vector< size_t > argMagnitudeSort (Iter begin, Iter end)
 Return vector of indices that puts magnitudes of sequence in descending order. More...
 
bool readReferenceFile (const std::string &fileName, std::vector< std::string > &refVector)
 
template<typename T >
std::vector< std::string > classify (const std::vector< std::string > &refVector, const std::vector< T > &output, const size_t topK)
 
template<typename T >
std::vector< size_t > topKMagnitudes (const std::vector< T > &v, const size_t k)
 
template<typename T >
bool readASCIIFile (const std::string &fileName, const size_t size, std::vector< T > &out)
 
template<typename T >
bool writeASCIIFile (const std::string &fileName, const std::vector< T > &in)
 
void print_version ()
 
std::string getFileType (const std::string &filepath)
 
std::string toLower (const std::string &inp)
 
float getMaxValue (const float *buffer, int64_t size)
 
void setAllTensorScales (INetworkDefinition *network, float inScales=2.0f, float outScales=4.0f)
 
void setDummyInt8Scales (const IBuilderConfig *c, INetworkDefinition *n)
 
void enableDLA (IBuilder *builder, IBuilderConfig *config, int useDLACore, bool allowGPUFallback=true)
 
int parseDLA (int argc, char **argv)
 
unsigned int getElementSize (nvinfer1::DataType t)
 
int64_t volume (const nvinfer1::Dims &d)
 
unsigned int elementSize (DataType t)
 
template<typename A , typename B >
divUp (A x, B n)
 
template<int C, int H, int W>
void readPPMFile (const std::string &filename, samplesCommon::PPM< C, H, W > &ppm)
 
void readPPMFile (const std::string &filename, vPPM &ppm, std::vector< std::string > &input_dir)
 
template<int C, int H, int W>
void writePPMFileWithBBox (const std::string &filename, PPM< C, H, W > &ppm, const BBox &bbox)
 
void writePPMFileWithBBox (const std::string &filename, vPPM ppm, std::vector< BBox > &dets)
 
std::vector< std::string > splitString (std::string str, char delimiter=',')
 
int roundUp (int m, int n)
 
int getC (const Dims &d)
 
int getH (const Dims &d)
 
int getW (const Dims &d)
 
void loadLibrary (const std::string &path)
 

Typedef Documentation

◆ DeviceBuffer

◆ HostBuffer

◆ FloatMemory

using samplesCommon::FloatMemory = typedef TypedHostMemory<float, DataType::kFLOAT>

◆ HalfMemory

using samplesCommon::HalfMemory = typedef TypedHostMemory<uint16_t, DataType::kHALF>

◆ ByteMemory

using samplesCommon::ByteMemory = typedef TypedHostMemory<uint8_t, DataType::kINT8>

◆ PreciseCpuTimer

using samplesCommon::PreciseCpuTimer = typedef CpuTimer<std::chrono::high_resolution_clock>

Function Documentation

◆ parseArgs()

bool samplesCommon::parseArgs ( Args args,
int32_t  argc,
char *  argv[] 
)
inline

Populates the Args struct with the provided command-line parameters.

Exceptions
invalid_argumentif any of the arguments are not valid
Returns
boolean If return value is true, execution can continue, otherwise program should exit

◆ swapEndianness()

template<typename T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0>
T samplesCommon::swapEndianness ( const T &  value)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ safeCudaMalloc()

void* samplesCommon::safeCudaMalloc ( size_t  memSize)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDebug()

bool samplesCommon::isDebug ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ infer_object()

template<typename T >
std::shared_ptr<T> samplesCommon::infer_object ( T *  obj)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ argMagnitudeSort()

template<class Iter >
std::vector<size_t> samplesCommon::argMagnitudeSort ( Iter  begin,
Iter  end 
)

Return vector of indices that puts magnitudes of sequence in descending order.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readReferenceFile()

bool samplesCommon::readReferenceFile ( const std::string &  fileName,
std::vector< std::string > &  refVector 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ classify()

template<typename T >
std::vector<std::string> samplesCommon::classify ( const std::vector< std::string > &  refVector,
const std::vector< T > &  output,
const size_t  topK 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ topKMagnitudes()

template<typename T >
std::vector<size_t> samplesCommon::topKMagnitudes ( const std::vector< T > &  v,
const size_t  k 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readASCIIFile()

template<typename T >
bool samplesCommon::readASCIIFile ( const std::string &  fileName,
const size_t  size,
std::vector< T > &  out 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeASCIIFile()

template<typename T >
bool samplesCommon::writeASCIIFile ( const std::string &  fileName,
const std::vector< T > &  in 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_version()

void samplesCommon::print_version ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFileType()

std::string samplesCommon::getFileType ( const std::string &  filepath)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toLower()

std::string samplesCommon::toLower ( const std::string &  inp)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMaxValue()

float samplesCommon::getMaxValue ( const float *  buffer,
int64_t  size 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAllTensorScales()

void samplesCommon::setAllTensorScales ( INetworkDefinition network,
float  inScales = 2.0f,
float  outScales = 4.0f 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDummyInt8Scales()

void samplesCommon::setDummyInt8Scales ( const IBuilderConfig c,
INetworkDefinition n 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ enableDLA()

void samplesCommon::enableDLA ( IBuilder builder,
IBuilderConfig config,
int  useDLACore,
bool  allowGPUFallback = true 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseDLA()

int samplesCommon::parseDLA ( int  argc,
char **  argv 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getElementSize()

unsigned int samplesCommon::getElementSize ( nvinfer1::DataType  t)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ volume()

int64_t samplesCommon::volume ( const nvinfer1::Dims d)
inline
Here is the caller graph for this function:

◆ elementSize()

unsigned int samplesCommon::elementSize ( DataType  t)
inline

◆ divUp()

template<typename A , typename B >
A samplesCommon::divUp ( x,
n 
)
inline
Here is the caller graph for this function:

◆ readPPMFile() [1/2]

template<int C, int H, int W>
void samplesCommon::readPPMFile ( const std::string &  filename,
samplesCommon::PPM< C, H, W > &  ppm 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readPPMFile() [2/2]

void samplesCommon::readPPMFile ( const std::string &  filename,
vPPM ppm,
std::vector< std::string > &  input_dir 
)
inline
Here is the call graph for this function:

◆ writePPMFileWithBBox() [1/2]

template<int C, int H, int W>
void samplesCommon::writePPMFileWithBBox ( const std::string &  filename,
PPM< C, H, W > &  ppm,
const BBox bbox 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writePPMFileWithBBox() [2/2]

void samplesCommon::writePPMFileWithBBox ( const std::string &  filename,
vPPM  ppm,
std::vector< BBox > &  dets 
)
inline
Here is the call graph for this function:

◆ splitString()

std::vector<std::string> samplesCommon::splitString ( std::string  str,
char  delimiter = ',' 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ roundUp()

int samplesCommon::roundUp ( int  m,
int  n 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getC()

int samplesCommon::getC ( const Dims d)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getH()

int samplesCommon::getH ( const Dims d)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getW()

int samplesCommon::getW ( const Dims d)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadLibrary()

void samplesCommon::loadLibrary ( const std::string &  path)
inline
Here is the call graph for this function:
Here is the caller graph for this function: