23 #ifndef __RAND_INT8_CALIBRATOR_H__
24 #define __RAND_INT8_CALIBRATOR_H__
33 #if NV_TENSORRT_MAJOR >= 4
40 class randInt8Calibrator :
public nvinfer1::IInt8EntropyCalibrator
46 randInt8Calibrator(
int totalSamples, std::string cacheFile,
47 const std::map<std::string, nvinfer1::Dims3>& inputDimensions );
52 ~randInt8Calibrator();
57 inline int getBatchSize() const
NOEXCEPT override {
return 1; }
62 bool getBatch(
void* bindings[],
const char* names[],
int nbBindings)
NOEXCEPT override;
67 const void* readCalibrationCache(
size_t&
length)
NOEXCEPT override;
72 virtual void writeCalibrationCache(
const void*,
size_t)
NOEXCEPT override;
78 std::string mCacheFile;
79 std::map<std::string, void*> mInputDeviceBuffers;
80 std::map<std::string, nvinfer1::Dims3> mInputDimensions;
81 std::vector<char> mCalibrationCache;