IsNullptr

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference products

Atlas training products

Function Usage

Checks whether the input pointer is null. If the pointer is null, true is returned and an error log is printed. Otherwise, false is returned.

Prototype

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)

Parameters

Parameter

Input/Output

Description

tensor

Input

Pointer to be checked. It can be of the aclTensor *, aclTensorList *, aclScalar *, aclIntArray *, aclBoolArray *, or aclFloatArray * type.

name

Input

Name of the checked pointer. If the checked pointer is null, the name is printed in the error log.

Returns

Bool type. true: nullptr; false: not nullptr.

Constraints

None

Examples

1
2
3
4
#define OP_CHECK_NULL(param, retExpr) \
  if (IsNullptr(param, #param)) { \
    retExpr; \
  }