---
title: IsNullptr
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/aolapi/atlasascendc_api_07_1204.html
sourcePath: /source/zh/canncommercial/900/API/aolapi/atlasascendc_api_07_1204.html
indexId: bef09037b51d577eedfcad90d50a8c2c6c383679e613e48339c86df2fd3b4b4d70
---
# IsNullptr

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | ☓ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | ☓ |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |


#### 功能说明

判断输入的指针是否为空。若为空指针返回true、并打印错误日志，否则返回false。


#### 函数原型

```
static inline bool IsNullptr(const aclTensor *tensor, const char *name)
```

```
static inline bool IsNullptr(const aclTensorList *tensorList, const char *name)
```

```
static inline bool IsNullptr(const aclScalar *scalar, const char *name)
```

```
static inline bool IsNullptr(const aclIntArray *intArr, const char *name)
```

```
static inline bool IsNullptr(const aclBoolArray *boolArr, const char *name)
```

```
static inline bool IsNullptr(const aclFloatArray *floatArr, const char *name)
```


#### 参数说明

| 参数 | 输入/输出 | 说明 |
| --- | --- | --- |
| tensor | 输入 | 需要被检查的指针，支持aclTensor \*、aclTensorList \*、aclScalar \*、aclIntArray \*、aclBoolArray \*、aclFloatArray \*类型。 |
| name | 输入 | 被检查的指针的一个标识，如果被检查指针为空，则打印的错误日志里会输出此标识（name）。 |


#### 返回值说明

返回bool类型，如果指针被判断为nullptr，返回true，否则返回false。


#### 约束说明

无


#### 调用示例

```
#define OP_CHECK_NULL(param, retExpr) \
  if (IsNullptr(param, #param)) { \
    retExpr; \
  }
```
