IsContiguous
Function Usage
Checks whether the input tensor is contiguous.
Prototype
bool IsContiguous(const aclTensor *tensor)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
tensor |
Input |
Destination tensor. |
Returns
true: contiguous tensor; false: otherwise.
Constraints
- The passed tensor must not be empty.
- In the case of a null pointer, true is returned and the error message "check tensor != nullptr failed" is displayed.
Example
1 2 3 4 5 6 | // If the tensor is non-contiguous, a return statement is executed. void Func(aclTensor *tensor) { if (!IsContiguous(tensor)) { return; } } |
Parent topic: tensor_view_utils