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

Method stepOnce

samples/sampleCharRNN/sampleCharRNN.cpp:933–950  ·  view source on GitHub ↗

\brief Perform one time step of inference with the TensorRT execution context

Source from the content-addressed store, hash-verified

931//! \brief Perform one time step of inference with the TensorRT execution context
932//!
933bool SampleCharRNNBase::stepOnce(
934 samplesCommon::BufferManager& buffers, SampleUniquePtr<nvinfer1::IExecutionContext>& context, cudaStream_t& stream)
935{
936 // Asynchronously copy data from host input buffers to device input buffers
937 buffers.copyInputToDeviceAsync(stream);
938
939 // Asynchronously enqueue the inference work
940 if (mParams.useILoop ? !context->enqueueV2(buffers.getDeviceBindings().data(), stream, nullptr)
941 : !context->enqueue(mParams.batchSize, buffers.getDeviceBindings().data(), stream, nullptr))
942 {
943 return false;
944 }
945 // Asynchronously copy data from device output buffers to host output buffers
946 buffers.copyOutputToHostAsync(stream);
947
948 CHECK(cudaStreamSynchronize(stream));
949 return true;
950}
951
952//!
953//! \brief Copies Ct/Ht output from the RNN to the Ct-1/Ht-1 input buffers for next time step

Callers

nothing calls this directly

Calls 5

enqueueV2Method · 0.80
copyOutputToHostAsyncMethod · 0.80
dataMethod · 0.45
enqueueMethod · 0.45

Tested by

no test coverage detected