ONE - On-device Neural Engine
Loading...
Searching...
No Matches
coco::FeatureLayouts::BHWC Class Reference

BHWC Feature Layout. More...

#include <FeatureLayouts.h>

Collaboration diagram for coco::FeatureLayouts::BHWC:

Public Member Functions

const FeatureLayout::IDid (void) const override
 
const FeatureShapeshape (void) const override
 
coco::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< BHWCcreate (const nncc::core::ADT::feature::Shape &shape)
 
static std::unique_ptr< BHWCcreate (const FeatureShape &shape)
 

Detailed Description

BHWC Feature Layout.

Definition at line 61 of file FeatureLayouts.h.

Member Function Documentation

◆ at()

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

Implements coco::FeatureLayout.

Definition at line 79 of file FeatureLayouts.cpp.

80{
81 static HWCLayout l;
82
83 uint32_t offset = 0;
84 offset += b * num_elements(_shape);
85 offset += l.offset(_shape, ch, row, col);
86
87 return ElemID{offset};
88}
__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() [1/2]

std::unique_ptr< BHWC > coco::FeatureLayouts::BHWC::create ( const FeatureShape shape)
static

Definition at line 96 of file FeatureLayouts.cpp.

97{
98 // NOTE It is impossible to use make_unique here as the constructor is private
99 return std::unique_ptr<BHWC>{new BHWC{shape}};
100}
const FeatureShape & shape(void) const override

References shape().

◆ create() [2/2]

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

◆ id()

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

Implements coco::FeatureLayout.

Definition at line 71 of file FeatureLayouts.h.

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

References uid().

Referenced by uid().

◆ shape()

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

◆ uid()

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

Definition at line 70 of file FeatureLayouts.cpp.

71{
72 struct LayoutID final : public FeatureLayout::ID
73 {
74 };
75 static LayoutID id;
76 return &id;
77}
const FeatureLayout::ID * id(void) const override

References id().

Referenced by id(), and enco::reduce_identical_object().


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