| 221 | } |
| 222 | |
| 223 | void 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 | |
| 248 | bool PriorBox::supportsFormat(DataType type, PluginFormat format) const noexcept |
| 249 | { |