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

Method setTensorAddresses

samples/common/sampleInference.cpp:1653–1678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1651}
1652
1653bool Bindings::setTensorAddresses(nvinfer1::IExecutionContext& context) const
1654{
1655 for (auto const& b : mNames)
1656 {
1657 auto const name = b.first.c_str();
1658 auto const location = context.getEngine().getTensorLocation(name);
1659 if (location == TensorLocation::kDEVICE)
1660 {
1661 if (mBindings[b.second].outputAllocator != nullptr)
1662 {
1663 if (!context.setOutputAllocator(name, mBindings[b.second].outputAllocator.get()))
1664 {
1665 return false;
1666 }
1667 }
1668 else
1669 {
1670 if (!context.setTensorAddress(name, mDevicePointers[b.second]))
1671 {
1672 return false;
1673 }
1674 }
1675 }
1676 }
1677 return true;
1678}
1679
1680bool Bindings::setSafeTensorAddresses(nvinfer1::safe::IExecutionContext& context) const
1681{

Callers 1

EnqueueExplicitMethod · 0.80

Calls 5

c_strMethod · 0.80
getTensorLocationMethod · 0.80
setOutputAllocatorMethod · 0.80
setTensorAddressMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected