\brief Verify the result of concatenation \return whether the concatenated tesnor matches reference
| 332 | //! \return whether the concatenated tesnor matches reference |
| 333 | //! |
| 334 | bool SampleNamedDimensions::verifyOutput(samplesCommon::BufferManager const& buffers) |
| 335 | { |
| 336 | int32_t const outputH = 2 * mNamedDimension; |
| 337 | int32_t const outputW = mOutputDims[0].d[1]; |
| 338 | int32_t const outputSize = outputH * outputW; |
| 339 | |
| 340 | auto* output = static_cast<float*>(buffers.getHostBuffer(mParams.outputTensorNames[0])); |
| 341 | |
| 342 | sample::gLogInfo << "Output:\n"; |
| 343 | for (int32_t i = 0; i < outputSize; i++) |
| 344 | { |
| 345 | sample::gLogInfo << output[i] << (((i + 1) % outputW) ? " " : "\n"); |
| 346 | } |
| 347 | sample::gLogInfo << std::endl; |
| 348 | |
| 349 | mInput0.insert(mInput0.end(), mInput1.begin(), mInput1.end()); |
| 350 | |
| 351 | for (int32_t i = 0; i < outputH * outputW; i++) |
| 352 | { |
| 353 | auto const reference_value = i > outputSize / 2 ? mInput1[i - outputSize / 2] : mInput0[i]; |
| 354 | if (fabs(output[i] - reference_value) > std::numeric_limits<float>::epsilon()) |
| 355 | { |
| 356 | return false; |
| 357 | } |
| 358 | } |
| 359 | return true; |
| 360 | } |
| 361 | |
| 362 | //! |
| 363 | //! \brief Initializes members of the params struct using the command line args |
nothing calls this directly
no test coverage detected