Skip to content
Snippets Groups Projects
Commit c06f34c4 authored by Nathan Thoumine's avatar Nathan Thoumine
Browse files

Refactor Int8EntropyCalibrator class to match noexcept specifications in...

Refactor Int8EntropyCalibrator class to match noexcept specifications in overridden functions from nvinfer1::IInt8Calibrator, resolving compilation errors.
parent 428273ae
No related branches found
No related tags found
No related merge requests found
......@@ -20,9 +20,9 @@ public:
CHECK_CUDA_STATUS(cudaFree(mDeviceInput));
}
int getBatchSize() const override { return mStream.getBatchSize(); }
int getBatchSize() const noexcept override { return mStream.getBatchSize(); }
bool getBatch(void* bindings[], const char* names[], int nbBindings) override
bool getBatch(void* bindings[], const char* names[], int nbBindings) noexcept override
{
if (!mStream.next())
{
......@@ -34,7 +34,7 @@ public:
return true;
}
const void* readCalibrationCache(size_t& length) override
const void* readCalibrationCache(size_t& length) noexcept override
{
mCalibrationCache.clear();
std::ifstream input(calibrationTableName(), std::ios::binary);
......@@ -47,7 +47,7 @@ public:
return length ? &mCalibrationCache[0] : nullptr;
}
virtual void writeCalibrationCache(const void* cache, size_t length) override
virtual void writeCalibrationCache(const void* cache, size_t length) noexcept override
{
std::ofstream output(calibrationTableName(), std::ios::binary);
output.write(reinterpret_cast<const char*>(cache), length);
......
......@@ -112,9 +112,7 @@ void Graph::datamode(nvinfer1::DataType datatype)
closedir(pDir);
}
unsigned int nbCalibFiles = 1;
if(nbCalibFiles == 0) std::cout << "Cannot find calibration files in dir " << calibDir << std::endl;
unsigned int nbInputs = this->_iodescriptors.inputs.size();
BatchStream calibrationStream(1, 3, 32, 32, nbCalibFiles, calibration_folder);
this->_calibrator = new Int8EntropyCalibrator(calibrationStream, 0, "./calibration_cache");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment