Class TensorRtEngineInspector
- Namespace
- JYPPX.TensorRtSharp
- Assembly
- JYPPX.TensorRtSharp.dll
Managed wrapper around a TensorRT engine inspector. TensorRT engine inspector 的托管封装。
public sealed class TensorRtEngineInspector : IDisposable
- Inheritance
-
TensorRtEngineInspector
- Implements
- Inherited Members
Properties
HasErrorRecorder
Gets whether TensorRT reports an error recorder attached to this inspector. 获取 TensorRT 是否报告当前 inspector 绑定了 error recorder。
public bool HasErrorRecorder { get; }
Property Value
Remarks
Supported on TensorRT 8, TensorRT 10, and TensorRT 11 through a safe boolean boundary. 通过安全 bool 边界支持 TensorRT 8、TensorRT 10 和 TensorRT 11。
HasExecutionContext
Gets whether this inspector currently uses an execution context as the inspection source. 获取当前 inspector 是否已经关联 execution context 作为检查来源。
public bool HasExecutionContext { get; }
Property Value
Line
Gets the TensorRT API line used by this inspector. 获取当前 inspector 使用的 TensorRT API line。
public TensorRtApiLine Line { get; }
Property Value
Methods
ClearErrorRecorder()
Clears the error recorder attached to this engine inspector. 清除绑定到该 engine inspector 的 error recorder。
public void ClearErrorRecorder()
Remarks
Supported on TensorRT 8, TensorRT 10, and TensorRT 11. The managed wrapper does not expose user-owned TensorRT error-recorder callbacks or borrowed recorder pointers. 支持 TensorRT 8、TensorRT 10 和 TensorRT 11。托管层不暴露用户自定义 TensorRT error-recorder callback,也不暴露 borrowed recorder 指针。
ClearExecutionContext()
Clears the execution context associated with this inspector. 清除当前 inspector 关联的 execution context。
public void ClearExecutionContext()
Dispose()
Releases the TensorRT engine-inspector handle. 释放 TensorRT engine inspector 句柄。
public void Dispose()
GetEngineInformation(TensorRtLayerInformationFormat)
Gets human-readable engine information from TensorRT. 从 TensorRT 获取可读的 engine 信息。
public string GetEngineInformation(TensorRtLayerInformationFormat format = TensorRtLayerInformationFormat.Oneline)
Parameters
formatTensorRtLayerInformationFormatThe layer information format. layer 信息格式。
Returns
- string
The engine information text. engine 信息文本。
GetLayerInformation(int, TensorRtLayerInformationFormat)
Gets layer information for a single TensorRT engine layer. 获取指定 TensorRT engine layer 的诊断信息。
public string GetLayerInformation(int layerIndex, TensorRtLayerInformationFormat format = TensorRtLayerInformationFormat.Oneline)
Parameters
layerIndexintZero-based layer index. / 从零开始的 layer 索引。
formatTensorRtLayerInformationFormatThe output format requested from TensorRT. / 向 TensorRT 请求的诊断信息格式。
Returns
- string
A copied UTF-8 string with TensorRT layer information. / 从 TensorRT 复制出的 UTF-8 layer 信息字符串。
SetExecutionContext(TensorRtExecutionContext)
Attaches an execution context to the inspector for context-aware reporting. 为 inspector 附加一个 execution context,以支持带上下文的信息输出。
public void SetExecutionContext(TensorRtExecutionContext context)
Parameters
contextTensorRtExecutionContextThe execution context to attach. 要附加的 execution context。
TryGetErrorRecorderSnapshot(out TensorRtErrorRecorderSnapshot)
Attempts to collect a copied read-only snapshot from this inspector's error recorder. 尝试从当前 inspector 的 error recorder 采集只读托管快照。
public bool TryGetErrorRecorderSnapshot(out TensorRtErrorRecorderSnapshot snapshot)
Parameters
snapshotTensorRtErrorRecorderSnapshotThe copied snapshot. 已复制到托管内存的快照。
Returns
Remarks
The snapshot does not expose a borrowed recorder pointer or change recorder ownership. 该快照不暴露 borrowed recorder 指针,也不改变 recorder ownership。
TryGetErrorRecorderVersionedMetadata(out TensorRtVersionedInterfaceMetadata)
Tries to copy metadata from the attached error recorder. 尝试复制已附加 error recorder 的元数据。
public bool TryGetErrorRecorderVersionedMetadata(out TensorRtVersionedInterfaceMetadata metadata)
Parameters
metadataTensorRtVersionedInterfaceMetadata
Returns
TryGetErrorRecorderVersionedMetadata(out TensorRtVersionedInterfaceMetadata, out string)
Tries to copy metadata from the attached error recorder. 尝试复制已附加 error recorder 的元数据。
public bool TryGetErrorRecorderVersionedMetadata(out TensorRtVersionedInterfaceMetadata metadata, out string diagnostic)
Parameters
metadataTensorRtVersionedInterfaceMetadatadiagnosticstring