Compute Library
 21.08
AclUtils.h File Reference

Go to the source code of this file.

Functions

AclStatus AclGetTensorSize (AclTensor tensor, uint64_t *size)
 __cplusplus More...
 
AclStatus AclGetTensorDescriptor (AclTensor tensor, AclTensorDescriptor *desc)
 Get the descriptor of this tensor. More...
 

Function Documentation

◆ AclGetTensorDescriptor()

AclStatus AclGetTensorDescriptor ( AclTensor  tensor,
AclTensorDescriptor desc 
)

Get the descriptor of this tensor.

Parameters
[in]tensorA tensor in interest
[out]descThe descriptor of the tensor
Returns
Status code

Definition at line 175 of file AclTensor.cpp.

References AclInvalidArgument, and ARM_COMPUTE_RETURN_CENUM_ON_FAILURE.

Referenced by Tensor::get_descriptor().

176 {
177  using namespace arm_compute;
178 
179  if(desc == nullptr)
180  {
182  }
183 
184  ITensorV2 *internal_tensor{ nullptr };
185  const auto status = convert_and_validate_tensor(tensor, &internal_tensor);
187 
188  *desc = internal_tensor->get_descriptor();
189  return utils::as_cenum<AclStatus>(status);
190 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
Base class specifying the tensor interface.
Definition: ITensorV2.h:45
Copyright (c) 2017-2021 Arm Limited.
Call failed as invalid argument was passed.
Definition: AclTypes.h:57

◆ AclGetTensorSize()

AclStatus AclGetTensorSize ( AclTensor  tensor,
uint64_t *  size 
)

__cplusplus

Get the size of the existing tensor in byte

Note
The size isn't based on allocated memory, but based on information in its descriptor (dimensions, data type, etc.).
Parameters
[in]tensorA tensor in interest
[out]sizeThe size of the tensor
Returns
Status code

Definition at line 158 of file AclTensor.cpp.

References AclInvalidArgument, and ARM_COMPUTE_RETURN_CENUM_ON_FAILURE.

Referenced by Tensor::get_size().

159 {
160  using namespace arm_compute;
161 
162  if(size == nullptr)
163  {
165  }
166 
167  ITensorV2 *internal_tensor{ nullptr };
168  auto status = convert_and_validate_tensor(tensor, &internal_tensor);
170 
171  *size = internal_tensor->get_size();
172  return utils::as_cenum<AclStatus>(status);
173 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
Base class specifying the tensor interface.
Definition: ITensorV2.h:45
Copyright (c) 2017-2021 Arm Limited.
Call failed as invalid argument was passed.
Definition: AclTypes.h:57