Compute Library
 21.11
Edge Class Referencefinal

Graph Edge. More...

#include <Edge.h>

Public Member Functions

 Edge (EdgeID id, INode *producer, unsigned int producer_idx, INode *consumer, unsigned int consumer_idx, Tensor *tensor)
 Default Constructor. More...
 
EdgeID id () const
 Returns edge id. More...
 
NodeID producer_id () const
 Returns producer node id. More...
 
NodeID consumer_id () const
 Returns sink node id. More...
 
INodeproducer () const
 Returns producer node. More...
 
INodeconsumer () const
 Returns consumer node. More...
 
unsigned int producer_idx () const
 Returns the index of the output that produces the result in the producer node. More...
 
unsigned int consumer_idx () const
 Returns the index of the input that consumes the result in the consumer node. More...
 
Tensortensor () const
 Returns the tensor associated with this edge. More...
 
TensorID tensor_id () const
 Returns the tensor id associated with this edge. More...
 
void update_bound_tensor (Tensor *tensor)
 Bind the edge to another tensor. More...
 

Friends

class Graph
 

Detailed Description

Graph Edge.

Definition at line 39 of file Edge.h.

Constructor & Destructor Documentation

◆ Edge()

Edge ( EdgeID  id,
INode producer,
unsigned int  producer_idx,
INode consumer,
unsigned int  consumer_idx,
Tensor tensor 
)
inline

Default Constructor.

Parameters
[in]idEdge id
[in]producerProducer node id
[in]producer_idxProducer node output index
[in]consumerConsumer node id
[in]consumer_idxConsumer node input index
[in]tensorTensor associated with the edge

Definition at line 51 of file Edge.h.

52  : _id(id), _producer(producer), _consumer(consumer), _producer_idx(producer_idx), _consumer_idx(consumer_idx), _tensor(tensor)
53 
54  {
55  }
unsigned int consumer_idx() const
Returns the index of the input that consumes the result in the consumer node.
Definition: Edge.h:108
INode * consumer() const
Returns consumer node.
Definition: Edge.h:92
Tensor * tensor() const
Returns the tensor associated with this edge.
Definition: Edge.h:116
unsigned int producer_idx() const
Returns the index of the output that produces the result in the producer node.
Definition: Edge.h:100
INode * producer() const
Returns producer node.
Definition: Edge.h:84

Member Function Documentation

◆ consumer()

◆ consumer_id()

NodeID consumer_id ( ) const
inline

Returns sink node id.

Returns
Sink node id

Definition at line 76 of file Edge.h.

References arm_compute::graph::EmptyNodeID, and INode::id().

Referenced by Graph::add_connection(), arm_compute::graph::bfs(), arm_compute::graph::dfs(), arm_compute::graph::detail::fuse_convolution_with_batch_normalization(), arm_compute::graph::detail::fuse_depthwise_convolution_with_batch_normalization(), and arm_compute::graph::detail::fuse_node_with_activation().

77  {
78  return (_consumer == nullptr) ? EmptyNodeID : _consumer->id();
79  }
NodeID id() const
Returns node&#39;s ID.
Definition: INode.cpp:103
constexpr NodeID EmptyNodeID
Constant EdgeID specifying an equivalent of null edge.
Definition: Types.h:76

◆ consumer_idx()

unsigned int consumer_idx ( ) const
inline

Returns the index of the input that consumes the result in the consumer node.

Returns
Consumer node input index

Definition at line 108 of file Edge.h.

Referenced by Graph::add_connection().

109  {
110  return _consumer_idx;
111  }

◆ id()

EdgeID id ( ) const
inline

Returns edge id.

Returns
Edge id

Definition at line 60 of file Edge.h.

Referenced by Graph::add_connection().

61  {
62  return _id;
63  }

◆ producer()

◆ producer_id()

NodeID producer_id ( ) const
inline

Returns producer node id.

Returns
Producer node id

Definition at line 68 of file Edge.h.

References arm_compute::graph::EmptyNodeID, and INode::id().

Referenced by Graph::add_connection(), arm_compute::graph::detail::all_inputs_are_visited(), arm_compute::graph::detail::fuse_convolution_with_batch_normalization(), arm_compute::graph::detail::fuse_depthwise_convolution_with_batch_normalization(), and arm_compute::graph::detail::fuse_node_with_activation().

69  {
70  return (_producer == nullptr) ? EmptyNodeID : _producer->id();
71  }
NodeID id() const
Returns node&#39;s ID.
Definition: INode.cpp:103
constexpr NodeID EmptyNodeID
Constant EdgeID specifying an equivalent of null edge.
Definition: Types.h:76

◆ producer_idx()

unsigned int producer_idx ( ) const
inline

Returns the index of the output that produces the result in the producer node.

Returns
Producer node output index

Definition at line 100 of file Edge.h.

Referenced by Graph::add_connection().

101  {
102  return _producer_idx;
103  }

◆ tensor()

Tensor* tensor ( ) const
inline

Returns the tensor associated with this edge.

Returns
Tensor id

Definition at line 116 of file Edge.h.

Referenced by arm_compute::graph::detail::fuse_convolution(), INode::input(), InPlaceOperationMutator::mutate(), DepthConcatSubTensorMutator::mutate(), and INode::set_output_tensor().

117  {
118  return _tensor;
119  }

◆ tensor_id()

TensorID tensor_id ( ) const
inline

Returns the tensor id associated with this edge.

Returns
Tensor id

Definition at line 124 of file Edge.h.

References Tensor::id(), and arm_compute::graph::NullTensorID.

Referenced by INode::input_id().

125  {
126  return (_tensor == nullptr) ? NullTensorID : _tensor->id();
127  }
TensorID id() const
Tensor ID accessor.
Definition: Tensor.cpp:35
constexpr TensorID NullTensorID
Constant NodeID specifying an equivalent of null node.
Definition: Types.h:74

◆ update_bound_tensor()

void update_bound_tensor ( Tensor tensor)
inline

Bind the edge to another tensor.

Note
If tensor is nullptr then nothing happens
Parameters
[in]tensorTensor to bind the edge to

Definition at line 134 of file Edge.h.

135  {
136  _tensor = (tensor != nullptr) ? tensor : _tensor;
137  }
Tensor * tensor() const
Returns the tensor associated with this edge.
Definition: Edge.h:116

Friends And Related Function Documentation

◆ Graph

friend class Graph
friend

Definition at line 140 of file Edge.h.


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