Table of Contents

Class TensorRtRuntime

Namespace
JYPPX.TensorRtSharp
Assembly
JYPPX.TensorRtSharp.dll

Managed wrapper around a TensorRT runtime. TensorRT runtime 的托管封装。

public sealed class TensorRtRuntime : IDisposable
Inheritance
TensorRtRuntime
Implements
Inherited Members

Constructors

TensorRtRuntime(TensorRtLogger)

Creates a TensorRT runtime from a logger. 使用 logger 创建一个 TensorRT runtime。

public TensorRtRuntime(TensorRtLogger logger)

Parameters

logger TensorRtLogger

The TensorRT logger used by the runtime. runtime 使用的 TensorRT logger。

Properties

DlaCore

Gets or sets the DLA core selected for TensorRT runtime deserialization. 获取或设置 TensorRT 11 runtime 反序列化时选择的 DLA core。

public int DlaCore { get; set; }

Property Value

int

DlaCoreCount

Gets the number of DLA cores visible to the TensorRT runtime. 获取 TensorRT 11 runtime 可见的 DLA core 数量。

public int DlaCoreCount { get; }

Property Value

int

EngineHostCodeAllowed

Gets or sets whether TensorRT may deserialize engines that contain host executable code. 获取或设置 TensorRT 是否允许反序列化包含主机可执行代码的 engine。

public bool EngineHostCodeAllowed { get; set; }

Property Value

bool

HasErrorRecorder

Gets whether this runtime currently has a TensorRT error recorder attached. 获取当前 runtime 是否附加了 TensorRT error recorder。

public bool HasErrorRecorder { get; }

Property Value

bool

Line

Gets the TensorRT API line used by this runtime. 获取当前 runtime 使用的 TensorRT API line。

public TensorRtApiLine Line { get; }

Property Value

TensorRtApiLine

MaxThreads

Gets or sets the maximum number of worker threads TensorRT may use in this runtime. 获取或设置当前 runtime 允许 TensorRT 使用的最大工作线程数。

public int MaxThreads { get; set; }

Property Value

int

TempfileControlFlags

Gets or sets TensorRT temporary-file control flags. 获取或设置 TensorRT 临时文件控制标志。

public TensorRtTempfileControlFlags TempfileControlFlags { get; set; }

Property Value

TensorRtTempfileControlFlags

Methods

ClearErrorRecorder()

Clears the native error recorder pointer if one was attached externally. 清除外部附加的原生 error recorder 指针。

public void ClearErrorRecorder()

ClearGpuAllocator()

Clears the native GPU allocator pointer and returns runtime allocation to TensorRT defaults. 清除原生 GPU allocator 指针,让 runtime allocation 回到 TensorRT 默认行为。

public void ClearGpuAllocator()

ClearTemporaryDirectory()

Clears the explicit temporary directory and lets TensorRT use platform defaults. 清除显式临时目录,让 TensorRT 使用平台默认目录。

public void ClearTemporaryDirectory()

Deserialize(TensorRtHostMemory)

Deserializes an engine from TensorRT host memory. 从 TensorRT host memory 反序列化一个 engine。

public TensorRtEngine Deserialize(TensorRtHostMemory hostMemory)

Parameters

hostMemory TensorRtHostMemory

The serialized engine memory. 序列化 engine 内存。

Returns

TensorRtEngine

A TensorRT engine wrapper. TensorRT engine 封装。

Deserialize(byte[])

Deserializes an engine from a managed byte buffer. 从托管字节缓冲区反序列化一个 engine。

public TensorRtEngine Deserialize(byte[] serializedEngine)

Parameters

serializedEngine byte[]

The serialized engine bytes. 序列化 engine 字节数组。

Returns

TensorRtEngine

A TensorRT engine wrapper. TensorRT engine 封装。

DeserializeFromFile(string)

Deserializes an engine from a serialized engine file. 从序列化 engine 文件中反序列化一个 engine。

public TensorRtEngine DeserializeFromFile(string filePath)

Parameters

filePath string

The path to the serialized engine file. 序列化 engine 文件路径。

Returns

TensorRtEngine

A TensorRT engine wrapper. TensorRT engine 封装。

Dispose()

Releases the TensorRT runtime handle. 释放 TensorRT runtime 句柄。

public void Dispose()

GetTemporaryDirectory()

Gets the runtime temporary directory configured through TensorRT. 获取通过 TensorRT 配置的 runtime 临时目录。

public string GetTemporaryDirectory()

Returns

string

The configured temporary directory or an empty string when TensorRT uses defaults. 已配置目录;TensorRT 使用默认值时为空字符串。

SetTemporaryDirectory(string)

Sets the runtime temporary directory used by TensorRT for executable temporary files. 设置 TensorRT 用于可执行临时文件的 runtime 临时目录。

public void SetTemporaryDirectory(string directoryPath)

Parameters

directoryPath string

The temporary directory path. 临时目录路径。