Class TensorRtOnnxParserRefitter
- Namespace
- JYPPX.TensorRtSharp
- Assembly
- JYPPX.TensorRtSharp.dll
Provides a safe managed wrapper over TensorRT ONNX parser-refitter diagnostics. 提供 TensorRT ONNX parser-refitter 诊断信息的安全托管封装。
public sealed class TensorRtOnnxParserRefitter : IDisposable
- Inheritance
-
TensorRtOnnxParserRefitter
- Implements
- Inherited Members
Properties
ErrorCount
Gets the number of parser-refitter errors currently reported by TensorRT. 获取 TensorRT 当前报告的 parser-refitter 错误数量。
public int ErrorCount { get; }
Property Value
Line
Gets the TensorRT API line used by this parser-refitter. 获取当前 parser-refitter 使用的 TensorRT API 版本线。
public TensorRtApiLine Line { get; }
Property Value
Methods
ClearErrors()
Clears parser-refitter errors stored by TensorRT. 清理 TensorRT 保存的 parser-refitter 错误。
public void ClearErrors()
Dispose()
Releases the native ONNX parser-refitter handle. 释放原生 ONNX parser-refitter 句柄。
public void Dispose()
GetDiagnostic(int)
Gets one detailed parser-refitter diagnostic by index. 按索引获取一条详细 parser-refitter 诊断信息。
public TensorRtOnnxParserDiagnostic GetDiagnostic(int index)
Parameters
indexintZero-based parser-refitter error index. 从零开始的 parser-refitter 错误索引。
Returns
- TensorRtOnnxParserDiagnostic
The copied detailed parser-refitter diagnostic. 已复制的详细 parser-refitter 诊断信息。
Remarks
Variable-length strings are copied through caller-owned buffers; no borrowed native parser-error pointer is exposed. 可变长度字符串通过调用方缓冲区复制;不会暴露 borrowed native parser-error 指针。
GetDiagnosticSnapshot()
Captures copied parser-refitter diagnostics without exposing TensorRT-owned parser-error pointers. 捕获已复制的 parser-refitter 诊断信息,不暴露 TensorRT 拥有的 parser-error 指针。
public TensorRtOnnxParserRefitterDiagnosticSnapshot GetDiagnosticSnapshot()
Returns
- TensorRtOnnxParserRefitterDiagnosticSnapshot
A pointer-free parser-refitter diagnostic snapshot. 无指针逃逸的 parser-refitter 诊断快照。
GetDiagnosticSummary()
Builds a readable parser-refitter diagnostic summary for logs and deployment troubleshooting. 为日志和部署排障生成可读的 parser-refitter 诊断摘要。
public string GetDiagnosticSummary()
Returns
- string
A parser-refitter diagnostic summary string. parser-refitter 诊断摘要字符串。
GetDiagnostics()
Gets all detailed parser-refitter diagnostics currently reported by TensorRT. 获取 TensorRT 当前报告的全部详细 parser-refitter 诊断信息。
public IReadOnlyList<TensorRtOnnxParserDiagnostic> GetDiagnostics()
Returns
- IReadOnlyList<TensorRtOnnxParserDiagnostic>
The copied detailed parser-refitter diagnostics. 已复制的详细 parser-refitter 诊断信息列表。
GetError(int)
Gets one parser-refitter error by index. 按索引获取一个 parser-refitter 错误。
public TensorRtParserErrorInfo GetError(int index)
Parameters
indexintZero-based parser-refitter error index. 从零开始的 parser-refitter 错误索引。
Returns
- TensorRtParserErrorInfo
The copied parser-refitter error information. 已复制的 parser-refitter 错误信息。
GetErrors()
Gets all parser-refitter errors currently reported by TensorRT. 获取 TensorRT 当前报告的全部 parser-refitter 错误。
public IReadOnlyList<TensorRtParserErrorInfo> GetErrors()
Returns
- IReadOnlyList<TensorRtParserErrorInfo>
The copied parser-refitter errors. 已复制的 parser-refitter 错误列表。
LoadInitializer(string, ArraySegment<byte>)
Loads an external ONNX initializer from a byte-array segment into the TensorRT 11 parser-refitter. 从托管字节数组片段加载外部 ONNX initializer 到 TensorRT 11 parser-refitter。
public bool LoadInitializer(string name, ArraySegment<byte> data)
Parameters
namestringInitializer name. initializer 名称。
dataArraySegment<byte>Initializer data segment. initializer 数据片段。
Returns
- bool
truewhen TensorRT accepts the initializer. TensorRT 接受 initializer 时返回true。
LoadInitializer(string, byte[])
Loads an external ONNX initializer into the TensorRT 11 parser-refitter. 将外部 ONNX initializer 加载到 TensorRT 11 parser-refitter。
public bool LoadInitializer(string name, byte[] data)
Parameters
Returns
- bool
truewhen TensorRT accepts the initializer. TensorRT 接受 initializer 时返回true。
Remarks
The initializer data is copied into an owned managed array and pinned until this parser-refitter is disposed. initializer 数据会复制到当前 parser-refitter 拥有的托管数组,并 pin 到 parser-refitter 释放为止。
LoadInitializer(string, Stream)
Loads an external ONNX initializer from a stream into the TensorRT 11 parser-refitter. 从 stream 加载外部 ONNX initializer 到 TensorRT 11 parser-refitter。
public bool LoadInitializer(string name, Stream dataStream)
Parameters
namestringInitializer name. initializer 名称。
dataStreamStreamReadable stream containing initializer data. 包含 initializer 数据的可读 stream。
Returns
- bool
truewhen TensorRT accepts the initializer. TensorRT 接受 initializer 时返回true。
LoadInitializer(string, ReadOnlySpan<byte>)
Loads an external ONNX initializer from a read-only span into the TensorRT 11 parser-refitter. 从只读 span 加载外部 ONNX initializer 到 TensorRT 11 parser-refitter。
public bool LoadInitializer(string name, ReadOnlySpan<byte> data)
Parameters
namestringInitializer name. initializer 名称。
dataReadOnlySpan<byte>Initializer data. initializer 数据。
Returns
- bool
truewhen TensorRT accepts the initializer. TensorRT 接受 initializer 时返回true。
LoadModelProto(ArraySegment<byte>, string?)
Loads serialized ONNX model-proto bytes from a byte-array segment into the TensorRT 11 parser-refitter. 从托管字节数组片段加载 ONNX model proto 到 TensorRT 11 parser-refitter。
public bool LoadModelProto(ArraySegment<byte> modelData, string? modelPath = null)
Parameters
modelDataArraySegment<byte>Serialized ONNX model-proto byte segment. 已序列化 ONNX model proto 字节片段。
modelPathstringOptional model path used by TensorRT diagnostics. TensorRT 诊断信息使用的可选模型路径。
Returns
- bool
truewhen TensorRT accepts the model proto. TensorRT 接受 model proto 时返回true。
LoadModelProto(byte[], string?)
Loads serialized ONNX model-proto bytes into the TensorRT 11 parser-refitter without refitting immediately. 将已序列化 ONNX model proto 字节加载到 TensorRT 11 parser-refitter,但暂不立即重整。
public bool LoadModelProto(byte[] modelData, string? modelPath = null)
Parameters
modelDatabyte[]Serialized ONNX model-proto bytes. 已序列化 ONNX model proto 字节。
modelPathstringOptional model path used by TensorRT diagnostics. TensorRT 诊断信息使用的可选模型路径。
Returns
- bool
truewhen TensorRT accepts the model proto. TensorRT 接受 model proto 时返回true。
LoadModelProto(Stream, string?)
Loads serialized ONNX model-proto bytes from a stream into the TensorRT 11 parser-refitter. 从 stream 加载 ONNX model proto 到 TensorRT 11 parser-refitter。
public bool LoadModelProto(Stream modelStream, string? modelPath = null)
Parameters
modelStreamStreamReadable stream containing serialized ONNX model-proto bytes. 包含已序列化 ONNX model proto 字节的可读 stream。
modelPathstringOptional model path used by TensorRT diagnostics. TensorRT 诊断信息使用的可选模型路径。
Returns
- bool
truewhen TensorRT accepts the model proto. TensorRT 接受 model proto 时返回true。
LoadModelProto(ReadOnlySpan<byte>, string?)
Loads serialized ONNX model-proto bytes from a read-only span into the TensorRT 11 parser-refitter. 从只读 span 加载 ONNX model proto 到 TensorRT 11 parser-refitter。
public bool LoadModelProto(ReadOnlySpan<byte> modelData, string? modelPath = null)
Parameters
modelDataReadOnlySpan<byte>Serialized ONNX model-proto bytes. 已序列化 ONNX model proto 字节。
modelPathstringOptional model path used by TensorRT diagnostics. TensorRT 诊断信息使用的可选模型路径。
Returns
- bool
truewhen TensorRT accepts the model proto. TensorRT 接受 model proto 时返回true。
RefitFromBytes(ArraySegment<byte>, string?)
Refits the target engine from a serialized ONNX model byte-array segment. 使用托管字节数组片段中的 ONNX 模型重整目标 engine。
public bool RefitFromBytes(ArraySegment<byte> modelData, string? modelPath = null)
Parameters
modelDataArraySegment<byte>Serialized ONNX model byte segment. 已序列化 ONNX 模型字节片段。
modelPathstringOptional model path used by TensorRT diagnostics. TensorRT 诊断信息使用的可选模型路径。
Returns
- bool
truewhen TensorRT reports the refit succeeded. TensorRT 报告重整成功时返回true。
RefitFromBytes(byte[], string?)
Refits the target engine from serialized ONNX model bytes. 使用已序列化 ONNX 模型字节重整目标 engine。
public bool RefitFromBytes(byte[] modelData, string? modelPath = null)
Parameters
modelDatabyte[]Serialized ONNX model bytes. 已序列化 ONNX 模型字节。
modelPathstringOptional model path used by TensorRT diagnostics. TensorRT 诊断信息使用的可选模型路径。
Returns
- bool
truewhen TensorRT reports the refit succeeded. TensorRT 报告重整成功时返回true。
Remarks
The model buffer is pinned only for the native call; TensorRT parser-refitter diagnostics remain available through copied diagnostic APIs. 模型缓冲区仅在 native 调用期间短期 pin;TensorRT parser-refitter 诊断仍通过复制型诊断 API 获取。
RefitFromBytes(Stream, string?)
Refits the target engine from serialized ONNX model bytes read from a stream. 使用从 stream 读取的 ONNX 模型字节重整目标 engine。
public bool RefitFromBytes(Stream modelStream, string? modelPath = null)
Parameters
modelStreamStreamReadable stream containing serialized ONNX model bytes. 包含已序列化 ONNX 模型字节的可读 stream。
modelPathstringOptional model path used by TensorRT diagnostics. TensorRT 诊断信息使用的可选模型路径。
Returns
- bool
truewhen TensorRT reports the refit succeeded. TensorRT 报告重整成功时返回true。
RefitFromBytes(ReadOnlySpan<byte>, string?)
Refits the target engine from serialized ONNX model bytes in a read-only span. 使用只读 span 中的 ONNX 模型字节重整目标 engine。
public bool RefitFromBytes(ReadOnlySpan<byte> modelData, string? modelPath = null)
Parameters
modelDataReadOnlySpan<byte>Serialized ONNX model bytes. 已序列化 ONNX 模型字节。
modelPathstringOptional model path used by TensorRT diagnostics. TensorRT 诊断信息使用的可选模型路径。
Returns
- bool
truewhen TensorRT reports the refit succeeded. TensorRT 报告重整成功时返回true。
RefitFromFile(string)
Refits the target engine from an ONNX model file. 使用 ONNX 模型文件重整目标 engine。
public bool RefitFromFile(string filePath)
Parameters
filePathstringThe ONNX model path. ONNX 模型路径。
Returns
- bool
truewhen TensorRT reports the refit succeeded. TensorRT 报告重整成功时返回true。
RefitLoadedModel()
Refits the model proto previously loaded through LoadModelProto(byte[], string?). 重整先前通过 LoadModelProto(byte[], string?) 加载的 model proto。
public bool RefitLoadedModel()
Returns
- bool
truewhen TensorRT reports the refit succeeded. TensorRT 报告重整成功时返回true。