Compute Library
 23.11
FusedDepthwiseConvolutionBatchNormalizationNode Class Referencefinal

Fused Depthwise Convolution Batch Normalization node. More...

#include <FusedDepthwiseConvolutionBatchNormalizationNode.h>

Collaboration diagram for FusedDepthwiseConvolutionBatchNormalizationNode:
[legend]

Public Member Functions

 FusedDepthwiseConvolutionBatchNormalizationNode (float epsilon, PadStrideInfo info, unsigned int depth_multiplier, DepthwiseConvolutionMethod method, ActivationLayerInfo fused_activation=ActivationLayerInfo())
 Constructor. More...
 
void set_depthwise_convolution_method (DepthwiseConvolutionMethod method)
 Sets the depthwise convolution layer method to use. More...
 
DepthwiseConvolutionMethod depthwise_convolution_method () const
 Depthwise convolution layer method accessor. More...
 
float epsilon () const
 Epsilon parameter accessor. More...
 
ActivationLayerInfo fused_activation () const
 Returns fused activation. More...
 
void set_fused_activation (ActivationLayerInfo fused_activation)
 Sets fused activation. More...
 
void set_convolution_method (ConvolutionMethod method)
 Sets the convolution layer method to use. More...
 
unsigned int depth_multiplier () const
 Depth multiplier accessor. More...
 
PadStrideInfo convolution_info () const
 Convolution metadata 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...
 

Static Public Member Functions

static TensorDescriptor compute_output_descriptor (const TensorDescriptor &input_descriptor, const TensorDescriptor &weights_descriptor, const PadStrideInfo &info, int depth_multiplier)
 Computes convolution output descriptor. More...
 

Static Public Attributes

static constexpr NodeType node_type = NodeType::FusedDepthwiseConvolutionBatchNormalizationLayer
 

Detailed Description

Fused Depthwise Convolution Batch Normalization node.

Definition at line 34 of file FusedDepthwiseConvolutionBatchNormalizationNode.h.

Constructor & Destructor Documentation

◆ FusedDepthwiseConvolutionBatchNormalizationNode()

FusedDepthwiseConvolutionBatchNormalizationNode ( float  epsilon,
PadStrideInfo  info,
unsigned int  depth_multiplier,
DepthwiseConvolutionMethod  method,
ActivationLayerInfo  fused_activation = ActivationLayerInfo() 
)

Constructor.

Parameters
[in]epsilonEpsilon parameter.
[in]infoConvolution layer attributes.
[in]depth_multiplier(Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
[in]method(Optional) Convolution method to use
[in]fused_activation(Optional) Fused activation layer. Disabled if not specified

Definition at line 35 of file FusedDepthwiseConvolutionBatchNormalizationNode.cpp.

41  : _epsilon(epsilon),
42  _info(std::move(info)),
43  _depth_multiplier(depth_multiplier),
44  _method(method),
45  _fused_activation(fused_activation)
46 {
47  _input_edges.resize(7, EmptyEdgeID);
48  _outputs.resize(1, NullTensorID);
49 }

Member Function Documentation

◆ accept()

void accept ( INodeVisitor v)
overridevirtual

Accepts a node visitor.

Parameters
[in]vVisitor to accept

Implements INode.

Definition at line 145 of file FusedDepthwiseConvolutionBatchNormalizationNode.cpp.

146 {
147  v.visit(*this);
148 }

References INodeVisitor::visit().

◆ compute_output_descriptor()

TensorDescriptor compute_output_descriptor ( const TensorDescriptor input_descriptor,
const TensorDescriptor weights_descriptor,
const PadStrideInfo info,
int  depth_multiplier 
)
static

Computes convolution output descriptor.

Parameters
[in]input_descriptorInput descriptor
[in]weights_descriptorWeights descriptor
[in]infoConvolution operation attributes
[in]depth_multiplierDepth multiplier
Returns
Output descriptor

Definition at line 88 of file FusedDepthwiseConvolutionBatchNormalizationNode.cpp.

92 {
93  unsigned int output_width = 0;
94  unsigned int output_height = 0;
95 
96  const unsigned int input_width = get_dimension_size(input_descriptor, DataLayoutDimension::WIDTH);
97  const unsigned int input_height = get_dimension_size(input_descriptor, DataLayoutDimension::HEIGHT);
98  const unsigned int input_channels = get_dimension_size(input_descriptor, DataLayoutDimension::CHANNEL);
99  const unsigned int kernel_width = get_dimension_size(weights_descriptor, DataLayoutDimension::WIDTH);
100  const unsigned int kernel_height = get_dimension_size(weights_descriptor, DataLayoutDimension::HEIGHT);
101 
102  std::tie(output_width, output_height) =
103  scaled_dimensions(input_width, input_height, kernel_width, kernel_height, info);
104 
105  TensorDescriptor output_descriptor = input_descriptor;
106  output_descriptor.shape.set(get_dimension_idx(output_descriptor.layout, DataLayoutDimension::WIDTH), output_width);
107  output_descriptor.shape.set(get_dimension_idx(output_descriptor.layout, DataLayoutDimension::HEIGHT),
108  output_height);
109  output_descriptor.shape.set(get_dimension_idx(output_descriptor.layout, DataLayoutDimension::CHANNEL),
110  input_channels * depth_multiplier);
111 
112  return output_descriptor;
113 }

References arm_compute::CHANNEL, FusedDepthwiseConvolutionBatchNormalizationNode::depth_multiplier(), arm_compute::graph::get_dimension_idx(), arm_compute::graph::get_dimension_size(), arm_compute::HEIGHT, arm_compute::test::validation::info, TensorDescriptor::layout, arm_compute::scaled_dimensions(), TensorShape::set(), TensorDescriptor::shape, and arm_compute::WIDTH.

Referenced by FusedDepthwiseConvolutionBatchNormalizationNode::configure_output().

◆ 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 127 of file FusedDepthwiseConvolutionBatchNormalizationNode.cpp.

128 {
129  ARM_COMPUTE_UNUSED(idx);
130  const Tensor *src = input(0);
131  const Tensor *weights = input(1);
132 
133  ARM_COMPUTE_ERROR_ON(src == nullptr || weights == nullptr);
134 
135  TensorDescriptor output_info = compute_output_descriptor(src->desc(), weights->desc(), _info, _depth_multiplier);
136 
137  return output_info;
138 }

References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_UNUSED, FusedDepthwiseConvolutionBatchNormalizationNode::compute_output_descriptor(), Tensor::desc(), INode::input(), arm_compute::test::validation::output_info, and arm_compute::test::validation::src.

Referenced by FusedDepthwiseConvolutionBatchNormalizationNode::forward_descriptors().

◆ convolution_info()

PadStrideInfo convolution_info ( ) const

Convolution metadata accessor.

Returns
Convolution information

Definition at line 67 of file FusedDepthwiseConvolutionBatchNormalizationNode.cpp.

68 {
69  return _info;
70 }

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

◆ depth_multiplier()

unsigned int depth_multiplier ( ) const

◆ depthwise_convolution_method()

DepthwiseConvolutionMethod depthwise_convolution_method ( ) const

Depthwise convolution layer method accessor.

Note
This is an indication on which depthwise convolution layer implementation to use, if it fails to be created the library's heuristic approach will be used
Returns
Depthwise convolution layer method to be used by the node

Definition at line 57 of file FusedDepthwiseConvolutionBatchNormalizationNode.cpp.

58 {
59  return _method;
60 }

◆ epsilon()

float epsilon ( ) const

Epsilon parameter accessor.

Returns
Epsilon parameter

Definition at line 62 of file FusedDepthwiseConvolutionBatchNormalizationNode.cpp.

63 {
64  return _epsilon;
65 }

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

◆ 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 115 of file FusedDepthwiseConvolutionBatchNormalizationNode.cpp.

116 {
117  if ((input_id(0) != NullTensorID) && (input_id(1) != NullTensorID) && (output_id(0) != NullTensorID))
118  {
119  Tensor *dst = output(0);
120  ARM_COMPUTE_ERROR_ON(dst == nullptr);
121  dst->desc() = configure_output(0);
122  return true;
123  }
124  return false;
125 }

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

◆ fused_activation()

ActivationLayerInfo fused_activation ( ) const

◆ set_convolution_method()

void set_convolution_method ( ConvolutionMethod  method)

Sets the convolution layer method to use.

Parameters
[in]methodMethod to use for convolution

◆ set_depthwise_convolution_method()

void set_depthwise_convolution_method ( DepthwiseConvolutionMethod  method)

Sets the depthwise convolution layer method to use.

Parameters
[in]methodMethod to use for depthwise convolution

Definition at line 51 of file FusedDepthwiseConvolutionBatchNormalizationNode.cpp.

53 {
54  _method = method;
55 }

◆ set_fused_activation()

void set_fused_activation ( ActivationLayerInfo  fused_activation)

Sets fused activation.

Parameters
[in]fused_activationFused activation to set

Definition at line 82 of file FusedDepthwiseConvolutionBatchNormalizationNode.cpp.

83 {
84  _fused_activation = fused_activation;
85 }

References FusedDepthwiseConvolutionBatchNormalizationNode::fused_activation().

◆ type()

Field Documentation

◆ node_type


The documentation for this class was generated from the following files:
arm_compute::graph::EmptyEdgeID
constexpr EdgeID EmptyEdgeID
Definition: Types.h:81
arm_compute::test::validation::src
SimpleTensor< float > src
Definition: DFT.cpp:155
arm_compute::DataLayoutDimension::CHANNEL
@ CHANNEL
channel
arm_compute::graph::INode::input_id
TensorID input_id(size_t idx) const
Returns the tensor ID of a given input of the node.
Definition: INode.cpp:137
arm_compute::test::validation::dst
auto dst
Definition: DFT.cpp:170
arm_compute::graph::FusedDepthwiseConvolutionBatchNormalizationNode::fused_activation
ActivationLayerInfo fused_activation() const
Returns fused activation.
Definition: FusedDepthwiseConvolutionBatchNormalizationNode.cpp:77
arm_compute::graph::INode::output
Tensor * output(size_t idx) const
Returns the tensor of a given output of the node.
Definition: INode.cpp:158
arm_compute::scaled_dimensions
std::pair< unsigned int, unsigned int > scaled_dimensions(int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info, const Size2D &dilation=Size2D(1U, 1U))
Returns expected width and height of output scaled tensor depending on dimensions rounding mode.
Definition: Utils.cpp:288
arm_compute::graph::FusedDepthwiseConvolutionBatchNormalizationNode::depth_multiplier
unsigned int depth_multiplier() const
Depth multiplier accessor.
Definition: FusedDepthwiseConvolutionBatchNormalizationNode.cpp:72
arm_compute::graph::FusedDepthwiseConvolutionBatchNormalizationNode::configure_output
TensorDescriptor configure_output(size_t idx) const override
Calculates output configuration.
Definition: FusedDepthwiseConvolutionBatchNormalizationNode.cpp:127
arm_compute::graph::get_dimension_size
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.
Definition: Utils.cpp:143
arm_compute::DataLayoutDimension::WIDTH
@ WIDTH
width
ARM_COMPUTE_ERROR_ON
#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
arm_compute::test::validation::output_info
output_info
Definition: DirectConvolutionLayer.cpp:547
arm_compute::graph::FusedDepthwiseConvolutionBatchNormalizationNode::epsilon
float epsilon() const
Epsilon parameter accessor.
Definition: FusedDepthwiseConvolutionBatchNormalizationNode.cpp:62
arm_compute::DataLayoutDimension::HEIGHT
@ HEIGHT
height
arm_compute::graph::FusedDepthwiseConvolutionBatchNormalizationNode::node_type
static constexpr NodeType node_type
Definition: FusedDepthwiseConvolutionBatchNormalizationNode.h:123
arm_compute::detail::ObjectType::Tensor
@ Tensor
ARM_COMPUTE_UNUSED
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:151
arm_compute::graph::get_dimension_idx
size_t get_dimension_idx(DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get index of a tensor's given dimension depending on its layout.
Definition: Utils.cpp:150
arm_compute::graph::FusedDepthwiseConvolutionBatchNormalizationNode::compute_output_descriptor
static TensorDescriptor compute_output_descriptor(const TensorDescriptor &input_descriptor, const TensorDescriptor &weights_descriptor, const PadStrideInfo &info, int depth_multiplier)
Computes convolution output descriptor.
Definition: FusedDepthwiseConvolutionBatchNormalizationNode.cpp:88
arm_compute::graph::INode::input
Tensor * input(size_t idx) const
Returns the tensor of a given input of the node.
Definition: INode.cpp:150
arm_compute::graph::INode::output_id
TensorID output_id(size_t idx) const
Returns the tensor ID of a given output of the node.
Definition: INode.cpp:144
arm_compute::graph::NullTensorID
constexpr TensorID NullTensorID
Constant NodeID specifying an equivalent of null node.
Definition: Types.h:77
arm_compute::test::validation::info
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)