Class TensorRtStreamReader
- Namespace
- JYPPX.TensorRtSharp
- Assembly
- JYPPX.TensorRtSharp.dll
Owns an immutable native TensorRT IStreamReaderV2 data source. 拥有不可变的原生 TensorRT IStreamReaderV2 数据源。
public sealed class TensorRtStreamReader : IDisposable
- Inheritance
-
TensorRtStreamReader
- Implements
- Inherited Members
Remarks
Input bytes are copied into native immutable storage. TensorRT callback destinations and CUDA stream values never cross the public managed boundary. Dispose is deferred while a deserialize call or returned engine retains the owner. 输入字节会复制到原生不可变存储中,回调目标与 CUDA stream 不跨越公开托管边界;借用期间的释放请求会被延迟。
Constructors
TensorRtStreamReader(TensorRtApiLine, byte[])
Creates a native IStreamReaderV2 owner from serialized engine bytes. 从序列化引擎字节创建原生 IStreamReaderV2 所有者。
public TensorRtStreamReader(TensorRtApiLine line, byte[] serializedEngine)
Parameters
lineTensorRtApiLineTensorRT 10 or TensorRT 11. TensorRT 10 或 TensorRT 11。
serializedEnginebyte[]Serialized engine bytes copied into native immutable storage. 将被复制到原生不可变存储的序列化引擎字节。
TensorRtStreamReader(TensorRtApiLine, Stream)
Creates a native IStreamReaderV2 owner by copying a readable managed stream. 通过复制可读托管流创建原生 IStreamReaderV2 所有者。
public TensorRtStreamReader(TensorRtApiLine line, Stream serializedEngineStream)
Parameters
lineTensorRtApiLineTensorRT 10 or TensorRT 11. TensorRT 10 或 TensorRT 11。
serializedEngineStreamStreamReadable stream copied from its current position to the end. 从当前位置复制到末尾的可读流。
Properties
IsDisposed
Gets whether Dispose has been requested. 获取是否已请求释放。
public bool IsDisposed { get; }
Property Value
Length
Gets the immutable native source length in bytes. 获取不可变原生数据源的字节长度。
public ulong Length { get; }
Property Value
Line
Gets the TensorRT API line. 获取 TensorRT API 版本线。
public TensorRtApiLine Line { get; }
Property Value
Methods
Dispose()
Requests release after all active deserialize and engine borrowers are gone. 请求在所有反序列化与引擎借用者退出后释放资源。
public void Dispose()
~TensorRtStreamReader()
Releases the owner if it was abandoned without an explicit Dispose call. 在未显式调用 Dispose 而对象被遗弃时释放所有者。
protected ~TensorRtStreamReader()
GetRuntimeSnapshot()
Gets a copied, pointer-free native callback snapshot. 获取复制后的无指针原生回调快照。
public TensorRtStreamReaderRuntimeSnapshot GetRuntimeSnapshot()