NVIDIA DeepStream SDK API Reference

6.4 Release
infer_utils.h File Reference

Detailed Description

Header file containing utility functions and classes used by the nvinferserver low level library.

Definition in file infer_utils.h.

Go to the source code of this file.

Data Structures

class  INFER_EXPORT_API::DlLibHandle
 Helper class for dynamic loading of custom library. More...
 
class  INFER_EXPORT_API::WakeupException
 Wrapper class for handling exception. More...
 
class  INFER_EXPORT_API::GuardQueue< Container >
 Template class for creating a thread safe queue for the given container class. More...
 
class  INFER_EXPORT_API::QueueThread< Container >
 Template class for running the specified function on the queue items in a separate thread. More...
 
class  INFER_EXPORT_API::BufferPool< UniPtr >
 Template class for buffer pool of the specified buffer type. More...
 
class  INFER_EXPORT_API::MapBufferPool< Key, UniqBuffer >
 Template class for a map of buffer pools. More...
 

Namespaces

 INFER_EXPORT_API
 

Typedefs

template<class UniPtr >
using INFER_EXPORT_API::SharedBufPool = std::shared_ptr< BufferPool< UniPtr > >
 

Functions

void INFER_EXPORT_API::dsInferLogPrint__ (NvDsInferLogLevel level, const char *fmt,...)
 Print the nvinferserver log messages as per the configured log level. More...
 
void INFER_EXPORT_API::dsInferLogVPrint__ (NvDsInferLogLevel level, const char *fmt, va_list args)
 Helper function to print the nvinferserver logs. More...
 
bool INFER_EXPORT_API::string_empty (const char *str)
 Helper function, returns true if the input C string is empty or null. More...
 
template<typename T >
bool INFER_EXPORT_API::isNonBatch (T b)
 Checks if the input batch size is zero. More...
 
bool INFER_EXPORT_API::fEqual (float a, float b)
 Check if the two floating point values are equal, the difference is less than or equal to the epsilon value. More...
 
uint32_t INFER_EXPORT_API::getElementSize (InferDataType t)
 Get the size of the element from the data type. More...
 
bool INFER_EXPORT_API::hasWildcard (const InferDims &dims)
 Check if any of the InferDims dimensions are of dynamic size (-1 or negative values). More...
 
size_t INFER_EXPORT_API::dimsSize (const InferDims &dims)
 Calculate the total number of elements for the given dimensions. More...
 
void INFER_EXPORT_API::normalizeDims (InferDims &dims)
 Recalculates the total number of elements for the dimensions. More...
 
NvDsInferLayerInfo INFER_EXPORT_API::toCapi (const LayerDescription &desc, void *bufPtr)
 Convert the layer description and buffer pointer to NvDsInferLayerInfo of the interface. More...
 
NvDsInferDims INFER_EXPORT_API::toCapi (const InferDims &dims)
 Convert the InferDims to NvDsInferDims of the library interface. More...
 
NvDsInferLayerInfo INFER_EXPORT_API::toCapiLayerInfo (const InferBufferDescription &desc, void *buf=nullptr)
 Generate NvDsInferLayerInfo of the interface from the buffer description and buffer pointer. More...
 
NvDsInferDataType INFER_EXPORT_API::toCapiDataType (InferDataType dt)
 Convert the InferDataType to NvDsInferDataType of the library interface. More...
 
bool INFER_EXPORT_API::intersectDims (const InferDims &a, const InferDims &b, InferDims &c)
 Get the intersection of the two input dimensions. More...
 
bool INFER_EXPORT_API::isPrivateTensor (const std::string &tensorName)
 Check if the given tensor is marked as private (contains INFER_SERVER_PRIVATE_BUF in the name). More...
 
bool INFER_EXPORT_API::isCpuMem (InferMemType type)
 Check if the memory type uses CPU memory (kCpu or kCpuCuda). More...
 
std::string INFER_EXPORT_API::memType2Str (InferMemType type)
 Returns a string object corresponding to the InferMemType name. More...
 
InferDims INFER_EXPORT_API::fullDims (int batchSize, const InferDims &in)
 Extend the dimensions to include batch size. More...
 
bool INFER_EXPORT_API::debatchFullDims (const InferDims &full, InferDims &debatched, uint32_t &batch)
 Separates batch size from given dimensions. More...
 
bool INFER_EXPORT_API::squeezeMatch (const InferDims &a, const InferDims &b)
 Check that the two dimensions are equal ignoring single element values. More...
 
SharedBatchBuf INFER_EXPORT_API::ReshapeBuf (const SharedBatchBuf &in, uint32_t batch, const InferDims &dims, bool reCalcBytes=false)
 Update the buffer dimensions as per provided new dimensions. More...
 
SharedBatchBuf INFER_EXPORT_API::reshapeToFullDimsBuf (const SharedBatchBuf &buf, bool reCalcBytes=false)
 Reshape the buffer dimensions with batch size added as new dimension. More...
 
NvDsInferStatus INFER_EXPORT_API::tensorBufferCopy (const SharedBatchBuf &in, const SharedBatchBuf &out, const SharedCuStream &stream)
 Copy one tensor buffer to another. More...
 
const INFER_EXPORT_API char * NvDsInferStatus2Str (NvDsInferStatus status)
 Returns the NvDsInferStatus enum name as a string. More...
 
INFER_EXPORT_API bool validateInferConfigStr (const std::string &configStr, const std::string &path, std::string &updated)
 Validates the provided nvinferserver configuration string. More...
 
const char * INFER_EXPORT_API::safeStr (const char *str)
 Helper functions to get a safe C-string representation for the input string. More...
 
const char * INFER_EXPORT_API::safeStr (const std::string &str)
 
bool INFER_EXPORT_API::file_accessible (const char *path)
 Helper functions to check if the input file path is valid and accessible. More...
 
bool INFER_EXPORT_API::file_accessible (const std::string &path)
 
std::string INFER_EXPORT_API::dims2Str (const InferDims &d)
 Helper functions to convert the various data types to string values for debug, log information. More...
 
std::string INFER_EXPORT_API::batchDims2Str (const InferBatchDims &d)
 
std::string INFER_EXPORT_API::dataType2Str (const InferDataType type)
 
std::string INFER_EXPORT_API::dataType2GrpcStr (const InferDataType type)
 
InferDataType INFER_EXPORT_API::grpcStr2DataType (const std::string &type)
 
NvDsInferNetworkInfo INFER_EXPORT_API::dims2ImageInfo (const InferDims &d, InferTensorOrder order)
 
std::string INFER_EXPORT_API::tensorOrder2Str (InferTensorOrder order)
 
bool INFER_EXPORT_API::operator<= (const InferDims &a, const InferDims &b)
 Comparison operators for the InferDims type. More...
 
bool INFER_EXPORT_API::operator> (const InferDims &a, const InferDims &b)
 
bool INFER_EXPORT_API::operator== (const InferDims &a, const InferDims &b)
 
bool INFER_EXPORT_API::operator!= (const InferDims &a, const InferDims &b)
 
std::string INFER_EXPORT_API::joinPath (const std::string &a, const std::string &b)
 Helper functions for parsing the configuration file. More...
 
std::string INFER_EXPORT_API::dirName (const std::string &path)
 
bool INFER_EXPORT_API::isAbsolutePath (const std::string &path)
 
bool INFER_EXPORT_API::realPath (const std::string &inPath, std::string &absPath)
 
const char * INFER_EXPORT_API::safeStr (const char *str)
 Helper functions to get a safe C-string representation for the input string. More...
 
const char * INFER_EXPORT_API::safeStr (const std::string &str)
 
bool INFER_EXPORT_API::file_accessible (const char *path)
 Helper functions to check if the input file path is valid and accessible. More...
 
bool INFER_EXPORT_API::file_accessible (const std::string &path)
 
std::string INFER_EXPORT_API::dims2Str (const InferDims &d)
 Helper functions to convert the various data types to string values for debug, log information. More...
 
std::string INFER_EXPORT_API::batchDims2Str (const InferBatchDims &d)
 
std::string INFER_EXPORT_API::dataType2Str (const InferDataType type)
 
std::string INFER_EXPORT_API::dataType2GrpcStr (const InferDataType type)
 
InferDataType INFER_EXPORT_API::grpcStr2DataType (const std::string &type)
 
NvDsInferNetworkInfo INFER_EXPORT_API::dims2ImageInfo (const InferDims &d, InferTensorOrder order)
 
std::string INFER_EXPORT_API::tensorOrder2Str (InferTensorOrder order)
 
bool INFER_EXPORT_API::operator<= (const InferDims &a, const InferDims &b)
 Comparison operators for the InferDims type. More...
 
bool INFER_EXPORT_API::operator> (const InferDims &a, const InferDims &b)
 
bool INFER_EXPORT_API::operator== (const InferDims &a, const InferDims &b)
 
bool INFER_EXPORT_API::operator!= (const InferDims &a, const InferDims &b)
 
std::string INFER_EXPORT_API::joinPath (const std::string &a, const std::string &b)
 Helper functions for parsing the configuration file. More...
 
std::string INFER_EXPORT_API::dirName (const std::string &path)
 
bool INFER_EXPORT_API::isAbsolutePath (const std::string &path)
 
bool INFER_EXPORT_API::realPath (const std::string &inPath, std::string &absPath)
 

Function Documentation

◆ NvDsInferStatus2Str()

const INFER_EXPORT_API char* NvDsInferStatus2Str ( NvDsInferStatus  status)

Returns the NvDsInferStatus enum name as a string.

◆ validateInferConfigStr()

INFER_EXPORT_API bool validateInferConfigStr ( const std::string &  configStr,
const std::string &  path,
std::string &  updated 
)

Validates the provided nvinferserver configuration string.

This function parses the input configuration string into the InferenceConfig configuration protobuf message and validates it. It provides an updated configuration string with the validated and if required modified configuration.

Parameters
[in]configStrInput string read from the configuration file.
[in]pathPath of the configuration file.
[out]updatedValidated and updated configuration string.
Returns
Boolean indicating if the validation passed or failed.