\class EnqueueSafe \brief Functor to enqueue safe execution context
| 635 | //! \brief Functor to enqueue safe execution context |
| 636 | //! |
| 637 | class EnqueueSafe |
| 638 | { |
| 639 | public: |
| 640 | explicit EnqueueSafe(nvinfer1::safe::IExecutionContext& context, Bindings const& bindings) |
| 641 | : mContext(context) |
| 642 | , mBindings(bindings) |
| 643 | { |
| 644 | ASSERT(mBindings.setSafeTensorAddresses(mContext)); |
| 645 | } |
| 646 | |
| 647 | bool operator()(TrtCudaStream& stream) const |
| 648 | { |
| 649 | try |
| 650 | { |
| 651 | return mContext.enqueueV3(stream.get()); |
| 652 | } |
| 653 | catch (const std::exception&) |
| 654 | { |
| 655 | return false; |
| 656 | } |
| 657 | return false; |
| 658 | } |
| 659 | |
| 660 | nvinfer1::safe::IExecutionContext& mContext; |
| 661 | private: |
| 662 | Bindings const& mBindings; |
| 663 | }; |
| 664 | |
| 665 | using EnqueueFunction = std::function<bool(TrtCudaStream&)>; |
| 666 |
no outgoing calls
no test coverage detected