IsNullptr
Availability
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
Example
1 2 3 4 | #define OP_CHECK_NULL(param, retExpr) \ if (IsNullptr(param, #param)) { \ retExpr; \ } |
Parent topic: Basic Kernel Function APIs