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

Generic Feature Layout. More...

#include <FeatureLayouts.h>

Collaboration diagram for coco::FeatureLayouts::Generic:

Public Member Functions

const FeatureLayout::IDid (void) const override
 
const FeatureShapeshape (void) const override
 
ElemIDat (uint32_t b, uint32_t ch, uint32_t row, uint32_t col)
 
ElemID at (uint32_t b, uint32_t ch, uint32_t row, uint32_t col) const override
 
void reorder (const nncc::core::ADT::feature::Layout &l)
 
- 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< Genericcreate (const nncc::core::ADT::feature::Shape &shape)
 

Detailed Description

Generic Feature Layout.

Definition at line 127 of file FeatureLayouts.h.

Member Function Documentation

◆ at() [1/2]

ElemID & coco::FeatureLayouts::Generic::at ( uint32_t  b,
uint32_t  ch,
uint32_t  row,
uint32_t  col 
)

Definition at line 178 of file FeatureLayouts.cpp.

179{
180 return _content.at(offset(b, ch, row, col));
181}

Referenced by reorder().

◆ at() [2/2]

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

Implements coco::FeatureLayout.

Definition at line 183 of file FeatureLayouts.cpp.

184{
185 return _content.at(offset(b, ch, row, col));
186}

◆ create()

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

Definition at line 204 of file FeatureLayouts.cpp.

205{
206 // NOTE It is impossible to use make_unique here as the constructor is private
207 return std::unique_ptr<Generic>{new Generic{shape}};
208}
const FeatureShape & shape(void) const override

References shape().

◆ id()

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

Implements coco::FeatureLayout.

Definition at line 134 of file FeatureLayouts.h.

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

References uid().

Referenced by uid().

◆ reorder()

void coco::FeatureLayouts::Generic::reorder ( const nncc::core::ADT::feature::Layout l)

Definition at line 188 of file FeatureLayouts.cpp.

189{
190 assert(shape().batch() == 1);
191
192 for (uint32_t ch = 0; ch < shape().depth(); ++ch)
193 {
194 for (uint32_t row = 0; row < shape().height(); ++row)
195 {
196 for (uint32_t col = 0; col < shape().width(); ++col)
197 {
198 at(0, ch, row, col) = ElemID{l.offset(shape(), ch, row, col)};
199 }
200 }
201 }
202}
ElemID & at(uint32_t b, uint32_t ch, uint32_t row, uint32_t col)
uint32_t depth(void) const
Definition Shape.h:44
uint32_t width(void) const
Definition Shape.h:46
uint32_t height(void) const
Definition Shape.h:45
uint32_t batch(void) const

References at(), coco::FeatureLayout::batch(), nncc::core::ADT::feature::Shape::depth(), nncc::core::ADT::feature::Shape::height(), shape(), and nncc::core::ADT::feature::Shape::width().

◆ shape()

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

◆ uid()

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

Definition at line 157 of file FeatureLayouts.cpp.

158{
159 struct LayoutID final : public FeatureLayout::ID
160 {
161 };
162 static LayoutID id;
163 return &id;
164}
const FeatureLayout::ID * id(void) const override

References id().

Referenced by id().


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