Skip to content
版 本

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

免 责 声 明:本 站 内 容 由 asc-devkit 仓 master 分 支 自 动 编 译 生 成,属 于 持 续 开 发 版 本,可 能 存 在 缺 陷,仅 供 预 览 与 参 考。如 需 稳 定 及 商 用 资 料,请 查 阅 官 方 昇 腾 社 区