| 459 | |
| 460 | template <typename ContextType> |
| 461 | void exportJSONOutput( |
| 462 | ContextType const& context, Bindings const& bindings, std::string const& fileName, int32_t batch) |
| 463 | { |
| 464 | std::ofstream os(fileName, std::ofstream::trunc); |
| 465 | std::string sep = " "; |
| 466 | auto const output = bindings.getOutputBindings(); |
| 467 | os << "[" << std::endl; |
| 468 | for (auto const& binding : output) |
| 469 | { |
| 470 | // clang-format off |
| 471 | os << sep << R"({ "name" : ")" << binding.first << "\"" << std::endl; |
| 472 | sep = ", "; |
| 473 | os << " " << sep << R"("dimensions" : ")"; |
| 474 | bindings.dumpBindingDimensions(binding.second, context, os); |
| 475 | os << "\"" << std::endl; |
| 476 | os << " " << sep << "\"values\" : [ "; |
| 477 | bindings.dumpBindingValues(context, binding.second, os, sep, batch); |
| 478 | os << " ]" << std::endl << " }" << std::endl; |
| 479 | // clang-format on |
| 480 | } |
| 481 | os << "]" << std::endl; |
| 482 | } |
| 483 | |
| 484 | template |
| 485 | void exportJSONOutput(nvinfer1::IExecutionContext const& context, Bindings const& bindings, std::string const& fileName, int32_t batch); |
no test coverage detected