*/
struct FeatureLayout
{
+ struct ID
+ {
+ virtual ~ID() = default;
+ };
+
virtual ~FeatureLayout() = default;
+ virtual const ID *id(void) const = 0;
+
virtual uint32_t batch(void) const = 0;
virtual const nncc::core::ADT::feature::Shape &shape(void) const = 0;
}
public:
+ static const FeatureLayout::ID *uid(void);
+ const FeatureLayout::ID *id(void) const override { return uid(); }
+
uint32_t batch(void) const override { return _batch; }
const nncc::core::ADT::feature::Shape &shape(void) const override { return _shape; }
}
public:
+ static const FeatureLayout::ID *uid(void);
+ const FeatureLayout::ID *id(void) const override { return uid(); }
+
uint32_t batch(void) const override { return _batch; }
const nncc::core::ADT::feature::Shape &shape(void) const override { return _shape; }
GenericFeatureLayout(const nncc::core::ADT::feature::Shape &shape);
public:
+ static const FeatureLayout::ID *uid(void);
+ const FeatureLayout::ID *id(void) const override { return uid(); }
+
uint32_t batch(void) const override { return _batch; }
const nncc::core::ADT::feature::Shape &shape(void) const override { return _shape; }
namespace FeatureLayouts
{
+const FeatureLayout::ID *BCHW::uid(void)
+{
+ struct LayoutID final : public FeatureLayout::ID
+ {
+ };
+ static LayoutID id;
+ return &id;
+}
+
ElemID BCHW::at(uint32_t b, uint32_t ch, uint32_t row, uint32_t col) const
{
static CHWLayout l;
namespace FeatureLayouts
{
+const FeatureLayout::ID *BHWC::uid(void)
+{
+ struct LayoutID final : public FeatureLayout::ID
+ {
+ };
+ static LayoutID id;
+ return &id;
+}
+
ElemID BHWC::at(uint32_t b, uint32_t ch, uint32_t row, uint32_t col) const
{
static HWCLayout l;
_content.resize(_batch * num_elements(_shape));
}
+const FeatureLayout::ID *GenericFeatureLayout::uid(void)
+{
+ struct LayoutID final : public FeatureLayout::ID
+ {
+ };
+ static LayoutID id;
+ return &id;
+}
+
uint32_t GenericFeatureLayout::offset(uint32_t b, uint32_t ch, uint32_t row, uint32_t col) const
{
static nncc::core::ADT::feature::CHWLayout l{};