类 TensorFormat¶
类文档¶
-
class TensorFormat¶
TensorFormat 是一个枚举类,用于定义存储张量数据的内存布局。
公共类型
-
enum Value¶
支持 TensorFormat 类的底层枚举类
如果您需要使用 TensorFormat 类本身,请使用此枚举而不是正常的实例化进行接口
例如:torch_tensorrt::TensorFormat type = TensorFormat::kContiguous;
值
-
enumerator kContiguous¶
连续 / NCHW / 线性。
-
enumerator kChannelsLast¶
通道最后 / NHWC。
-
enumerator kUnknown¶
哨兵值。
-
enumerator kContiguous¶
公共函数
-
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
-
enum Value¶