You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using DataLoader = typename DataLoaderUniquePtr::element_type;
27
36
using Batch = typename DataLoader::super::BatchType;
28
37
public:
38
+
/**
39
+
* @brief Construct a new Int8Calibrator object
40
+
*
41
+
* Using the provided DataLoader, construct a calibrator that can be used for PTQ with TRTorch
42
+
*
43
+
* @param dataloader: std::unqiue_ptr<torch::data::DataLoader> - A unique pointer to the DataLoader, should be what is returned from the make_data_loader factory
44
+
* @param cache_file_path: const std::string& - A path to store / find the calibration cache
45
+
* @param use_cache : bool - Whether to use the cache (if it exists)
* @param bindings: void*[] - An array of binding pointers (fed in from TensorRT calibrator), these buffers should be filed with batch data for each input
67
+
* @param names: const char*[] - Names of bindings
68
+
* @param nbBindings: int - Number of bindings
69
+
* @return true - There is a new batch for the calibrator to consume
70
+
* @return false - There is not a new batch for the calibrator to consume
71
+
*/
40
72
boolgetBatch(void* bindings[], constchar* names[], int nbBindings) override {
41
73
// HACK: doesnt seem like the first try in the initializer list works
42
74
if (! it_created_) {
@@ -60,6 +92,14 @@ class Int8Calibrator : Algorithm {
60
92
returntrue;
61
93
}
62
94
95
+
/**
96
+
* @brief Read calibration cache
97
+
*
98
+
* How to read from the calibration cache, only enabled if use_cache is set
* @brief Get the Batch Size for the next batch (always 1 due to issues with TRT and explicit batch)
189
+
*
190
+
* @return int
191
+
*/
112
192
intgetBatchSize() constoverride {
113
193
// HACK: TRTorch only uses explict batch sizing, INT8 Calibrator does not
114
194
// work when reporting the batch size here and having explicity batching.
115
195
// So we just report batch size 1 (warnings will still be printed out).
116
196
return1;
117
197
}
118
198
199
+
/**
200
+
* @brief Get the next Batch
201
+
*
202
+
* Not used always returns false
203
+
*
204
+
* @param bindings: void*[] - An array of binding pointers (fed in from TensorRT calibrator), these buffers should be filed with batch data for each input
205
+
* @param names: const char*[] - Names of bindings
206
+
* @param nbBindings: int - Number of bindings
207
+
* @return false
208
+
*/
119
209
boolgetBatch(void* bindings[], constchar* names[], int nbBindings) override {
120
210
returnfalse;
121
211
}
122
212
213
+
/**
214
+
* @brief Read calibration cache
215
+
*
216
+
* How to read from the calibration cache, only enabled if use_cache is set
0 commit comments