MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / readCalibrationCache

Function readCalibrationCache

python/src/infer/pyInt8.cpp:79–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77 }
78
79 const void* readCalibrationCache(std::size_t& length) noexcept override
80 {
81 try
82 {
83 py::gil_scoped_acquire gil{};
84
85 py::function pyReadCalibrationCache = utils::getOverride(static_cast<Derived*>(this), "read_calibration_cache");
86
87 // Cannot cast `None` to py::buffer.
88 auto cacheRaw = pyReadCalibrationCache();
89 if (cacheRaw.is_none())
90 {
91 return nullptr;
92 }
93
94 mCache = py::buffer{cacheRaw};
95 {
96 py::buffer_info info = mCache.request();
97 length = info.size * info.itemsize;
98 return info.ptr;
99 }
100 }
101 catch (std::exception const& e)
102 {
103 std::cerr << "[ERROR] Exception caught in read_calibration_cache(): " << e.what() << std::endl;
104 }
105 catch (...)
106 {
107 std::cerr << "[ERROR] Exception caught in read_calibration_cache()" << std::endl;
108 }
109 return nullptr;
110 }
111
112 void writeCalibrationCache(const void* ptr, std::size_t length) noexcept override
113 {

Callers

nothing calls this directly

Calls 1

getOverrideFunction · 0.85

Tested by

no test coverage detected