pub struct ICudaEngine { /* private fields */ }Expand description
! ! \class ICudaEngine ! ! \brief An engine for executing inference on a built network, with functionally unsafe features. ! ! \warning Do not inherit from this class, as doing so will break forward-compatibility of the API and ABI. !
Implementations§
Source§impl ICudaEngine
impl ICudaEngine
Sourcepub unsafe fn getTensorShape(
self: &ICudaEngine,
tensorName: *const c_char,
) -> Dims64
pub unsafe fn getTensorShape( self: &ICudaEngine, tensorName: *const c_char, ) -> Dims64
! ! \brief Get shape of an input or output tensor. ! ! \param tensorName The name of an input or output tensor. ! ! \return shape of the tensor, with -1 in place of each dynamic runtime dimension, ! or Dims{-1, {}} if the provided name does not map to an input or output tensor. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. !
Sourcepub unsafe fn getTensorDataType(
self: &ICudaEngine,
tensorName: *const c_char,
) -> DataType
pub unsafe fn getTensorDataType( self: &ICudaEngine, tensorName: *const c_char, ) -> DataType
! ! \brief Determine the required data type for a buffer from its tensor name. ! ! \param tensorName The name of an input or output tensor. ! ! \return The type of the data in the buffer, or DataType::kFLOAT if the provided name does not map to an input or ! output tensor. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. !
Sourcepub fn getNbLayers(self: &ICudaEngine) -> i32
pub fn getNbLayers(self: &ICudaEngine) -> i32
! ! \brief Get the number of layers in the network. ! ! The number of layers in the network is not necessarily the number in the original network definition, as layers ! may be combined or eliminated as the engine is optimized. This value can be useful when building per-layer ! tables, such as when aggregating profiling data over a number of executions. ! ! \return The number of layers in the network. !
Sourcepub fn serialize(self: &ICudaEngine) -> *mut IHostMemory
pub fn serialize(self: &ICudaEngine) -> *mut IHostMemory
! ! \brief Serialize the network to a stream. ! ! \return A IHostMemory object that contains the serialized engine. ! ! The network may be deserialized with IRuntime::deserializeCudaEngine(). ! ! \see IRuntime::deserializeCudaEngine() !
Sourcepub fn createExecutionContext(
self: Pin<&mut ICudaEngine>,
strategy: ExecutionContextAllocationStrategy,
) -> *mut IExecutionContext
pub fn createExecutionContext( self: Pin<&mut ICudaEngine>, strategy: ExecutionContextAllocationStrategy, ) -> *mut IExecutionContext
! ! \brief Create an execution context and specify the strategy for allocating internal activation memory. ! ! The default value for the allocation strategy is ExecutionContextAllocationStrategy::kSTATIC, which means the ! context will pre-allocate a block of device memory that is sufficient for all profiles. The newly created ! execution context will be assigned optimization profile 0. If an error recorder has been set for the engine, it ! will also be passed to the execution context. ! ! \see IExecutionContext ! \see IExecutionContext::setOptimizationProfileAsync() ! \see ExecutionContextAllocationStrategy !
Sourcepub unsafe fn getTensorLocation(
self: &ICudaEngine,
tensorName: *const c_char,
) -> TensorLocation
pub unsafe fn getTensorLocation( self: &ICudaEngine, tensorName: *const c_char, ) -> TensorLocation
! ! \brief Get whether an input or output tensor must be on GPU or CPU. ! ! \param tensorName The name of an input or output tensor. ! ! \return TensorLocation::kDEVICE if tensorName must be on GPU, or TensorLocation::kHOST if on CPU, or ! TensorLocation::kDEVICE if the provided name does not map to an input or output tensor. ! ! The location is established at build time. E.g. shape tensors inputs are typically required to be on the CPU. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. !
Sourcepub unsafe fn isShapeInferenceIO(
self: &ICudaEngine,
tensorName: *const c_char,
) -> bool
pub unsafe fn isShapeInferenceIO( self: &ICudaEngine, tensorName: *const c_char, ) -> bool
! ! \brief True if tensor is required as input for shape calculations or is output from shape calculations. ! ! Return true for either of the following conditions: ! ! * The tensor is a network input, and its value is required for IExecutionContext::getTensorShape() ! to return the shape of a network output. ! ! * The tensor is a network output, and inferShape() will compute its values. ! ! For example, if a network uses an input tensor “foo” as an addend to an IElementWiseLayer ! that computes the “reshape dimensions” for IShuffleLayer, then isShapeInferenceIO(“foo”) == true. ! If the network copies said input tensor “foo” to an output “bar”, then ! isShapeInferenceIO(“bar”) == true and IExecutionContext::inferShapes() will write to “bar”. !
Sourcepub unsafe fn getTensorIOMode(
self: &ICudaEngine,
tensorName: *const c_char,
) -> TensorIOMode
pub unsafe fn getTensorIOMode( self: &ICudaEngine, tensorName: *const c_char, ) -> TensorIOMode
! ! \brief Determine whether a tensor is an input or output tensor. ! ! \param tensorName The name of an input or output tensor. ! ! \return kINPUT if tensorName is an input, kOUTPUT if tensorName is an output, or kNONE if neither. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. !
Sourcepub unsafe fn getAliasedInputTensor(
self: &ICudaEngine,
tensorName: *const c_char,
) -> *const c_char
pub unsafe fn getAliasedInputTensor( self: &ICudaEngine, tensorName: *const c_char, ) -> *const c_char
! ! \brief Get the input tensor name that an output tensor should alias with. ! ! Some operations (e.g., KVCacheUpdate) require that certain output tensors share memory with input tensors. ! This method returns the name of the input tensor that a given output tensor should alias with. ! ! \param tensorName The name of an output tensor. ! ! \return The name of the input tensor to alias with, or nullptr if tensorName is not an output tensor or ! the output does not alias with any input. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the ! terminator. !
Sourcepub fn createRuntimeConfig(self: Pin<&mut ICudaEngine>) -> *mut IRuntimeConfig
pub fn createRuntimeConfig(self: Pin<&mut ICudaEngine>) -> *mut IRuntimeConfig
! ! \brief Create a runtime config for TensorRT JIT. ! The caller is responsible for ownership of the returned IRuntimeConfig object. ! ! \return A IRuntimeConfig object. ! ! \see IRuntimeConfig !
Sourcepub fn getDeviceMemorySizeV2(self: &ICudaEngine) -> i64
pub fn getDeviceMemorySizeV2(self: &ICudaEngine) -> i64
! ! \brief Return the maximum device memory required by the context over all profiles. ! ! This API is stateful, so its call returns different values based on the following calls: ! * setWeightStreamingBudget() ! * setWeightStreamingBudgetV2() ! ! \see IExecutionContext::setDeviceMemoryV2() ! \see setWeightStreamingBudget() ! \see setWeightStreamingBudgetV2() !
Sourcepub fn getDeviceMemorySizeForProfileV2(
self: &ICudaEngine,
profileIndex: i32,
) -> i64
pub fn getDeviceMemorySizeForProfileV2( self: &ICudaEngine, profileIndex: i32, ) -> i64
! ! \brief Return the maximum device memory required by the context for a profile. ! ! This API is stateful, so its call returns different values based on the following calls: ! * setWeightStreamingBudget() ! * setWeightStreamingBudgetV2() ! ! \see IExecutionContext::setDeviceMemoryV2() ! \see setWeightStreamingBudget() ! \see setWeightStreamingBudgetV2() !
Sourcepub fn isRefittable(self: &ICudaEngine) -> bool
pub fn isRefittable(self: &ICudaEngine) -> bool
! ! \brief Return true if an engine can be refit. ! ! \see nvinfer1::createInferRefitter() !
Sourcepub unsafe fn getTensorBytesPerComponent(
self: &ICudaEngine,
tensorName: *const c_char,
) -> i32
pub unsafe fn getTensorBytesPerComponent( self: &ICudaEngine, tensorName: *const c_char, ) -> i32
! ! \brief Return the number of bytes per component of an element, or -1 if the ! tensor is not vectorized or provided name does not map to an input or output tensor. ! ! The vector component size is returned if getTensorVectorizedDim(tensorName) != -1. ! ! \param tensorName The name of an input or output tensor. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. ! \warning The function can only return the result of profile 0, and issues a warning message when there are ! multiple profiles in the engine, use getTensorBytesPerComponent with profileIndex when there are multiple ! profiles. ! ! \see getTensorVectorizedDim() ! \see getTensorBytesPerComponent(tensorName, profileIndex) !
Sourcepub unsafe fn getTensorComponentsPerElement(
self: &ICudaEngine,
tensorName: *const c_char,
) -> i32
pub unsafe fn getTensorComponentsPerElement( self: &ICudaEngine, tensorName: *const c_char, ) -> i32
! ! \brief Return the number of components included in one element, or -1 if tensor is ! not vectorized or if the provided name does not map to an input or output tensor. ! ! The number of elements in the vectors is returned if getTensorVectorizedDim(tensorName) != -1. ! ! \param tensorName The name of an input or output tensor. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. ! \warning The function can only return the result of profile 0, and issues a warning message when there ! are multiple profiles in the engine, use getTensorComponentsPerElement with profileIndex when there are ! multiple profiles. ! ! \see getTensorVectorizedDim() ! \see getTensorComponentsPerElement(tensorName, profileIndex) !
Sourcepub unsafe fn getTensorFormat(
self: &ICudaEngine,
tensorName: *const c_char,
) -> TensorFormat
pub unsafe fn getTensorFormat( self: &ICudaEngine, tensorName: *const c_char, ) -> TensorFormat
! ! \brief Return the tensor format, or TensorFormat::kLINEAR if the provided name does not map to an input or ! output tensor. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. ! \warning This API can only return the tensor format of profile 0, and issues a warning message when there are ! multiple profiles in the engine, use getTensorFormat with profileIndex when there are multiple profiles. ! ! \see getTensorFormat(tensorName, profileIndex) !
Sourcepub unsafe fn getTensorFormatDesc(
self: &ICudaEngine,
tensorName: *const c_char,
) -> *const c_char
pub unsafe fn getTensorFormatDesc( self: &ICudaEngine, tensorName: *const c_char, ) -> *const c_char
! ! \brief Return the human readable description of the tensor format, or empty string if the provided name does not ! map to an input or output tensor. ! ! The description includes the order, vectorization, data type, and strides. ! Examples are shown as follows: ! Example 1: kCHW + FP32 ! “Row-major linear FP32 format” ! Example 2: kCHW2 + FP16 ! “Two-wide channel vectorized row-major FP16 format” ! Example 3: kHWC8 + FP16 + Line Stride = 32 ! “Channel major FP16 format where C % 8 == 0 and H Stride % 32 == 0” ! ! \param tensorName The name of an input or output tensor. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. ! \warning The function can only return the result of profile 0, and issues a warning message when there are ! multiple profiles in the engine, use getTensorFormatDesc with profileIndex when there are multiple profiles. !
Sourcepub unsafe fn getTensorVectorizedDim(
self: &ICudaEngine,
tensorName: *const c_char,
) -> i32
pub unsafe fn getTensorVectorizedDim( self: &ICudaEngine, tensorName: *const c_char, ) -> i32
! ! \brief Return the dimension index that the buffer is vectorized, or -1 if the provided name does not ! map to an input or output tensor. ! ! Specifically -1 is returned if scalars per vector is 1. ! ! \param tensorName The name of an input or output tensor. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. ! \warning The function can only return the result of profile 0, and issues a warning message when there are ! multiple profiles in the engine, use getTensorVectorizedDim with profileIndex when there are multiple profiles. !
Sourcepub fn getName(self: &ICudaEngine) -> *const c_char
pub fn getName(self: &ICudaEngine) -> *const c_char
! ! \brief Returns the name of the network associated with the engine. ! ! The name is set during network creation and is retrieved after ! building or deserialization. ! ! \see INetworkDefinition::setName(), INetworkDefinition::getName() ! ! \return A null-terminated C-style string representing the name of the network. !
Sourcepub fn getNbOptimizationProfiles(self: &ICudaEngine) -> i32
pub fn getNbOptimizationProfiles(self: &ICudaEngine) -> i32
! ! \brief Get the number of optimization profiles defined for this engine. ! ! \return Number of optimization profiles. It is always at least 1. ! ! \see IExecutionContext::setOptimizationProfileAsync()
Sourcepub unsafe fn getProfileShape(
self: &ICudaEngine,
tensorName: *const c_char,
profileIndex: i32,
select: OptProfileSelector,
) -> Dims64
pub unsafe fn getProfileShape( self: &ICudaEngine, tensorName: *const c_char, profileIndex: i32, select: OptProfileSelector, ) -> Dims64
! ! \brief Get the minimum / optimum / maximum dimensions for an input tensor given its name under an optimization ! profile. ! ! \param tensorName The name of an input tensor. ! ! \param profileIndex The profile index, which must be between 0 and getNbOptimizationProfiles()-1. ! ! \param select Whether to query the minimum, optimum, or maximum dimensions for this input tensor. ! ! \return The minimum / optimum / maximum dimensions for an input tensor in this profile. ! If the profileIndex is invalid or provided name does not map to an input tensor, return Dims{-1, {}} ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. !
Sourcepub fn getEngineCapability(self: &ICudaEngine) -> EngineCapability
pub fn getEngineCapability(self: &ICudaEngine) -> EngineCapability
! ! \brief Determine what execution capability this engine has. ! ! If the engine has EngineCapability::kSTANDARD, then all engine functionality is valid. ! If the engine has EngineCapability::kSAFETY, then only the functionality in safe engine is valid. ! If the engine has EngineCapability::kDLA_STANDALONE, then only serialize, destroy, and const-accessor functions ! are valid. ! ! \return The EngineCapability flag that the engine was built for. !
Sourcepub fn hasImplicitBatchDimension(self: &ICudaEngine) -> bool
pub fn hasImplicitBatchDimension(self: &ICudaEngine) -> bool
! ! \brief Query whether the engine was built with an implicit batch dimension. ! ! \return Always false since TensorRT 10.0 does not support an implicit batch dimension. ! ! \see createNetworkV2 ! ! \deprecated Deprecated in TensorRT 10.0. Implicit batch is no supported since TensorRT 10.0. !
Sourcepub fn getTacticSources(self: &ICudaEngine) -> u32
pub fn getTacticSources(self: &ICudaEngine) -> u32
! ! \brief return the tactic sources required by this engine. ! ! The value returned is equal to zero or more tactics sources set ! at build time via setTacticSources() in IBuilderConfig. Sources ! set by the latter but not returned by \ref ICudaEngine::getTacticSources ! do not reduce overall engine execution time, and can be removed from ! future builds to reduce build time. ! ! \see IBuilderConfig::setTacticSources() !
Sourcepub fn getProfilingVerbosity(self: &ICudaEngine) -> ProfilingVerbosity
pub fn getProfilingVerbosity(self: &ICudaEngine) -> ProfilingVerbosity
! ! \brief Return the \ref ProfilingVerbosity the builder config was set to when the engine was built. ! ! \return the profiling verbosity the builder config was set to when the engine was built. ! ! \see IBuilderConfig::setProfilingVerbosity() !
Sourcepub fn createEngineInspector(self: &ICudaEngine) -> *mut IEngineInspector
pub fn createEngineInspector(self: &ICudaEngine) -> *mut IEngineInspector
! ! \brief Create a new engine inspector which prints the layer information in an engine or an execution context. ! ! \see IEngineInspector. !
Sourcepub fn getNbIOTensors(self: &ICudaEngine) -> i32
pub fn getNbIOTensors(self: &ICudaEngine) -> i32
! ! \brief Return number of IO tensors. ! ! It is the number of input and output tensors for the network from which the engine was built. ! The names of the IO tensors can be discovered by calling getIOTensorName(i) for i in 0 to getNbIOTensors()-1. ! ! \see getIOTensorName() !
Sourcepub fn getIOTensorName(self: &ICudaEngine, index: i32) -> *const c_char
pub fn getIOTensorName(self: &ICudaEngine, index: i32) -> *const c_char
! ! \brief Return name of an IO tensor. ! ! \param index value between 0 and getNbIOTensors()-1 ! ! \see getNbIOTensors() !
Sourcepub fn getHardwareCompatibilityLevel(
self: &ICudaEngine,
) -> HardwareCompatibilityLevel
pub fn getHardwareCompatibilityLevel( self: &ICudaEngine, ) -> HardwareCompatibilityLevel
! ! \brief Return the hardware compatibility level of this engine. ! ! \return hardwareCompatibilityLevel The level of hardware ! compatibility. !
Sourcepub fn getNbAuxStreams(self: &ICudaEngine) -> i32
pub fn getNbAuxStreams(self: &ICudaEngine) -> i32
! ! \brief Return the number of auxiliary streams used by this engine. ! ! This number will be less than or equal to the maximum allowed number of auxiliary streams set by ! IBuilderConfig::setMaxAuxStreams() API call when the engine was built. ! ! \return the number of auxiliary streams used by this engine. ! ! \see IBuilderConfig::setMaxAuxStreams(), IExecutionContext::setAuxStreams() !
Sourcepub fn createSerializationConfig(
self: Pin<&mut ICudaEngine>,
) -> *mut ISerializationConfig
pub fn createSerializationConfig( self: Pin<&mut ICudaEngine>, ) -> *mut ISerializationConfig
! ! \brief Create a serialization configuration object. ! ! \see ISerializationConfig !
Sourcepub fn serializeWithConfig(
self: &ICudaEngine,
config: Pin<&mut ISerializationConfig>,
) -> *mut IHostMemory
pub fn serializeWithConfig( self: &ICudaEngine, config: Pin<&mut ISerializationConfig>, ) -> *mut IHostMemory
! ! \brief Serialize the network to a stream with the provided SerializationConfig. ! ! \return An IHostMemory object that contains the serialized engine. ! ! The network may be deserialized with IRuntime::deserializeCudaEngine(). ! Serializing plan file with SerializationFlag::kEXCLUDE_WEIGHTS requires building the engine with kREFIT, ! kREFIT_IDENTICAL or kREFIT_INDIVIDUAL. ! ! The only applicable scenario for SerializationFlag::kINCLUDE_REFIT is when serializing weight-stripping ! engines without kEXCLUDE_WEIGHTS. By default, the resulting serialized engine is unrefittable. Setting ! SerializationFlag::kINCLUDE_REFIT ensures that the serialized engine remains refittable. ! ! \see IRuntime::deserializeCudaEngine() !
Sourcepub fn getStreamableWeightsSize(self: &ICudaEngine) -> i64
pub fn getStreamableWeightsSize(self: &ICudaEngine) -> i64
! ! \brief Get the total size in bytes of all streamable weights. ! ! The set of streamable weights is a subset of all network weights. The ! total size may exceed free GPU memory. ! ! \returns The total size in bytes of all streamable weights. ! Returns 0 if BuilderFlag::kWEIGHT_STREAMING is unset during engine building. ! ! \see setWeightStreamingBudget() !
Sourcepub fn setWeightStreamingBudgetV2(
self: Pin<&mut ICudaEngine>,
gpuMemoryBudget: i64,
) -> bool
pub fn setWeightStreamingBudgetV2( self: Pin<&mut ICudaEngine>, gpuMemoryBudget: i64, ) -> bool
! ! \brief Limit the maximum amount of GPU memory usable for network weights in bytes. ! ! \param gpuMemoryBudget This parameter must be a non-negative value. ! 0: Only small amounts of scratch memory will required to run the model. ! >= getStreamableWeightsSize (default): Disables weight streaming. ! The execution may fail if the network is too large for GPU memory. ! ! By setting a weight limit, users can expect a GPU memory usage reduction on the order ! of (total bytes for network weights) - gpuMemoryBudget bytes. Maximum memory savings occur ! when gpuMemoryBudget is set to 0. Each IExecutionContext will require getWeightStreamingScratchMemorySize() ! bytes of additional device memory if the engine is streaming its weights (budget < getStreamableWeightsSize()). ! ! Streaming larger amounts of memory will likely result in lower performance ! except in some boundary cases where streaming weights allows the user to ! run larger batch sizes. The higher throughput offsets the increased ! latency in these cases. Tuning the value of the memory limit is ! recommended for best performance. ! ! \warning GPU memory for the weights is allocated in this call and will be deallocated by enabling weight ! streaming or destroying the ICudaEngine. ! ! \warning BuilderFlag::kWEIGHT_STREAMING must be set during engine building. ! ! \warning The weights streaming budget cannot be modified while there are active IExecutionContexts. ! ! \warning Using the V2 weight streaming APIs with V1 APIs (setWeightStreamingBudget(), ! getWeightStreamingBudget(), getWeightStreamingMinimumBudget()) leads to undefined behavior. ! ! \return true if the memory limit is valid and the call was successful, false otherwise. ! ! \see BuilderFlag::kWEIGHT_STREAMING ! \see getWeightStreamingBudgetV2() ! \see getWeightStreamingScratchMemorySize() ! \see getWeightStreamingAutomaticBudget() ! \see getStreamableWeightsSize() !
Sourcepub fn getWeightStreamingBudgetV2(self: &ICudaEngine) -> i64
pub fn getWeightStreamingBudgetV2(self: &ICudaEngine) -> i64
! ! \brief Returns the current weight streaming device memory budget in bytes. ! ! \warning BuilderFlag::kWEIGHT_STREAMING must be set during engine building. ! ! \returns The weight streaming budget in bytes. Please see setWeightStreamingBudgetV2() for the possible ! return values. Returns getStreamableWeightsSize() if weight streaming is disabled. ! ! \see BuilderFlag::kWEIGHT_STREAMING ! \see setWeightStreamingBudget() ! \see getMinimumWeightStreamingBudget() ! \see getStreamableWeightsSize() !
Sourcepub fn getWeightStreamingAutomaticBudget(self: &ICudaEngine) -> i64
pub fn getWeightStreamingAutomaticBudget(self: &ICudaEngine) -> i64
! ! \brief TensorRT automatically determines a device memory budget for the model to run. The budget is close to the ! current free memory size, leaving some space for other memory needs in the user’s application. If the budget ! exceeds the size obtained from getStreamableWeightsSize(), it is capped to that size, effectively disabling ! weight streaming. Since TensorRT lacks information about the user’s allocations, the remaining memory size might ! be larger than required, leading to wasted memory, or smaller than required, causing an out-of-memory error. For ! optimal memory allocation, it is recommended to manually calculate and set the budget. ! ! \warning BuilderFlag::kWEIGHT_STREAMING must be set during engine building. ! ! \warning The return value may change between TensorRT minor versions. ! ! \warning Setting the returned budget with V1 APIs (setWeightStreamingBudget()) will lead to undefined behavior. ! Please use V2 APIs. ! ! \returns The weight streaming budget in bytes. Please set with setWeightStreamingBudgetV2(). ! ! \see BuilderFlag::kWEIGHT_STREAMING ! \see setWeightStreamingBudgetV2() !
Sourcepub fn getWeightStreamingScratchMemorySize(self: &ICudaEngine) -> i64
pub fn getWeightStreamingScratchMemorySize(self: &ICudaEngine) -> i64
! ! \brief Returns the size of the scratch memory required by the current weight streaming budget. ! ! Weight streaming requires small amounts of scratch memory on the GPU to stage CPU weights right before ! execution. This value is typically much smaller than the total streamable weights size. Each IExecutionContext ! will then allocate this additional memory or the user can provide the additional memory through ! getDeviceMemorySizeV2() and IExecutionContext::setDeviceMemoryV2(). ! ! The return value of this call depends on ! 1. setWeightStreamingBudget() ! 2. setWeightStreamingBudgetV2() ! ! \warning BuilderFlag::kWEIGHT_STREAMING must be set during engine building. ! ! \returns The weight streaming scratch memory in bytes. Returns 0 if weight streaming is disabled. ! ! \see BuilderFlag::kWEIGHT_STREAMING ! \see setWeightStreamingBudgetV2() ! \see getStreamableWeightsSize() ! \see getDeviceMemorySizeV2() ! \see getDeviceMemorySizeForProfileV2() ! \see IExecutionContext::setDeviceMemoryV2() !
Sourcepub unsafe fn isDebugTensor(self: &ICudaEngine, name: *const c_char) -> bool
pub unsafe fn isDebugTensor(self: &ICudaEngine, name: *const c_char) -> bool
! ! \brief Check if a tensor is marked as a debug tensor. ! ! Determine whether the given name corresponds to a debug tensor. ! ! \returns True if tensor is a debug tensor, false otherwise. ! ! \see INetworkDefinition::markDebug !
Sourcepub unsafe fn getProfileTensorValuesV2(
self: &ICudaEngine,
tensorName: *const c_char,
profileIndex: i32,
select: OptProfileSelector,
) -> *const i64
pub unsafe fn getProfileTensorValuesV2( self: &ICudaEngine, tensorName: *const c_char, profileIndex: i32, select: OptProfileSelector, ) -> *const i64
! ! \brief Get the minimum / optimum / maximum values (not dimensions) for an input tensor given ! its name under an optimization profile. These correspond to the values set using ! IOptimizationProfile::setShapeValuesV2 when the engine was built. ! ! \param tensorName The name of an input tensor. ! ! \param profileIndex The profile index, which must be between 0 and getNbOptimizationProfiles()-1. ! ! \param select Whether to query the minimum, optimum, or maximum values for this input tensor. ! ! \return The minimum / optimum / maximum values for an input tensor in this profile. If the profileIndex is ! invalid or the provided name does not map to an input tensor, or the tensor is not a shape binding, return ! nullptr. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. ! ! \warning If input shapes are set with setShapeValues, getProfileTensorValuesV2 will return nullptr !
Sourcepub fn getEngineStat(self: &ICudaEngine, stat: EngineStat) -> i64
pub fn getEngineStat(self: &ICudaEngine, stat: EngineStat) -> i64
! ! \brief Get engine statistics according to the given enum value. ! ! \param stat The kind of statistics to query. ! ! If stat is kTOTAL_WEIGHTS_SIZE, the return value is the total weights size in bytes in the engine. ! If stat is kSTRIPPED_WEIGHTS_SIZE, the return value is the stripped weight size in bytes for engines ! built with BuilderFlag::kSTRIP_PLAN. ! ! When the BuilderFlag::kWEIGHT_STREAMING flag is enabled, engine weights may not be fully copied to the device. ! The reported total weight size reflects the sum of all weights utilized by the engine, ! which does not necessarily correspond to the actual GPU memory allocated. ! ! \return The kind of statistics specified by EngineStat. ! ! \warning if kSTRIPPED_WEIGHTS_SIZE is passed to query a normal engine, this function will ! return -1 to indicate invalid enum value. ! ! \see EngineStat ! \see BuilderFlag::kWEIGHT_STREAMING ! \see setWeightStreamingBudget() ! \see getStreamableWeightsSize() !
Source§impl ICudaEngine
impl ICudaEngine
Sourcepub unsafe fn createExecutionContext1(
self: Pin<&mut Self>,
runtimeConfig: *mut IRuntimeConfig,
) -> *mut IExecutionContext
pub unsafe fn createExecutionContext1( self: Pin<&mut Self>, runtimeConfig: *mut IRuntimeConfig, ) -> *mut IExecutionContext
! ! \brief Create an execution context with TensorRT JIT runtime config. ! ! \param runtimeConfig The runtime config for TensorRT JIT. ! ! \see IRuntimeConfig !
Sourcepub unsafe fn getTensorBytesPerComponent1(
&self,
tensorName: *const c_char,
profileIndex: i32,
) -> i32
pub unsafe fn getTensorBytesPerComponent1( &self, tensorName: *const c_char, profileIndex: i32, ) -> i32
! ! \brief Return the number of bytes per component of an element given of given profile, or -1 if the tensor is not ! vectorized or provided name does not map to an input or output tensor. ! ! The vector component size is returned if getTensorVectorizedDim(tensorName, profileIndex) != -1. ! ! \param tensorName The name of an input or output tensor. ! \param profileIndex The profile index to query ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. ! ! \see getTensorVectorizedDim(tensorName, profileIndex) !
Sourcepub unsafe fn getTensorComponentsPerElement1(
&self,
tensorName: *const c_char,
profileIndex: i32,
) -> i32
pub unsafe fn getTensorComponentsPerElement1( &self, tensorName: *const c_char, profileIndex: i32, ) -> i32
! ! \brief Return the number of components included in one element of given profile, or -1 if tensor is not ! vectorized or the provided name does not map to an input or output tensor. ! ! The number of elements in the vectors is returned if getTensorVectorizedDim(tensorName, profileIndex) != -1. ! ! \param tensorName The name of an input or output tensor. ! \param profileIndex The profile index to query ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. ! ! \see getTensorVectorizedDim(tensorName, profileIndex) !
Sourcepub unsafe fn getTensorFormat1(
&self,
tensorName: *const c_char,
profileIndex: i32,
) -> TensorFormat
pub unsafe fn getTensorFormat1( &self, tensorName: *const c_char, profileIndex: i32, ) -> TensorFormat
! ! \brief Return the tensor format of given profile, or TensorFormat::kLINEAR if the provided name does not map to ! an input or output tensor. ! ! \param tensorName The name of an input or output tensor. ! \param profileIndex The profile index to query the format for. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. !
Sourcepub unsafe fn getTensorFormatDesc1(
&self,
tensorName: *const c_char,
profileIndex: i32,
) -> *const c_char
pub unsafe fn getTensorFormatDesc1( &self, tensorName: *const c_char, profileIndex: i32, ) -> *const c_char
! ! \brief Return the human readable description of the tensor format of given profile, or empty string if the ! provided name does not map to an input or output tensor. ! ! The description includes the order, vectorization, data type, and strides. ! Examples are shown as follows: ! Example 1: kCHW + FP32 ! “Row-major linear FP32 format” ! Example 2: kCHW2 + FP16 ! “Two-wide channel vectorized row-major FP16 format” ! Example 3: kHWC8 + FP16 + Line Stride = 32 ! “Channel major FP16 format where C % 8 == 0 and H Stride % 32 == 0” ! ! \param tensorName The name of an input or output tensor. ! \param profileIndex The profile index to query the format for. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. !
Sourcepub unsafe fn getTensorVectorizedDim1(
&self,
tensorName: *const c_char,
profileIndex: i32,
) -> i32
pub unsafe fn getTensorVectorizedDim1( &self, tensorName: *const c_char, profileIndex: i32, ) -> i32
! ! \brief Return the dimension index that the buffer is vectorized of given profile, or -1 if the provided name ! does not map to an input or output tensor. ! ! Specifically -1 is returned if scalars per vector is 1. ! ! \param tensorName The name of an input. ! \param profileIndex The profile index to query the format for. ! ! \warning The string tensorName must be null-terminated, and be at most 4096 bytes including the terminator. !