ONE - On-device Neural Engine
Loading...
Searching...
No Matches
morph::nnapi Namespace Reference

Functions

nncc::core::ADT::tensor::Shape as_tensor_shape (const nncc::core::ADT::feature::Shape &)
 
nncc::core::ADT::tensor::Shape as_tensor_shape (const nncc::core::ADT::kernel::Shape &)
 
nncc::core::ADT::feature::Shape as_feature_shape (const nncc::core::ADT::tensor::Shape &)
 
nncc::core::ADT::kernel::Shape as_kernel_shape (const nncc::core::ADT::tensor::Shape &)
 

Function Documentation

◆ as_feature_shape()

feature::Shape morph::nnapi::as_feature_shape ( const nncc::core::ADT::tensor::Shape shape)

Definition at line 54 of file nnapi.cpp.

55{
56 assert(shape.rank() == 4);
57 assert(shape.dim(0) == 1);
58 return feature::Shape{shape.dim(3), shape.dim(1), shape.dim(2)};
59}
uint32_t & dim(uint32_t axis)
Definition Shape.cpp:42
uint32_t rank(void) const
Definition Shape.cpp:35

References nncc::core::ADT::tensor::Shape::dim(), and nncc::core::ADT::tensor::Shape::rank().

◆ as_kernel_shape()

kernel::Shape morph::nnapi::as_kernel_shape ( const nncc::core::ADT::tensor::Shape shape)

Definition at line 61 of file nnapi.cpp.

62{
63 assert(shape.rank() == 4);
64 return kernel::Shape{shape.dim(0), shape.dim(3), shape.dim(1), shape.dim(2)};
65}

References nncc::core::ADT::tensor::Shape::dim(), and nncc::core::ADT::tensor::Shape::rank().

◆ as_tensor_shape() [1/2]

tensor::Shape morph::nnapi::as_tensor_shape ( const nncc::core::ADT::feature::Shape shape)

Definition at line 28 of file nnapi.cpp.

29{
30 tensor::Shape res;
31
32 res.resize(4);
33 res.dim(0) = 1;
34 res.dim(1) = shape.height();
35 res.dim(2) = shape.width();
36 res.dim(3) = shape.depth();
37
38 return res;
39}
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
Shape & resize(uint32_t size)
Definition Shape.cpp:36

References nncc::core::ADT::feature::Shape::depth(), nncc::core::ADT::tensor::Shape::dim(), nncc::core::ADT::feature::Shape::height(), nncc::core::ADT::tensor::Shape::resize(), and nncc::core::ADT::feature::Shape::width().

Referenced by ANNBinder::addOperand(), and ANNBinder::addOperand().

◆ as_tensor_shape() [2/2]

tensor::Shape morph::nnapi::as_tensor_shape ( const nncc::core::ADT::kernel::Shape shape)

Definition at line 41 of file nnapi.cpp.

42{
43 tensor::Shape res;
44
45 res.resize(4);
46 res.dim(0) = shape.count();
47 res.dim(1) = shape.height();
48 res.dim(2) = shape.width();
49 res.dim(3) = shape.depth();
50
51 return res;
52}
uint32_t width(void) const
Definition Shape.h:47
uint32_t height(void) const
Definition Shape.h:46
uint32_t count(void) const
Definition Shape.h:44
uint32_t depth(void) const
Definition Shape.h:45

References nncc::core::ADT::kernel::Shape::count(), nncc::core::ADT::kernel::Shape::depth(), nncc::core::ADT::tensor::Shape::dim(), nncc::core::ADT::kernel::Shape::height(), nncc::core::ADT::tensor::Shape::resize(), and nncc::core::ADT::kernel::Shape::width().