ONE - On-device Neural Engine
Loading...
Searching...
No Matches
moco::Padding2DInference Class Referencefinal

#include <TFShapeInferenceHelper.h>

Collaboration diagram for moco::Padding2DInference:

Public Member Functions

loco::Padding2D operator() (const PlaneShape &in)
 
- Public Member Functions inherited from moco::PlaneInference
PlaneShape operator() (const PlaneShape &in)
 
void padding (const TFPadding &value)
 
void window (const loco::Window< 2 > value)
 
void stride (const loco::Stride< 2 > value)
 

Additional Inherited Members

- Protected Member Functions inherited from moco::PlaneInference
void fill (Parameters &p, const PlaneShape &in)
 
PlaneShape infer (const Parameters &p, const PlaneShape &)
 

Detailed Description

Definition at line 177 of file TFShapeInferenceHelper.h.

Member Function Documentation

◆ operator()()

loco::Padding2D moco::Padding2DInference::operator() ( const PlaneShape in)
inline

Definition at line 180 of file TFShapeInferenceHelper.h.

181 {
182 Parameters p;
183
184 fill(p, in);
185
186 auto output = infer(p, in);
187
188 int64_t i_height = (int64_t)(output.height.value() - 1) * (int64_t)p.stride.height.value() +
189 (int64_t)p.effective_window.height.value() - (int64_t)p.input.height.value();
190 int64_t i_width = (int64_t)(output.width.value() - 1) * (int64_t)p.stride.width.value() +
191 (int64_t)p.effective_window.width.value() - (int64_t)p.input.width.value();
192
193 uint32_t pad_height = i_height >= 0 ? (uint32_t)i_height : 0U;
194 uint32_t pad_width = i_width >= 0 ? (uint32_t)i_width : 0U;
195
196 loco::Padding2D padding2d;
197
198 padding2d.top(pad_height / 2);
199 padding2d.bottom(pad_height - padding2d.top());
200 padding2d.left(pad_width / 2);
201 padding2d.right(pad_width - padding2d.left());
202
203 return padding2d;
204 }
uint32_t left(void) const
Definition Padding2D.h:49
uint32_t top(void) const
Definition Padding2D.h:41
uint32_t bottom(void) const
Definition Padding2D.h:45
uint32_t right(void) const
Definition Padding2D.h:53
void fill(Parameters &p, const PlaneShape &in)
Definition infer.py:1

References loco::Padding2D::bottom(), moco::PlaneInference::Parameters::effective_window, moco::PlaneInference::fill(), moco::PlaneShape::height, moco::PlaneInference::Parameters::input, loco::Padding2D::left(), loco::Padding2D::right(), moco::PlaneInference::Parameters::stride, loco::Padding2D::top(), loco::Dimension::value(), and moco::PlaneShape::width.


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