Reshape
Availability
Function Usage
Reshapes the input tensor x without changing the tensor data.
Prototype
const aclTensor *Reshape(const aclTensor *x, const op::Shape &shape, aclOpExecutor *executor)
const aclTensor *Reshape(const aclTensor *x, const aclIntArray *shape, aclOpExecutor *executor)
Parameters
Returns
Success: The aclTensor with the destination shape information is returned to the caller. Failure: nullptr is returned.
Constraints
- The prerequisite for successful reshape is that the shape size of x must be the same as that of shape. For example, if the shape of A is (1, 3, 256, 256), the shape size of A is 1 x 3 x 256 x 256.
- Currently, this API cannot reshape a tensor into an empty tensor. An empty tensor is a tensor whose shape contains 0.
Example
1 2 3 4 |
void Func(const aclTensor *x, const op::Shape &shape, aclOpExecutor *executor) { auto ret = l0op::Reshape(x, shape, executor); return; } |
Parent topic: Basic Kernel Function APIs