MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / IExecutionContext>

Method IExecutionContext>

samples/common/sampleInference.cpp:1477–1508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1475
1476template <>
1477void Bindings::dumpBindingValues<nvinfer1::IExecutionContext>(nvinfer1::IExecutionContext const& context, int32_t binding, std::ostream& os,
1478 std::string const& separator /*= " "*/, int32_t batch /*= 1*/) const
1479{
1480 Dims dims = context.getBindingDimensions(binding);
1481 Dims strides = context.getStrides(binding);
1482 int32_t vectorDim = context.getEngine().getBindingVectorizedDim(binding);
1483 int32_t const spv = context.getEngine().getBindingComponentsPerElement(binding);
1484
1485 if (context.getEngine().hasImplicitBatchDimension())
1486 {
1487 auto const insertN = [](Dims& d, int32_t bs) {
1488 int32_t const nbDims = d.nbDims;
1489 ASSERT(nbDims < Dims::MAX_DIMS);
1490 std::copy_backward(&d.d[0], &d.d[nbDims], &d.d[nbDims + 1]);
1491 d.d[0] = bs;
1492 d.nbDims = nbDims + 1;
1493 };
1494 int32_t batchStride = 0;
1495 for (int32_t i = 0; i < strides.nbDims; ++i)
1496 {
1497 if (strides.d[i] * dims.d[i] > batchStride)
1498 {
1499 batchStride = strides.d[i] * dims.d[i];
1500 }
1501 }
1502 insertN(dims, batch);
1503 insertN(strides, batchStride);
1504 vectorDim = (vectorDim == -1) ? -1 : vectorDim + 1;
1505 }
1506
1507 mBindings[binding].dump(os, dims, strides, vectorDim, spv, separator);
1508}
1509
1510namespace {
1511

Callers

nothing calls this directly

Calls 6

dumpMethod · 0.80
getBindingDimensionsMethod · 0.45
getStridesMethod · 0.45

Tested by

no test coverage detected