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

Method serialize

plugin/priorBoxPlugin/priorBoxPlugin.cpp:223–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223void PriorBox::serialize(void* buffer) const noexcept
224{
225 uint8_t* d = static_cast<uint8_t*>(buffer);
226 uint8_t* a = d;
227 write(d, mParam);
228
229 auto writeArray = [&d](int32_t const size, float const* srcPtr, std::vector<float> const& srcVec) {
230 // srcVec is only used here to check that the size and srcPtr are correct.
231 PLUGIN_VALIDATE(srcVec.data() == srcPtr);
232 PLUGIN_VALIDATE(srcVec.size() == static_cast<size_t>(size));
233 for (int32_t i = 0; i < size; i++)
234 {
235 write(d, srcPtr[i]);
236 }
237 };
238 writeArray(mParam.numMinSize, mParam.minSize, mMinSizeCPU);
239 writeArray(mParam.numMaxSize, mParam.maxSize, mMaxSizeCPU);
240 writeArray(mParam.numAspectRatios, mParam.aspectRatios, mAspectRatiosCPU);
241
242 write(d, mH);
243 write(d, mW);
244
245 PLUGIN_VALIDATE(d == a + getSerializationSize());
246}
247
248bool PriorBox::supportsFormat(DataType type, PluginFormat format) const noexcept
249{

Callers

nothing calls this directly

Calls 3

writeFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected