快捷方式

Struct Device

巢狀關係

巢狀型別

Struct 文件

struct Device

目標裝置的設定資料結構。

Public 函式

inline Device()

Device 結構的建構函式

Public 成員

DeviceType device_type

裝置的設定資料結構。這個結構體將儲存目標裝置相關的引數,例如 device_type、gpu_id、dla_core。

int64_t gpu_id
int64_t dla_core
bool allow_gpu_fallback

(僅在目標裝置為 DLA 時使用) 如果某些層在 DLA 上不受支援,則允許引擎在 GPU 上執行這些層

class DeviceType

支援可用於 TensorRT 引擎的 裝置 型別

這個類與 c10::DeviceTypes 相容 (但會檢查 TRT 支援),但唯一適用的值是 at::kCUDA,它對映到 DeviceType::kGPU

要使用 DataType 類本身,請使用列舉進行介面,而不是常規例項化

ex. torch_tensorrt::DeviceType type = DeviceType::kGPU;

Public 型別

enum Value

支援 DeviceType 類的底層列舉類

如果需要使用 DeviceType 類本身,請使用此列舉進行介面,而不是常規例項化

ex. torch_tensorrt::DeviceType type = DeviceType::kGPU;

enumerator kGPU

目標 GPU,用於執行引擎。

enumerator kDLA

目標 DLA,用於執行引擎。

Public 函式

DeviceType() = default

構造一個新的 裝置 型別物件。

inline constexpr DeviceType(Value t)

從內部列舉構造一個新的 裝置 型別物件。

DeviceType(c10::DeviceType t)

從 torch 裝置列舉構造一個新的 裝置 型別物件 注意:唯一有效的值是 torch::kCUDA (不支援 torch::kCPU)

引數

t

inline operator Value() const

裝置 物件獲取內部值。

返回值

Value

explicit operator bool() = delete
inline constexpr bool operator==(DeviceType other) const

DeviceType 的比較運算子。

引數

other

返回值

true

返回值

false

inline constexpr bool operator!=(DeviceType other) const

DeviceType 的比較運算子。

引數

other

返回值

true

返回值

false

文件

查閱 PyTorch 的全面開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深入教程

檢視教程

資源

查詢開發資源並獲取問題解答

檢視資源