| 1651 | } |
| 1652 | |
| 1653 | bool 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 | |
| 1680 | bool Bindings::setSafeTensorAddresses(nvinfer1::safe::IExecutionContext& context) const |
| 1681 | { |
no test coverage detected