Compute Library
 21.05
ROIAlignLayerNode Class Referencefinal

ROI Align node. More...

#include <ROIAlignLayerNode.h>

Collaboration diagram for ROIAlignLayerNode:
[legend]

Public Member Functions

 ROIAlignLayerNode (ROIPoolingLayerInfo &pool_info)
 Constructor. More...
 
 ROIAlignLayerNode (const ROIAlignLayerNode &)=delete
 Prevent instances of this class from being copy constructed. More...
 
ROIAlignLayerNodeoperator= (const ROIAlignLayerNode &)=delete
 Prevent instances of this class from being copied. More...
 
const ROIPoolingLayerInfopooling_info () const
 ROIPoolingLayerInfo accessor. More...
 
NodeType type () const override
 Returns node's type. More...
 
bool forward_descriptors () override
 Forwards descriptor information to outputs if possible. More...
 
TensorDescriptor configure_output (size_t idx) const override
 Calculates output configuration. More...
 
void accept (INodeVisitor &v) override
 Accepts a node visitor. More...
 
- Public Member Functions inherited from INode
 INode ()
 Constructor. More...
 
virtual ~INode ()=default
 Destructor. More...
 
 INode (const INode &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
INodeoperator= (const INode &)=delete
 Prevent instances of this class from being copy assigned (As this class contains pointers) More...
 
 INode (INode &&)=default
 Allow instances of this class to be moved. More...
 
INodeoperator= (INode &&)=default
 Allow instances of this class to be move assigned. More...
 
virtual Status validate () const
 Validate node. More...
 
std::string name () const
 Returns node's name. More...
 
NodeID id () const
 Returns node's ID. More...
 
const Graphgraph () const
 Returns node's Graph. More...
 
Graphgraph ()
 Returns node's Graph. More...
 
void set_graph (Graph *g)
 Sets the graph that this node is registered to. More...
 
void set_id (NodeID id)
 Sets the node id. More...
 
void set_common_node_parameters (NodeParams common_params)
 Sets common node parameters. More...
 
void set_requested_target (Target target)
 Sets target preference. More...
 
void set_assigned_target (Target target)
 Sets the final execution target. More...
 
void set_output_tensor (TensorID tid, size_t idx)
 Sets the output tensor of at a given index. More...
 
const std::vector< TensorID > & inputs () const
 Returns inputs of the node. More...
 
const std::vector< TensorID > & outputs () const
 Returns outputs of the node. More...
 
const std::vector< EdgeID > & input_edges () const
 Returns input edge set. More...
 
const std::set< EdgeID > & output_edges () const
 Returns output edge set. More...
 
TensorID input_id (size_t idx) const
 Returns the tensor ID of a given input of the node. More...
 
TensorID output_id (size_t idx) const
 Returns the tensor ID of a given output of the node. More...
 
Tensorinput (size_t idx) const
 Returns the tensor of a given input of the node. More...
 
Tensoroutput (size_t idx) const
 Returns the tensor of a given output of the node. More...
 
EdgeID input_edge_id (size_t idx) const
 Returns the edge ID of a given input of the node. More...
 
Edgeinput_edge (size_t idx) const
 Returns the edge of a given input of the node. More...
 
size_t num_inputs () const
 Returns number of inputs of the node. More...
 
size_t num_outputs () const
 Returns number of outputs of the node. More...
 
NodeParams common_node_params () const
 Returns common node parameters. More...
 
Target requested_target () const
 Returns requested target for this node. More...
 
Target assigned_target () const
 Returns assigned target for this node. More...
 

Detailed Description

ROI Align node.

Definition at line 36 of file ROIAlignLayerNode.h.

Constructor & Destructor Documentation

◆ ROIAlignLayerNode() [1/2]

Constructor.

Parameters
[in]pool_infoContains pooling operation information described in ROIPoolingLayerInfo.

Definition at line 36 of file ROIAlignLayerNode.cpp.

37  : _pool_info(pool_info)
38 {
39  _input_edges.resize(2, EmptyEdgeID);
40  _outputs.resize(1, NullTensorID);
41 }
constexpr EdgeID EmptyEdgeID
Definition: Types.h:77
constexpr TensorID NullTensorID
Constant NodeID specifying an equivalent of null node.
Definition: Types.h:73

References arm_compute::graph::EmptyEdgeID, and arm_compute::graph::NullTensorID.

◆ ROIAlignLayerNode() [2/2]

ROIAlignLayerNode ( const ROIAlignLayerNode )
delete

Prevent instances of this class from being copy constructed.

Member Function Documentation

◆ accept()

void accept ( INodeVisitor v)
overridevirtual

Accepts a node visitor.

Parameters
[in]vVisitor to accept

Implements INode.

Definition at line 90 of file ROIAlignLayerNode.cpp.

91 {
92  v.visit(*this);
93 }

References INodeVisitor::visit().

◆ configure_output()

TensorDescriptor configure_output ( size_t  idx) const
overridevirtual

Calculates output configuration.

Parameters
[in]idxOutput index to configure
Returns
Output descriptor configuration

Implements INode.

Definition at line 60 of file ROIAlignLayerNode.cpp.

61 {
62  ARM_COMPUTE_UNUSED(idx);
63  ARM_COMPUTE_ERROR_ON(idx >= _outputs.size());
64 
65  const Tensor *src = input(0);
66  const Tensor *rois = input(1);
67  ARM_COMPUTE_ERROR_ON(src == nullptr);
68  ARM_COMPUTE_ERROR_ON(rois == nullptr);
69 
70  TensorDescriptor output_desc = src->desc();
71 
72  const size_t idx_n = get_data_layout_dimension_index(output_desc.layout, DataLayoutDimension::BATCHES);
73  const size_t idx_c = get_data_layout_dimension_index(output_desc.layout, DataLayoutDimension::CHANNEL);
74  const size_t idx_h = get_data_layout_dimension_index(output_desc.layout, DataLayoutDimension::HEIGHT);
75  const size_t idx_w = get_data_layout_dimension_index(output_desc.layout, DataLayoutDimension::WIDTH);
76 
77  output_desc.shape.set(idx_n, rois->desc().shape[1]);
78  output_desc.shape.set(idx_c, src->desc().shape[idx_c]);
79  output_desc.shape.set(idx_h, _pool_info.pooled_height());
80  output_desc.shape.set(idx_w, _pool_info.pooled_width());
81 
82  return output_desc;
83 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
unsigned int pooled_width() const
Get the pooled width of the layer.
Definition: Types.h:1252
SimpleTensor< float > src
Definition: DFT.cpp:155
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
unsigned int pooled_height() const
Get the pooled height of the layer.
Definition: Types.h:1257
size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get the index of the given dimension.
Definition: Helpers.inl:193
Tensor * input(size_t idx) const
Returns the tensor of a given input of the node.
Definition: INode.cpp:150

References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_UNUSED, arm_compute::BATCHES, arm_compute::CHANNEL, Tensor::desc(), arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, INode::input(), TensorDescriptor::layout, ROIPoolingLayerInfo::pooled_height(), ROIPoolingLayerInfo::pooled_width(), TensorShape::set(), TensorDescriptor::shape, arm_compute::test::validation::src, and arm_compute::WIDTH.

Referenced by ROIAlignLayerNode::forward_descriptors().

◆ forward_descriptors()

bool forward_descriptors ( )
overridevirtual

Forwards descriptor information to outputs if possible.

Returns
True if descriptor information could be forwarded otherwise false

Implements INode.

Definition at line 48 of file ROIAlignLayerNode.cpp.

49 {
50  if((input_id(0) != NullTensorID) && (input_id(1) != NullTensorID) && (output_id(0) != NullTensorID))
51  {
52  Tensor *dst = output(0);
53  ARM_COMPUTE_ERROR_ON(dst == nullptr);
54  dst->desc() = configure_output(0);
55  return true;
56  }
57  return false;
58 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
Tensor * output(size_t idx) const
Returns the tensor of a given output of the node.
Definition: INode.cpp:158
TensorID input_id(size_t idx) const
Returns the tensor ID of a given input of the node.
Definition: INode.cpp:137
TensorID output_id(size_t idx) const
Returns the tensor ID of a given output of the node.
Definition: INode.cpp:144
TensorDescriptor configure_output(size_t idx) const override
Calculates output configuration.
constexpr TensorID NullTensorID
Constant NodeID specifying an equivalent of null node.
Definition: Types.h:73

References ARM_COMPUTE_ERROR_ON, ROIAlignLayerNode::configure_output(), arm_compute::test::validation::dst, INode::input_id(), arm_compute::graph::NullTensorID, INode::output(), and INode::output_id().

◆ operator=()

ROIAlignLayerNode& operator= ( const ROIAlignLayerNode )
delete

Prevent instances of this class from being copied.

◆ pooling_info()

const ROIPoolingLayerInfo & pooling_info ( ) const

◆ type()

NodeType type ( ) const
overridevirtual

Returns node's type.

Returns
Node's type

Implements INode.

Definition at line 85 of file ROIAlignLayerNode.cpp.

References arm_compute::graph::ROIAlignLayer.

Referenced by arm_compute::graph::backends::detail::create_roi_align_layer().


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