Skip to main content

ExecutionContext

Struct ExecutionContext 

Source
pub struct ExecutionContext<'e> { /* private fields */ }

Implementations§

Source§

impl ExecutionContext<'_>

Source

pub fn as_raw(&self) -> trtIExecutionContext_t

Source

pub fn set_input_shape(&self, name: &str, dims: Dims) -> Result<()>

Source

pub unsafe fn set_tensor_address( &self, name: &str, addr: *mut c_void, ) -> Result<()>

Bind a device pointer to a named input/output tensor on this execution context. The pointer is forwarded to TensorRT’s setTensorAddress, which uses it during enqueueV3 execution.

§Safety

addr must point to device memory that:

  • is large enough for the tensor’s bound shape and data type, and
  • remains valid (not freed, not unmapped) for the duration of any enqueueV3 call that runs after this binding and before the stream completes.
Source

pub fn tensor_shape(&self, name: &str) -> Result<Dims>

Source

pub fn tensor_address(&self, name: &str) -> Result<*mut c_void>

Read the current bound device address for a tensor (null if unset).

Source

pub unsafe fn enqueue_v3(&self, stream: cudaStream_t) -> Result<()>

Enqueue the inference on the given CUDA stream. Returns Ok if TRT reports success; the stream is still responsible for ordering, and the caller must ensure all tensor addresses have been set.

§Safety

stream must be a valid cudaStream_t that outlives the enqueue.

Trait Implementations§

Source§

impl<'e> Debug for ExecutionContext<'e>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for ExecutionContext<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'e> Freeze for ExecutionContext<'e>

§

impl<'e> RefUnwindSafe for ExecutionContext<'e>

§

impl<'e> !Send for ExecutionContext<'e>

§

impl<'e> !Sync for ExecutionContext<'e>

§

impl<'e> Unpin for ExecutionContext<'e>

§

impl<'e> UnsafeUnpin for ExecutionContext<'e>

§

impl<'e> UnwindSafe for ExecutionContext<'e>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.