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

Function exportJSONOutput

samples/common/sampleReporting.cpp:461–482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459
460template <typename ContextType>
461void 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
484template
485void exportJSONOutput(nvinfer1::IExecutionContext const& context, Bindings const& bindings, std::string const& fileName, int32_t batch);

Callers 1

dumpFunction · 0.85

Calls 1

getOutputBindingsMethod · 0.80

Tested by

no test coverage detected