IsHardwareV
产 品 支 持 情 况
| 产 品 | 是 否 支 持 |
|---|---|
| Ascend 950PR/Ascend 950DT | √ |
功 能 说 明
需 要 包 含 的 头 文 件 为:#include "tensor_api/tensor.h"。
IsHardwareV用 于 判 断 一 个 类 型 是 否 为Tensor API中 定 义 的 硬 件 存 储 位 置 类 型。
原 型 定 义
C++
template <typename T>
constexpr bool IsHardwareV = IsHardware<T>::value;
参 数 说 明
模 板 参 数 说 明
| 参 数 名 | 类 型 | 描 述 |
|---|---|---|
| T | 输 入 | 待 判 断 的 类 型。当 前 支 持 识 别 的 硬 件 位 置 类 型 包 括:Location::INVALID、Location::GM、Location::UB、Location::L1、Location::L0A、Location::L0B、Location::L0ScaleA、Location::L0ScaleB、Location::L0C、Location::BIAS、Location::FIXBUF、Location::SSBUF |
返 回 值 说 明
若T硬 件 位 置 类 型,则 返 回true,否 则 返 回false。
调 用 示 例
C++
using namespace AscendC::Te;
constexpr bool isGM = IsHardwareV<Location::GM>;
// isGM = true
constexpr bool isL0A = IsHardwareV<const Location::L0A&>;
// isL0A = true
constexpr bool isInt = IsHardwareV<int>;
// isInt = false