Compute Library
TensorPack Class Reference

Tensor pack class. More...

#include <Acl.hpp>

Collaboration diagram for TensorPack:

Data Structures

struct  PackPair
 Pack pair construct. More...

Public Member Functions

 TensorPack (Context &ctx, StatusCode *status=nullptr)
 Constructor. More...
StatusCode add (Tensor &tensor, int32_t slot_id)
 Add tensor to tensor pack. More...
StatusCode add (std::initializer_list< PackPair > packed)
 Add a list of tensors to a tensor pack. More...
- Public Member Functions inherited from ObjectBase< AclTensorPack_ >
 ~ObjectBase ()=default
 Destructor. More...
 ObjectBase (const ObjectBase< AclTensorPack_ > &)=default
 Copy constructor. More...
 ObjectBase (ObjectBase< AclTensorPack_ > &&)=default
 Move Constructor. More...
ObjectBase< AclTensorPack_ > & operator= (const ObjectBase< AclTensorPack_ > &)=default
 Copy assignment operator. More...
ObjectBase< AclTensorPack_ > & operator= (ObjectBase< AclTensorPack_ > &&)=default
 Move assignment operator. More...
void reset (AclTensorPack_ *val)
 Reset object value. More...
const AclTensorPack_get () const
 Access uderlying object. More...
AclTensorPack_get ()
 Access uderlying object. More...

Detailed Description

Tensor pack class.

Pack is a utility construct that is used to create a collection of tensors that can then be passed into operator as inputs.

Definition at line 684 of file Acl.hpp.

Constructor & Destructor Documentation

◆ TensorPack()

TensorPack ( Context ctx,
StatusCode status = nullptr 


[in]ctxContext from where the tensor pack will be created from
[out]statusStatus information if requested

Definition at line 710 of file Acl.hpp.

References AclCreateTensorPack(), ObjectBase< T >::get(), and arm_compute::test::validation::pack.

711  {
713  const auto st = detail::as_enum<StatusCode>(AclCreateTensorPack(&pack, ctx.get()));
714  reset(pack);
715  report_status(st, "[Compute Library] Failure during tensor pack creation");
716  if(status)
717  {
718  *status = st;
719  }
720  }
AclStatus AclCreateTensorPack(AclTensorPack *pack, AclContext ctx)
Creates a tensor pack.
void reset(AclTensorPack_ *val)
Reset object value.
Definition: Acl.hpp:148

Member Function Documentation

◆ add() [1/2]

StatusCode add ( Tensor tensor,
int32_t  slot_id 

Add tensor to tensor pack.

[in]slot_idSlot id of the tensor in respect with the operator
[in]tensorTensor to be added in the pack
Status code

Definition at line 728 of file Acl.hpp.

References AclPackTensor(), and ObjectBase< T >::get().

Referenced by arm_compute::test::validation::TEST_CASE().

729  {
730  return detail::as_enum<StatusCode>(AclPackTensor(_object.get(), tensor.get(), slot_id));
731  }
AclStatus AclPackTensor(AclTensorPack pack, AclTensor tensor, int32_t slot_id)
Add a tensor to a tensor pack.

◆ add() [2/2]

StatusCode add ( std::initializer_list< PackPair packed)

Add a list of tensors to a tensor pack.

[in]packedPair packs to be added
Status code

Definition at line 738 of file Acl.hpp.

References AclPackTensors().

739  {
740  const size_t size = packed.size();
741  std::vector<int32_t> slots(size);
742  std::vector<AclTensor> tensors(size);
743  int i = 0;
744  for(auto &p : packed)
745  {
746  slots[i] = p.slot_id;
747  tensors[i] = AclTensor(p.tensor);
748  ++i;
749  }
750  return detail::as_enum<StatusCode>(AclPackTensors(_object.get(),,, size));
751  }
struct AclTensor_ * AclTensor
Opaque Tensor pack object.
Definition: AclTypes.h:39
AclStatus AclPackTensors(AclTensorPack pack, AclTensor *tensors, int32_t *slot_ids, size_t num_tensors)
A list of tensors to a tensor pack.

The documentation for this class was generated from the following file: