Compute Library
 21.11
arm_compute::experimental Namespace Reference

Data Structures

class  CLLogicalAnd
 
class  CLLogicalOr
 
class  CLSlice
 Basic function to perform tensor slicing. More...
 
class  CLStridedSlice
 Basic function to run CLStridedSliceKernel. More...
 
class  ICLOperator
 Basic interface for functions which have a single async CL kernel. More...
 
class  INEOperator
 Basic interface for functions which have a single async CPU kernel. More...
 
class  IOperator
 Base class for all async functions. More...
 
struct  IPostOp
 An elementwise n-ary operation that can be appended to and fused with (at kernel-level) other operators It contains: More...
 
struct  MemoryInfo
 
class  NESlice
 Basic function to perform tensor slicing. More...
 
class  NEStridedSlice
 Basic function to run NEStridedSliceKernel. More...
 
class  OperatorTensor
 Basic implementation of the tensor interface. More...
 
struct  PostOpAct
 (EXPERIMENTAL_POST_OPS) Implementation of specific IPostOps More...
 
class  PostOpCLKernelUtils
 Manage validation, building and configurations of PostOp CL kernels. More...
 
struct  PostOpEltwiseAdd
 
struct  PostOpEltwisePRelu
 
class  PostOpList
 A sequence of PostOps that can be appended to the end of other operators. More...
 

Typedefs

using PostOpTypeSequence = std::vector< PostOpType >
 An ordered sequence of type of Post Ops. More...
 
using MemoryRequirements = std::vector< MemoryInfo >
 

Enumerations

enum  PostOpType { Activation, Eltwise_Add, Eltwise_PRelu }
 Type of Post Op. More...
 
enum  MemoryLifetime { Temporary = 0, Persistent = 1, Prepare = 2 }
 
enum  MemoryType { CPU, CL }
 Memory type. More...
 

Functions

template<typename FromTensorT , typename ToTensorT >
PostOpList< ToTensorT > transform_post_op_list_arguments (const PostOpList< FromTensorT > &post_ops, std::function< ToTensorT(FromTensorT)> transform_arg)
 Transform a PostOpList of type FromTensorT to one of type ToTensorT. More...
 
TensorType get_post_op_arg_type (size_t index)
 Get post op argument TensorType from post op argument index in a flattened, ordered post op argument list. More...
 
template<typename T >
PostOpTypeSequence get_post_op_sequence (const PostOpList< T > &post_ops)
 Get a sequence of PostOp Types from PostOpList. More...
 

Typedef Documentation

◆ MemoryRequirements

using MemoryRequirements = std::vector<MemoryInfo>

Definition at line 132 of file Types.h.

◆ PostOpTypeSequence

using PostOpTypeSequence = std::vector<PostOpType>

An ordered sequence of type of Post Ops.

Definition at line 43 of file IPostOp.h.

Enumeration Type Documentation

◆ MemoryLifetime

enum MemoryLifetime
strong

◆ MemoryType

enum MemoryType
strong

Memory type.

Enumerator
CPU 
CL 

Definition at line 34 of file Types.h.

◆ PostOpType

enum PostOpType
strong

Type of Post Op.

Enumerator
Activation 
Eltwise_Add 
Eltwise_PRelu 

Definition at line 36 of file IPostOp.h.

37 {
38  Activation,
41 };
arm_compute::ActivationLayerInfo::ActivationFunction Activation
Constant TensorID specifying an equivalent of null tensor.
Definition: Types.h:73

Function Documentation

◆ get_post_op_arg_type()

TensorType arm_compute::experimental::get_post_op_arg_type ( size_t  index)
inline

Get post op argument TensorType from post op argument index in a flattened, ordered post op argument list.

Definition at line 79 of file PostOpUtils.h.

References ARM_COMPUTE_ERROR_ON_MSG, arm_compute::EXPERIMENTAL_ACL_POST_OP_ARG_FIRST, and arm_compute::EXPERIMENTAL_ACL_POST_OP_ARG_LAST.

Referenced by CLGEMMConvolutionLayer::configure(), CLConvolutionLayer::configure(), ClGemmMatrixMultiplyNativeKernel::run_op(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::run_op(), and ClGemmMatrixMultiplyReshapedKernel::run_op().

80 {
81  ARM_COMPUTE_ERROR_ON_MSG(static_cast<int>(index) > EXPERIMENTAL_ACL_POST_OP_ARG_LAST - EXPERIMENTAL_ACL_POST_OP_ARG_FIRST, "Post Op argument index is out of range");
82  return static_cast<TensorType>(EXPERIMENTAL_ACL_POST_OP_ARG_FIRST + static_cast<int>(index));
83 }
TensorType
Memory type.
Definition: Types.h:38
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456

◆ get_post_op_sequence()

PostOpTypeSequence arm_compute::experimental::get_post_op_sequence ( const PostOpList< T > &  post_ops)

Get a sequence of PostOp Types from PostOpList.

Definition at line 87 of file PostOpUtils.h.

References PostOpList< TensorRelatedT >::get_list().

Referenced by PostOpCLKernelUtils::is_post_op_sequence_supported(), PostOpCLKernelUtils::set_post_ops_cl_build_options(), and PostOpCLKernelUtils::set_post_ops_cl_kernel_name().

88 {
89  PostOpTypeSequence post_op_sequence;
90  for(const auto &op : post_ops.get_list())
91  {
92  post_op_sequence.push_back(op->type());
93  }
94  return post_op_sequence;
95 }
experimental::PostOpList< ITensorInfo * > post_ops
std::vector< PostOpType > PostOpTypeSequence
An ordered sequence of type of Post Ops.
Definition: IPostOp.h:43

◆ transform_post_op_list_arguments()

PostOpList<ToTensorT> arm_compute::experimental::transform_post_op_list_arguments ( const PostOpList< FromTensorT > &  post_ops,
std::function< ToTensorT(FromTensorT)>  transform_arg 
)

Transform a PostOpList of type FromTensorT to one of type ToTensorT.

Definition at line 42 of file PostOpUtils.h.

References Activation, ARM_COMPUTE_ERROR, Eltwise_Add, Eltwise_PRelu, and PostOpList< TensorRelatedT >::get_list().

43 {
44  PostOpList<ToTensorT> transformed_post_ops;
45  int op_idx = 0;
46  for(const auto &post_op : post_ops.get_list())
47  {
48  switch(post_op->type())
49  {
51  {
52  const auto _post_op = utils::cast::polymorphic_downcast<const PostOpAct<FromTensorT> *>(post_op.get());
53  transformed_post_ops.template push_back_op<PostOpAct<ToTensorT>>(_post_op->_act_info);
54  break;
55  }
56  case PostOpType::Eltwise_Add:
57  {
58  const auto _post_op = utils::cast::polymorphic_downcast<const PostOpEltwiseAdd<FromTensorT> *>(post_op.get());
59  transformed_post_ops.template push_back_op<PostOpEltwiseAdd<ToTensorT>>(transform_arg(_post_op->_addend), _post_op->_prev_dst_pos, _post_op->_policy);
60  break;
61  }
62  case PostOpType::Eltwise_PRelu:
63  {
64  const auto _post_op = utils::cast::polymorphic_downcast<const PostOpEltwisePRelu<FromTensorT> *>(post_op.get());
65  transformed_post_ops.template push_back_op<PostOpEltwisePRelu<ToTensorT>>(transform_arg(_post_op->_alpha_param), _post_op->_prev_dst_pos, _post_op->_policy);
66  break;
67  }
68  default:
69  {
70  ARM_COMPUTE_ERROR("Unsupported PostOpType");
71  }
72  }
73  ++op_idx;
74  }
75  return transformed_post_ops;
76 }
experimental::PostOpList< ITensorInfo * > post_ops
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
arm_compute::ActivationLayerInfo::ActivationFunction Activation
Constant TensorID specifying an equivalent of null tensor.
Definition: Types.h:73