Compute Library  18.05
arm_compute::graph Namespace Reference

Namespaces

 backends
 
 detail
 
 frontend
 

Data Structures

class  ActivationLayerNode
 Activation Layer node. More...
 
class  BatchNormalizationLayerNode
 Batch Normalization Layer node. More...
 
class  ConstNode
 Const node. More...
 
class  ConvolutionLayerNode
 Convolution Layer node. More...
 
class  DefaultNodeVisitor
 Default visitor implementation. More...
 
class  DepthConcatenateLayerNode
 Depth Concatenation Layer node. More...
 
class  DepthConcatSubTensorMutator
 Mutation pass to optimize depth concatenation operations by using sub-tensors. More...
 
class  DepthwiseConvolutionLayerNode
 Depthwise Convolution Layer node. More...
 
class  DotGraphPrinter
 Graph printer interface. More...
 
class  DotGraphVisitor
 Graph printer visitor. More...
 
class  Edge
 Graph Edge. More...
 
class  EltwiseLayerNode
 Eltwise Layer node. More...
 
struct  ExecutionTask
 Execution task. More...
 
struct  ExecutionWorkload
 Execution workload. More...
 
class  FlattenLayerNode
 Flatten Layer node. More...
 
class  FullyConnectedLayerNode
 Fully Connected Layer node. More...
 
class  Graph
 Graph class. More...
 
class  GraphBuilder
 Graph builder class. More...
 
struct  GraphConfig
 Graph configuration structure Device target types. More...
 
class  GraphContext
 Graph context. More...
 
class  GraphManager
 Graph manager class. More...
 
class  IGraphMutator
 Graph mutator interface. More...
 
class  IGraphPrinter
 Graph printer interface. More...
 
class  INode
 Node interface. More...
 
class  INodeVisitor
 Node visitor interface. More...
 
class  InPlaceOperationMutator
 Mutation pass to optimize operations that can be performed in-place. More...
 
class  InputNode
 Input Layer node. More...
 
class  ITensorAccessor
 Tensor accessor interface. More...
 
class  ITensorHandle
 Tensor handle interface object. More...
 
struct  MemoryManagerContext
 Contains structs required for memory management. More...
 
class  NodeFusionMutator
 Mutation pass to fuss nodes. More...
 
struct  NodeIdxPair
 NodeID-index struct. More...
 
struct  NodeParams
 Common node parameters. More...
 
class  NormalizationLayerNode
 Normalization Layer node. More...
 
class  OutputNode
 Output Layer node. More...
 
class  PassManager
 Pass manager. More...
 
class  PoolingLayerNode
 Pooling Layer node. More...
 
class  ReshapeLayerNode
 Reshape Layer node. More...
 
class  SoftmaxLayerNode
 Softmax Layer node. More...
 
class  SplitLayerNode
 Split Layer node. More...
 
class  SplitLayerSubTensorMutator
 Mutation pass to optimize split operations by using sub-tensors. More...
 
class  TaskExecutor
 Task executor. More...
 
class  Tensor
 Tensor object. More...
 
struct  TensorDescriptor
 Tensor metadata class. More...
 

Typedefs

using ITensorAccessorUPtr = std::unique_ptr< ITensorAccessor >
 
using TensorID = unsigned int
 
using NodeID = unsigned int
 
using EdgeID = unsigned int
 
using Activation = arm_compute::ActivationLayerInfo::ActivationFunction
 GraphID strong type. More...
 
using GraphID = strong_type::StrongType< unsigned int, struct graph_id_t, strong_type::Comparable >
 Constant TensorID specifying an equivalent of null tensor. More...
 

Enumerations

enum  Target { UNSPECIFIED, NEON, CL, GC }
 
enum  EltwiseOperation { ADD, SUB, MUL }
 Supported Element-wise operations. More...
 
enum  ConvolutionMethod { DEFAULT, GEMM, DIRECT, WINOGRAD }
 Supported Convolution layer methods. More...
 
enum  DepthwiseConvolutionMethod { DEFAULT, GEMV, OPTIMIZED_3x3 }
 Supported Depthwise Convolution layer methods. More...
 
enum  FastMathHint { ENABLED, DISABLED }
 Enable or disable fast math for Convolution layer. More...
 
enum  NodeType {
  ActivationLayer, BatchNormalizationLayer, ConvolutionLayer, DepthConcatenateLayer,
  DepthwiseConvolutionLayer, EltwiseLayer, FlattenLayer, FullyConnectedLayer,
  NormalizationLayer, PoolingLayer, ReshapeLayer, ScaleLayer,
  SoftmaxLayer, SplitLayer, Input, Output,
  Const
}
 Supported nodes. More...
 
enum  MemoryManagerAffinity { Buffer, Offset }
 Backend Memory Manager affinity. More...
 

Functions

std::vector< NodeIDbfs (Graph &g)
 Breadth first search traversal. More...
 
template<typename T >
inline::std::ostream & operator<< (::std::ostream &os, const arm_compute::Dimensions< T > &dimensions)
 Formatted output of the Dimensions type. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const Size2D &size)
 Formatted output of the Size2D type. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const DataType &data_type)
 Formatted output of the DataType type. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const Target &target)
 Formatted output of the Target. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const DataLayout &data_layout)
 Formatted output of the DataLayout. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
 Formatted output of the activation function type. More...
 
std::string to_string (const ActivationLayerInfo::ActivationFunction &act_function)
 
inline::std::ostream & operator<< (::std::ostream &os, const PoolingType &pool_type)
 Formatted output of the PoolingType type. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const NormType &norm_type)
 Formatted output of the NormType type. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const EltwiseOperation &eltwise_op)
 Formatted output of the EltwiseOperation type. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const ConvolutionMethod &method)
 Formatted output of the ConvolutionMethod type. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const FastMathHint &hint)
 Formatted output of the FastMathHint type. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const DepthwiseConvolutionMethod &method)
 Formatted output of the DepthwiseConvolutionMethod type. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const PadStrideInfo &pad_stride_info)
 Formatted output of the PadStrideInfo type. More...
 
inline::std::ostream & operator<< (::std::ostream &os, const QuantizationInfo &quantization_info)
 Formatted output of the QuantizationInfo type. More...
 
TensorDescriptor get_tensor_descriptor (const Graph &g, TensorID tid)
 Returns the tensor descriptor of a given tensor. More...
 
Status set_tensor_accessor (Tensor *tensor, std::unique_ptr< ITensorAccessor > accessor)
 Sets an accessor on a given tensor. More...
 
bool is_target_supported (Target target)
 Checks if a specific target is supported. More...
 
Target get_default_target ()
 Returns default target for execution. More...
 
void force_target_to_graph (Graph &g, Target target)
 Forces a single target to all graph constructs. More...
 
PassManager create_default_pass_manager (Target target)
 Creates a default PassManager. More...
 
void setup_default_graph_context (GraphContext &ctx)
 Default setups the graph context if not done manually. More...
 
size_t get_dimension_size (const TensorDescriptor &descriptor, const DataLayoutDimension data_layout_dimension)
 Get size of a tensor's given dimension depending on its layout. More...
 
size_t get_dimension_idx (const TensorDescriptor &descriptor, const DataLayoutDimension data_layout_dimension)
 Get index of a tensor's given dimension depending on its layout. More...
 
void execute_task (ExecutionTask &task)
 

Variables

constexpr TensorID NullTensorID = std::numeric_limits<TensorID>::max()
 Constant NodeID specifying an equivalent of null node. More...
 
constexpr NodeID EmptyNodeID = std::numeric_limits<NodeID>::max()
 Constant EdgeID specifying an equivalent of null edge. More...
 
constexpr EdgeID EmptyEdgeID = std::numeric_limits<EdgeID>::max()
 

Typedef Documentation

GraphID strong type.

Definition at line 61 of file Types.h.

using EdgeID = unsigned int

Definition at line 58 of file Types.h.

using GraphID = strong_type::StrongType<unsigned int, struct graph_id_t, strong_type::Comparable>

Constant TensorID specifying an equivalent of null tensor.

Definition at line 64 of file Types.h.

using ITensorAccessorUPtr = std::unique_ptr<ITensorAccessor>

Definition at line 50 of file ITensorAccessor.h.

using NodeID = unsigned int

Definition at line 57 of file Types.h.

using TensorID = unsigned int

Definition at line 56 of file Types.h.

Enumeration Type Documentation

enum ConvolutionMethod
strong

Supported Convolution layer methods.

Enumerator
DEFAULT 

Default approach using internal heuristics.

GEMM 

GEMM based convolution.

DIRECT 

Deep direct convolution.

WINOGRAD 

Winograd based convolution.

Definition at line 101 of file Types.h.

102 {
103  DEFAULT,
104  GEMM,
105  DIRECT,
106  WINOGRAD
107 };
Default approach using internal heuristics.
Convolution using Winograd.
Convolution using GEMM.

Supported Depthwise Convolution layer methods.

Enumerator
DEFAULT 

Default approach using internal heuristics.

GEMV 

Generic GEMV based depthwise convolution.

OPTIMIZED_3x3 

Optimized 3x3 direct depthwise convolution.

Definition at line 110 of file Types.h.

111 {
112  DEFAULT,
113  GEMV,
114  OPTIMIZED_3x3,
115 };
Optimized 3x3 direct depthwise convolution.
Default approach using internal heuristics.
Generic GEMV based depthwise convolution.
enum EltwiseOperation
strong

Supported Element-wise operations.

Enumerator
ADD 

Arithmetic addition.

SUB 

Arithmetic subtraction.

MUL 

Arithmetic multiplication.

Definition at line 93 of file Types.h.

94 {
95  ADD,
96  SUB,
97  MUL
98 };
#define ADD(x, y)
#define SUB(x, y)
enum FastMathHint
strong

Enable or disable fast math for Convolution layer.

Enumerator
ENABLED 

Fast math enabled for Convolution layer.

DISABLED 

Fast math disabled for Convolution layer.

Definition at line 118 of file Types.h.

119 {
120  ENABLED,
121  DISABLED,
122 };
Fast math disabled for Convolution layer.
Fast math enabled for Convolution layer.
enum MemoryManagerAffinity
strong

Backend Memory Manager affinity.

Enumerator
Buffer 

Affinity at buffer level.

Offset 

Affinity at offset level.

Definition at line 148 of file Types.h.

149 {
150  Buffer,
151  Offset
152 };
enum NodeType
strong

Supported nodes.

Enumerator
ActivationLayer 
BatchNormalizationLayer 
ConvolutionLayer 
DepthConcatenateLayer 
DepthwiseConvolutionLayer 
EltwiseLayer 
FlattenLayer 
FullyConnectedLayer 
NormalizationLayer 
PoolingLayer 
ReshapeLayer 
ScaleLayer 
SoftmaxLayer 
SplitLayer 
Input 
Output 
Const 

Definition at line 125 of file Types.h.

enum Target
strong
Enumerator
UNSPECIFIED 

Unspecified Target.

NEON 

NEON capable target device.

CL 

OpenCL capable target device.

GC 

GLES compute capable target device.

Definition at line 84 of file Types.h.

85 {
86  UNSPECIFIED,
87  NEON,
88  CL,
89  GC,
90 };
NEON capable target device.
GLES compute capable target device.
OpenCL capable target device.

Function Documentation

std::vector<NodeID> arm_compute::graph::bfs ( Graph g)
inline

Breadth first search traversal.

Parameters
gGraph to traverse
Returns
A vector with the node id traversal order

Definition at line 77 of file BFS.h.

References arm_compute::graph::detail::all_inputs_are_visited(), ARM_COMPUTE_ERROR_ON, Edge::consumer(), Edge::consumer_id(), Graph::edge(), EmptyNodeID, Graph::inputs(), Graph::node(), Graph::nodes(), and INode::output_edges().

78 {
79  std::vector<NodeID> bfs_order_vector;
80 
81  // Created visited vector
82  std::vector<bool> visited(g.nodes().size(), false);
83 
84  // Create BFS queue
85  std::list<NodeID> queue;
86 
87  // Push inputs and mark as visited
88  for(auto &input : g.inputs())
89  {
90  if(input != EmptyNodeID)
91  {
92  visited[input] = true;
93  queue.push_back(input);
94  }
95  }
96 
97  // Iterate over vector and edges
98  while(!queue.empty())
99  {
100  // Dequeue a node from queue and process
101  NodeID n = queue.front();
102  bfs_order_vector.push_back(n);
103  queue.pop_front();
104 
105  const INode *node = g.node(n);
106  ARM_COMPUTE_ERROR_ON(node == nullptr);
107  for(const auto &eid : node->output_edges())
108  {
109  const Edge *e = g.edge(eid);
110  ARM_COMPUTE_ERROR_ON(e == nullptr);
111  if(!visited[e->consumer_id()] && detail::all_inputs_are_visited(e->consumer(), visited))
112  {
113  visited[e->consumer_id()] = true;
114  queue.push_back(e->consumer_id());
115  }
116  }
117  }
118 
119  return bfs_order_vector;
120 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:328
unsigned int NodeID
Definition: Types.h:57
constexpr NodeID EmptyNodeID
Constant EdgeID specifying an equivalent of null edge.
Definition: Types.h:67
bool all_inputs_are_visited(const INode *node, const std::vector< bool > &visited)
Checks if all the input dependencies of a node have been visited.
Definition: BFS.h:45
PassManager arm_compute::graph::create_default_pass_manager ( Target  target)

Creates a default PassManager.

Parameters
[in]targetTarget to create the pass manager for
Returns
A PassManager with default mutating passes

Referenced by set_tensor_accessor().

void arm_compute::graph::execute_task ( ExecutionTask task)
void arm_compute::graph::force_target_to_graph ( Graph g,
Target  target 
)

Forces a single target to all graph constructs.

Parameters
[in]gGraph to force target on
[in]targetTarget to force

Referenced by set_tensor_accessor().

Target arm_compute::graph::get_default_target ( )

Returns default target for execution.

Note
If an OpenCL backend exists then OpenCL is returned, else if the NEON backend exists returns NEON as target. If no backends are registered an error is raised.
Returns
Default target

Referenced by set_tensor_accessor().

size_t arm_compute::graph::get_dimension_idx ( const TensorDescriptor descriptor,
const DataLayoutDimension  data_layout_dimension 
)

Get index of a tensor's given dimension depending on its layout.

Parameters
[in]descriptorDescriptor
[in]data_layout_dimensionTensor data layout dimension
Returns
Idx of given dimension

Referenced by set_tensor_accessor().

size_t arm_compute::graph::get_dimension_size ( const TensorDescriptor descriptor,
const DataLayoutDimension  data_layout_dimension 
)

Get size of a tensor's given dimension depending on its layout.

Parameters
[in]descriptorDescriptor
[in]data_layout_dimensionTensor data layout dimension
Returns
Size of requested dimension

Referenced by set_tensor_accessor().

TensorDescriptor arm_compute::graph::get_tensor_descriptor ( const Graph g,
TensorID  tid 
)
inline

Returns the tensor descriptor of a given tensor.

Parameters
[in]gGraph that the tensor belongs to
[in]tidTensor ID
Returns
Tensor descriptor if tensor was found else empty descriptor

Definition at line 44 of file Utils.h.

References Tensor::desc(), and Graph::tensor().

45 {
46  const Tensor *tensor = g.tensor(tid);
47  return (tensor != nullptr) ? tensor->desc() : TensorDescriptor();
48 }
bool arm_compute::graph::is_target_supported ( Target  target)

Checks if a specific target is supported.

Parameters
[in]targetTarget to check
Returns
True if target is support else false

Referenced by set_tensor_accessor().

inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const arm_compute::Dimensions< T > &  dimensions 
)

Formatted output of the Dimensions type.

Definition at line 37 of file TypePrinter.h.

38 {
39  if(dimensions.num_dimensions() > 0)
40  {
41  os << dimensions[0];
42 
43  for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
44  {
45  os << "x" << dimensions[d];
46  }
47  }
48 
49  return os;
50 }
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
Definition: Dimensions.h:122
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const Size2D size 
)

Formatted output of the Size2D type.

Definition at line 53 of file TypePrinter.h.

References Size2D::height, and Size2D::width.

54 {
55  os << size.width << "x" << size.height;
56 
57  return os;
58 }
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const DataType data_type 
)

Formatted output of the DataType type.

Definition at line 61 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, arm_compute::F16, arm_compute::F32, arm_compute::F64, arm_compute::QASYMM8, arm_compute::QS16, arm_compute::QS8, arm_compute::S16, arm_compute::S32, arm_compute::S64, arm_compute::S8, arm_compute::SIZET, arm_compute::U16, arm_compute::U32, arm_compute::U64, arm_compute::U8, and arm_compute::UNKNOWN.

62 {
63  switch(data_type)
64  {
65  case DataType::UNKNOWN:
66  os << "UNKNOWN";
67  break;
68  case DataType::U8:
69  os << "U8";
70  break;
71  case DataType::QS8:
72  os << "QS8";
73  break;
74  case DataType::QASYMM8:
75  os << "QASYMM8";
76  break;
77  case DataType::S8:
78  os << "S8";
79  break;
80  case DataType::U16:
81  os << "U16";
82  break;
83  case DataType::S16:
84  os << "S16";
85  break;
86  case DataType::QS16:
87  os << "QS16";
88  break;
89  case DataType::U32:
90  os << "U32";
91  break;
92  case DataType::S32:
93  os << "S32";
94  break;
95  case DataType::U64:
96  os << "U64";
97  break;
98  case DataType::S64:
99  os << "S64";
100  break;
101  case DataType::F16:
102  os << "F16";
103  break;
104  case DataType::F32:
105  os << "F32";
106  break;
107  case DataType::F64:
108  os << "F64";
109  break;
110  case DataType::SIZET:
111  os << "SIZET";
112  break;
113  default:
114  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
115  }
116 
117  return os;
118 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:260
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const Target target 
)

Formatted output of the Target.

Definition at line 121 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, CL, NEON, and UNSPECIFIED.

122 {
123  switch(target)
124  {
125  case Target::UNSPECIFIED:
126  os << "UNSPECIFIED";
127  break;
128  case Target::NEON:
129  os << "NEON";
130  break;
131  case Target::CL:
132  os << "CL";
133  break;
134  default:
135  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
136  }
137 
138  return os;
139 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:260
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const DataLayout data_layout 
)

Formatted output of the DataLayout.

Definition at line 142 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, arm_compute::NCHW, and arm_compute::NHWC.

143 {
144  switch(data_layout)
145  {
146  case DataLayout::NCHW:
147  os << "NCHW";
148  break;
149  case DataLayout::NHWC:
150  os << "NHWC";
151  break;
152  default:
153  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
154  }
155 
156  return os;
157 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:260
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const ActivationLayerInfo::ActivationFunction act_function 
)

Formatted output of the activation function type.

Definition at line 160 of file TypePrinter.h.

References ActivationLayerInfo::ABS, ARM_COMPUTE_ERROR, ActivationLayerInfo::BOUNDED_RELU, ActivationLayerInfo::LEAKY_RELU, ActivationLayerInfo::LINEAR, ActivationLayerInfo::LOGISTIC, ActivationLayerInfo::LU_BOUNDED_RELU, ActivationLayerInfo::RELU, ActivationLayerInfo::SOFT_RELU, ActivationLayerInfo::SQRT, ActivationLayerInfo::SQUARE, and ActivationLayerInfo::TANH.

161 {
162  switch(act_function)
163  {
164  case ActivationLayerInfo::ActivationFunction::ABS:
165  os << "ABS";
166  break;
167  case ActivationLayerInfo::ActivationFunction::LINEAR:
168  os << "LINEAR";
169  break;
170  case ActivationLayerInfo::ActivationFunction::LOGISTIC:
171  os << "LOGISTIC";
172  break;
173  case ActivationLayerInfo::ActivationFunction::RELU:
174  os << "RELU";
175  break;
176  case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
177  os << "BOUNDED_RELU";
178  break;
179  case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
180  os << "LEAKY_RELU";
181  break;
182  case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
183  os << "SOFT_RELU";
184  break;
185  case ActivationLayerInfo::ActivationFunction::SQRT:
186  os << "SQRT";
187  break;
188  case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
189  os << "LU_BOUNDED_RELU";
190  break;
191  case ActivationLayerInfo::ActivationFunction::SQUARE:
192  os << "SQUARE";
193  break;
194  case ActivationLayerInfo::ActivationFunction::TANH:
195  os << "TANH";
196  break;
197  default:
198  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
199  }
200 
201  return os;
202 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:260
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const PoolingType pool_type 
)

Formatted output of the PoolingType type.

Definition at line 212 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, arm_compute::AVG, arm_compute::L2, and arm_compute::MAX.

213 {
214  switch(pool_type)
215  {
216  case PoolingType::AVG:
217  os << "AVG";
218  break;
219  case PoolingType::MAX:
220  os << "MAX";
221  break;
222  case PoolingType::L2:
223  os << "L2";
224  break;
225  default:
226  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
227  }
228 
229  return os;
230 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:260
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const NormType norm_type 
)

Formatted output of the NormType type.

Definition at line 233 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, arm_compute::CROSS_MAP, arm_compute::IN_MAP_1D, and arm_compute::IN_MAP_2D.

234 {
235  switch(norm_type)
236  {
237  case NormType::CROSS_MAP:
238  os << "CROSS_MAP";
239  break;
240  case NormType::IN_MAP_1D:
241  os << "IN_MAP_1D";
242  break;
243  case NormType::IN_MAP_2D:
244  os << "IN_MAP_2D";
245  break;
246  default:
247  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
248  }
249 
250  return os;
251 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:260
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const EltwiseOperation eltwise_op 
)

Formatted output of the EltwiseOperation type.

Definition at line 254 of file TypePrinter.h.

References ADD, ARM_COMPUTE_ERROR, MUL, and SUB.

255 {
256  switch(eltwise_op)
257  {
259  os << "ADD";
260  break;
261  case EltwiseOperation::MUL:
262  os << "MUL";
263  break;
265  os << "SUB";
266  break;
267  default:
268  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
269  }
270 
271  return os;
272 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:260
#define ADD(x, y)
#define SUB(x, y)
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const ConvolutionMethod method 
)

Formatted output of the ConvolutionMethod type.

Definition at line 275 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, DEFAULT, DIRECT, GEMM, and WINOGRAD.

276 {
277  switch(method)
278  {
279  case ConvolutionMethod::DEFAULT:
280  os << "DEFAULT";
281  break;
282  case ConvolutionMethod::DIRECT:
283  os << "DIRECT";
284  break;
285  case ConvolutionMethod::GEMM:
286  os << "GEMM";
287  break;
288  case ConvolutionMethod::WINOGRAD:
289  os << "WINOGRAD";
290  break;
291  default:
292  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
293  }
294 
295  return os;
296 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:260
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const FastMathHint hint 
)

Formatted output of the FastMathHint type.

Definition at line 299 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, DISABLED, and ENABLED.

300 {
301  switch(hint)
302  {
303  case FastMathHint::ENABLED:
304  os << "ENABLED";
305  break;
306  case FastMathHint::DISABLED:
307  os << "DISABLED";
308  break;
309  default:
310  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
311  }
312 
313  return os;
314 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:260
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const DepthwiseConvolutionMethod method 
)

Formatted output of the DepthwiseConvolutionMethod type.

Definition at line 317 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, DEFAULT, GEMV, and OPTIMIZED_3x3.

318 {
319  switch(method)
320  {
321  case DepthwiseConvolutionMethod::DEFAULT:
322  os << "DEFAULT";
323  break;
324  case DepthwiseConvolutionMethod::GEMV:
325  os << "GEMV";
326  break;
327  case DepthwiseConvolutionMethod::OPTIMIZED_3x3:
328  os << "OPTIMIZED_3x3";
329  break;
330  default:
331  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
332  }
333 
334  return os;
335 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:260
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const PadStrideInfo pad_stride_info 
)

Formatted output of the PadStrideInfo type.

Definition at line 338 of file TypePrinter.h.

References PadStrideInfo::pad_bottom(), PadStrideInfo::pad_left(), PadStrideInfo::pad_right(), PadStrideInfo::pad_top(), and PadStrideInfo::stride().

339 {
340  os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
341  os << ";";
342  os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
343  << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
344 
345  return os;
346 }
inline ::std::ostream& arm_compute::graph::operator<< ( ::std::ostream &  os,
const QuantizationInfo quantization_info 
)

Formatted output of the QuantizationInfo type.

Definition at line 349 of file TypePrinter.h.

References QuantizationInfo::offset, and QuantizationInfo::scale.

350 {
351  os << "Scale:" << quantization_info.scale << "~"
352  << "Offset:" << quantization_info.offset;
353  return os;
354 }
Status arm_compute::graph::set_tensor_accessor ( Tensor tensor,
std::unique_ptr< ITensorAccessor accessor 
)
inline

Sets an accessor on a given tensor.

Parameters
[in]tensorTensor to set the accessor to
[in]accessorAccessor to set
Returns
True if accessor was set else false

Definition at line 56 of file Utils.h.

References ARM_COMPUTE_RETURN_ERROR_ON, create_default_pass_manager(), force_target_to_graph(), get_default_target(), get_dimension_idx(), get_dimension_size(), is_target_supported(), Tensor::set_accessor(), and setup_default_graph_context().

57 {
58  ARM_COMPUTE_RETURN_ERROR_ON(tensor == nullptr);
59  tensor->set_accessor(std::move(accessor));
60 
61  return Status{};
62 }
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Definition: Error.h:243
void arm_compute::graph::setup_default_graph_context ( GraphContext ctx)

Default setups the graph context if not done manually.

Parameters
[in]ctxGraph Context

Referenced by set_tensor_accessor().

std::string arm_compute::graph::to_string ( const ActivationLayerInfo::ActivationFunction act_function)
inline

Definition at line 204 of file TypePrinter.h.

205 {
206  std::stringstream str;
207  str << act_function;
208  return str.str();
209 }

Variable Documentation

constexpr EdgeID EmptyEdgeID = std::numeric_limits<EdgeID>::max()

Definition at line 69 of file Types.h.

constexpr NodeID EmptyNodeID = std::numeric_limits<NodeID>::max()

Constant EdgeID specifying an equivalent of null edge.

Definition at line 67 of file Types.h.

Referenced by arm_compute::graph::detail::all_inputs_are_visited(), bfs(), Edge::consumer_id(), BranchLayer::create_layer(), IStream::forward_tail(), and Edge::producer_id().

constexpr TensorID NullTensorID = std::numeric_limits<TensorID>::max()

Constant NodeID specifying an equivalent of null node.

Definition at line 65 of file Types.h.

Referenced by IStream::forward_tail(), and Edge::tensor_id().