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

BC (Channel-wise Channel-major) Feature Layout. More...

#include <FeatureLayouts.h>

Collaboration diagram for coco::FeatureLayouts::BC:

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< BCcreate (const nncc::core::ADT::feature::Shape &shape)
 

Detailed Description

BC (Channel-wise Channel-major) Feature Layout.

  1. A layout is said to be channel-wise if the following holds:

    For each pair of valid feature index I and J, at(I) == at(J) if batch(I) == batch(J) and channel(I) == channel(J)

  2. A layout is said to be channel-major if the followings hold:

    For each pair of valid feature index I and J, at(I) + 1 == at(J) if batch(I) == batch(J) and channel(I) + 1 == channel(J)

    For each pair of valid feature index I and J, at(I) + 1 == at(J) if batch(I) + 1 == batch(J), channel(I) == depth - 1, and channel(J) == 0

Definition at line 101 of file FeatureLayouts.h.

Member Function Documentation

◆ at()

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

Implements coco::FeatureLayout.

Definition at line 123 of file FeatureLayouts.cpp.

124{
125 assert(b < shape().batch());
126
127 uint32_t offset = 0;
128
129 offset += b * _shape.depth();
130 offset += ch;
131
132 return ElemID{offset};
133}
const FeatureShape & shape(void) const override
uint32_t depth(void) const
Definition Shape.h:44
__global uchar * offset(const Image *img, int x, int y)
Definition helpers.h:540
uint32_t batch(void) const

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

◆ create()

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

Definition at line 135 of file FeatureLayouts.cpp.

136{
137 // NOTE It is impossible to use make_unique here as the constructor is private
138 return std::unique_ptr<BC>{new BC{FeatureShape{shape}}};
139}

References shape().

Referenced by caffeimport::BatchNormBuilder::build(), caffeimport::ConvolutionBuilder::build(), caffeimport::ScaleBuilder::build(), tflimport::Conv2DGraphBuilder::build(), and tflimport::DepthwiseConv2DGraphBuilder::build().

◆ id()

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

Implements coco::FeatureLayout.

Definition at line 111 of file FeatureLayouts.h.

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

References uid().

Referenced by uid().

◆ shape()

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

◆ uid()

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

Definition at line 113 of file FeatureLayouts.cpp.

114{
115 struct LayoutID final : public FeatureLayout::ID
116 {
117 };
118 static LayoutID id;
119 return &id;
120}
const FeatureLayout::ID * id(void) const override

References id().

Referenced by id().


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