ONE - On-device Neural Engine
Loading...
Searching...
No Matches
coco::FeatureLayouts::BCHW Class Referencefinal

BCHW Feature Layout. More...

#include <FeatureLayouts.h>

Collaboration diagram for coco::FeatureLayouts::BCHW:

Public Member Functions

const FeatureLayout::IDid (void) const override
 
const FeatureShapeshape (void) const override
 
ElemID at (uint32_t b, uint32_t ch, uint32_t row, uint32_t col) const override
 
- Public Member Functions inherited from coco::FeatureLayout
virtual ~FeatureLayout ()=default
 
uint32_t batch (void) const
 
uint32_t depth (void) const
 
uint32_t height (void) const
 
uint32_t width (void) const
 

Static Public Member Functions

static const FeatureLayout::IDuid (void)
 
static std::unique_ptr< BCHWcreate (const nncc::core::ADT::feature::Shape &shape)
 

Detailed Description

BCHW Feature Layout.

Definition at line 35 of file FeatureLayouts.h.

Member Function Documentation

◆ at()

ElemID coco::FeatureLayouts::BCHW::at ( uint32_t  b,
uint32_t  ch,
uint32_t  row,
uint32_t  col 
) const
overridevirtual

Implements coco::FeatureLayout.

Definition at line 43 of file FeatureLayouts.cpp.

44{
45 static CHWLayout l;
46
47 uint32_t offset = 0;
48 offset += b * num_elements(_shape);
49 offset += l.offset(_shape, ch, row, col);
50 return ElemID{offset};
51}
__global uchar * offset(const Image *img, int x, int y)
Definition helpers.h:540
uint32_t num_elements(const Shape &shape)
The number of elements of a feature map of a given shape.
Definition Shape.h:59

References nncc::core::ADT::feature::num_elements(), and offset().

◆ create()

std::unique_ptr< BCHW > coco::FeatureLayouts::BCHW::create ( const nncc::core::ADT::feature::Shape shape)
static

Definition at line 53 of file FeatureLayouts.cpp.

54{
55 // NOTE It is impossible to use make_unique here as the constructor is private
56 return std::unique_ptr<BCHW>{new BCHW{FeatureShape{shape}}};
57}
const FeatureShape & shape(void) const override

References shape().

Referenced by caffeimport::BatchNormBuilder::build(), caffeimport::ConcatBuilder::build(), caffeimport::ConvolutionBuilder::build(), caffeimport::PoolingBuilder::build(), caffeimport::ReLUBuilder::build(), and caffeimport::ScaleBuilder::build().

◆ id()

const FeatureLayout::ID * coco::FeatureLayouts::BCHW::id ( void  ) const
inlineoverridevirtual

Implements coco::FeatureLayout.

Definition at line 45 of file FeatureLayouts.h.

45{ return uid(); }
static const FeatureLayout::ID * uid(void)

References uid().

Referenced by uid().

◆ shape()

const FeatureShape & coco::FeatureLayouts::BCHW::shape ( void  ) const
inlineoverridevirtual

◆ uid()

const FeatureLayout::ID * coco::FeatureLayouts::BCHW::uid ( void  )
static

Definition at line 34 of file FeatureLayouts.cpp.

35{
36 struct LayoutID final : public FeatureLayout::ID
37 {
38 };
39 static LayoutID id;
40 return &id;
41}
const FeatureLayout::ID * id(void) const override

References id().

Referenced by id().


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