ONE - On-device Neural Engine
Loading...
Searching...
No Matches
loco::TransposedConv2D Class Referencefinal

2D Transposed Convolution More...

#include <Nodes.h>

Collaboration diagram for loco::TransposedConv2D:

Public Member Functions

Nodeifm (void) const
 
void ifm (Node *node)
 
Nodeker (void) const
 
void ker (Node *node)
 
const Padding2Dpad (void) const
 
Padding2Dpad (void)
 
const Stride< 2 > * stride (void) const
 
Stride< 2 > * stride (void)
 
- Public Member Functions inherited from loco::CanonicalNodeDef< CanonicalOpcode::TransposedConv2D, FixedArity< 2 >::Mixin >
virtual ~CanonicalNodeDef ()=default
 
uint32_t opnum (void) const final
 
CanonicalOpcode opcode (void) const final
 
- Public Member Functions inherited from loco::CanonicalNode
virtual ~CanonicalNode ()=default
 
const Dialectdialect (void) const final
 Return "Dialect" identifier that this node belongs to.
 
template<typename T >
accept (CanonicalNodeVisitorBase< T > *) const
 
template<typename T >
accept (CanonicalNodeMutableVisitorBase< T > *)
 
- Public Member Functions inherited from loco::Node
 Node ()=default
 
 Node (const Node &)=delete
 
 Node (Node &&)=delete
 
virtual ~Node ()
 
Graphgraph (void)
 
const Graphgraph (void) const
 
virtual uint32_t arity (void) const =0
 Return the number of arguments.
 
virtual Nodearg (uint32_t N) const =0
 Access N-th argument node.
 
virtual void drop (void)=0
 Drop all the reference of arguments.
 
- Public Member Functions inherited from loco::AnnotatedItem< NodeAnnotation >
 AnnotatedItem ()=default
 
virtual ~AnnotatedItem ()=default
 
const T * annot (void) const
 Retrieve a stored annotation of type T.
 
void annot (std::unique_ptr< T > &&p)
 Attach or remove a new annotation of type T.
 

Detailed Description

2D Transposed Convolution

Note
TransposedConv2D have a few important conventions that IR users should understand and follow, so please check below notice carefully.
  1. What is 'input' and 'output'

For loco canonical TransposedConv2D, 'input' and 'output' mean actual input and output node of TransposedConv2D node. Be careful that some other frameworks may use opposite sense, especially TensorFlow which is inspired by backpropagation of convolution. For example, loco::TransposedConv2D::ifm() means actual input feature map node that is sourced into TransposedConv2D.

  1. How to read kernel representation

TransposedConv2D::ker() should be a node of Filter domain. Following is what each FilterAxis means as a kernel of TransposedConv2D:

  • FilterAxis::Height : kernel's height
  • FilterAxis::Width : kernel's width
  • FilterAxis::Depth : IFM's channel depth
  • FilterAxis::Count : OFM's channel depth TODO We may refactor FilterAxis as follow to reduce ambiguity:
  • FilterAxis::Height -> FilterAxis::H
  • FilterAxis::Width -> FilterAxis::W
  • FilterAxis::Depth -> FilterAxis::I
  • FilterAxis::Count -> FilterAxis::O

Tight fit rule

TransposedConv2D have no information about its output shape. Instead, it always satisfy following 'tight fit' rule for horizontal and vertical dimension:

O = S * ( I - 1 ) + F - P

where O: output size S: stride I: input size F: effective kernal(filter) size P: whole pad size (= front + rear pad)

With this, output shape is uniquely determined by all inputs and attributes.

Definition at line 686 of file Nodes.h.

Member Function Documentation

◆ ifm() [1/2]

void loco::TransposedConv2D::ifm ( Node node)
inline

Definition at line 691 of file Nodes.h.

691{ at(0)->node(node); }

◆ ifm() [2/2]

Node * loco::TransposedConv2D::ifm ( void  ) const
inline

Definition at line 690 of file Nodes.h.

690{ return at(0)->node(); }

Referenced by exo::TransposedConv2DConverter::convert(), and mir2loco::Transformer::visit().

◆ ker() [1/2]

void loco::TransposedConv2D::ker ( Node node)
inline

Definition at line 694 of file Nodes.h.

694{ at(1)->node(node); }

◆ ker() [2/2]

Node * loco::TransposedConv2D::ker ( void  ) const
inline

Definition at line 693 of file Nodes.h.

693{ return at(1)->node(); }

Referenced by exo::TransposedConv2DConverter::convert(), and TransposedConv2DLayer::operator()().

◆ pad() [1/2]

Padding2D * loco::TransposedConv2D::pad ( void  )
inline

Definition at line 698 of file Nodes.h.

698{ return &_pad; }

◆ pad() [2/2]

const Padding2D * loco::TransposedConv2D::pad ( void  ) const
inline

Definition at line 697 of file Nodes.h.

697{ return &_pad; }

Referenced by exo::TransposedConv2DConverter::convert().

◆ stride() [1/2]

Stride< 2 > * loco::TransposedConv2D::stride ( void  )
inline

Definition at line 702 of file Nodes.h.

702{ return &_stride; }

◆ stride() [2/2]

const Stride< 2 > * loco::TransposedConv2D::stride ( void  ) const
inline

Definition at line 701 of file Nodes.h.

701{ return &_stride; }

Referenced by exo::TransposedConv2DConverter::convert().


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