快捷方式

类 TensorFormat

类文档

class TensorFormat

TensorFormat 是一个枚举类,用于定义存储张量数据的内存布局。

公共类型

enum Value

支持 TensorFormat 类的底层枚举类

如果您需要使用 TensorFormat 类本身,请使用此枚举而不是正常的实例化进行接口

例如:torch_tensorrt::TensorFormat type = TensorFormat::kContiguous;

enumerator kContiguous

连续 / NCHW / 线性。

enumerator kChannelsLast

通道最后 / NHWC。

enumerator kUnknown

哨兵值。

公共函数

TensorFormat() = default

构造一个新的 TensorFormat 对象。

inline constexpr TensorFormat(Value t)

从枚举构造 TensorFormat

TORCHTRT_API TensorFormat(at::MemoryFormat t)

从 torch 类型枚举构造一个新的 TensorFormat 对象。

参数

t

inline operator Value() const

获取 TensorFormat 对象的枚举值。

返回值

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

TensorFormat 的比较运算符。

参数

other

返回值

true

返回值

false

inline constexpr bool operator==(TensorFormat::Value other) const

TensorFormat 的比较运算符。

参数

other

返回值

true

返回值

false

inline constexpr bool operator!=(TensorFormat other) const

TensorFormat 的比较运算符。

参数

other

返回值

true

返回值

false

inline constexpr bool operator!=(TensorFormat::Value other) const

TensorFormat 的比较运算符。

参数

other

返回值

true

返回值

false

文档

访问 PyTorch 的全面开发者文档

查看文档

教程

获取面向初学者和高级开发者的深度教程

查看教程

资源

查找开发资源并获得问题解答

查看资源