ONE - On-device Neural Engine
|
Data Structures | |
class | AvgPool2DGraphBuilder |
GraphBuilder for AvgPool2D operator. More... | |
class | ConcatenationGraphBuilder |
GraphBuilder for Concatenation operator. More... | |
class | Conv2DGraphBuilder |
GraphBuilder for Conv2D operator. More... | |
class | DepthwiseConv2DGraphBuilder |
GraphBuilder for DepthwiseConv2D operator. More... | |
class | DivGraphBuilder |
GraphBuilder for Div operator. More... | |
class | GraphBuilder |
Parent class of tflite operation graph builders (e.g., Conv2DGraphBuilder) More... | |
class | GraphBuilderContext |
Class to store context to build IR from tflite. More... | |
class | GraphBuilderRegistry |
Class to return graph builder for passed tflite::builtinOperator. More... | |
class | MaxPool2DGraphBuilder |
GraphBuilder for AvgPool2D operator. More... | |
class | ReLU6GraphBuilder |
GraphBuilder for ReLU6 operator. More... | |
class | ReLUGraphBuilder |
GraphBuilder for ReLU operator. More... | |
class | ReshapeGraphBuilder |
GraphBuilder for Reshape operator. More... | |
class | SubGraphBuilder |
GraphBuilder for Sub operator. More... | |
class | TensorBags |
Pre-creates coco:Bags for each operands(tensors) More... | |
class | TensorContext |
Extracts and holds operand(tensor) information such as name, shape, and type. More... | |
class | TflBufferContext |
Class to read and provide buffer information of tflite. More... | |
class | TflOpCodeContext |
Class that holds operator codes and related methods. More... | |
Typedefs | |
using | IndexVector = std::vector< int32_t > |
Functions | |
IndexVector | as_index_vector (const flatbuffers::Vector< int32_t > *array) |
Converts flatbuffers::Vector to IndexVector. | |
tensor::Shape | as_tensor_shape (const flatbuffers::Vector< int32_t > *shape) |
Converts flatbuffers::Vector to nncc::core::ADT::tensor::Shape. | |
void | set_module_inputs (coco::Module *m, TensorContext &ctx, TensorBags &bags, const IndexVector &inputs) |
Set module input operands and its information. | |
void | set_module_outputs (coco::Module *m, TensorContext &ctx, TensorBags &bags, const IndexVector &outputs) |
Set module output operands and its information. | |
void | copy_tensors (GraphBuilderContext *ctx) |
Copy values of tfl tensors into coco::Data if the data was not copied. | |
coco::FeatureObject * | build_activation (tflite::ActivationFunctionType act, coco::Block *block, coco::FeatureObject *ifm) |
Add coco::Eval for fused activation. This method creates an ofm object, appends Eval(ofm object, RELU(...)) into block, and returns ofm object. | |
coco::Padding2D | get_padding (const tensor::Shape &ifm_shape, const int kernel_w, const int kernel_h, tflite::Padding padding, int stride_w, int stride_h, int dilation_w_factor, int dilation_h_factor) |
coco::Padding2D | pool2D_padding (const tflite::Pool2DOptions *options, const tensor::Shape &ifm_shape, const int filter_w, const int filter_h) |
coco::Padding2D | conv2D_padding (const tflite::Conv2DOptions *options, const tensor::Shape &ifm_shape, const tensor::Shape &kernel_shape) |
coco::Padding2D | depthwiseConv2D_padding (const tflite::DepthwiseConv2DOptions *options, const tensor::Shape &ifm_shape, const tensor::Shape &kernel_shape) |
using tflimport::IndexVector = typedef std::vector<int32_t> |
IndexVector tflimport::as_index_vector | ( | const flatbuffers::Vector< int32_t > * | array | ) |
Converts flatbuffers::Vector to IndexVector.
Definition at line 28 of file Convert.cpp.
References flatbuffers::Vector< T >::Get(), flatbuffers::Vector< T >::size(), and size.
Referenced by tflimport::AvgPool2DGraphBuilder::build(), tflimport::ConcatenationGraphBuilder::build(), tflimport::DivGraphBuilder::build(), tflimport::MaxPool2DGraphBuilder::build(), tflimport::ReLUGraphBuilder::build(), tflimport::ReLU6GraphBuilder::build(), tflimport::ReshapeGraphBuilder::build(), tflimport::SubGraphBuilder::build(), tflimport::Conv2DGraphBuilder::build(), and tflimport::DepthwiseConv2DGraphBuilder::build().
tensor::Shape tflimport::as_tensor_shape | ( | const flatbuffers::Vector< int32_t > * | shape | ) |
Converts flatbuffers::Vector to nncc::core::ADT::tensor::Shape.
Definition at line 42 of file Convert.cpp.
References nncc::core::ADT::tensor::Shape::dim(), flatbuffers::Vector< T >::Get(), nncc::core::ADT::tensor::Shape::resize(), and flatbuffers::Vector< T >::size().
Referenced by tflimport::TensorContext::prepare(), and tflimport::TensorBags::prepare().
coco::FeatureObject * tflimport::build_activation | ( | tflite::ActivationFunctionType | act, |
coco::Block * | block, | ||
coco::FeatureObject * | ifm | ||
) |
Add coco::Eval for fused activation. This method creates an ofm object, appends Eval(ofm object, RELU(...)) into block, and returns ofm object.
Definition at line 34 of file Activation.cpp.
References coco::DLinkedList< Child, Parent >::Head::append(), coco::UnaryOp::arg(), coco::FeatureObject::asFeature(), coco::Object::bag(), InstrBuilder::copy(), coco::FeatureLayouts::BHWC::create(), InstrBuilder::eval(), coco::Block::instr(), instr_builder(), OpBuilder::load(), m, coco::Entity::module(), op_builder(), OpBuilder::pop(), relu_op, and coco::FeatureObject::shape().
Referenced by tflimport::Conv2DGraphBuilder::build(), and tflimport::DepthwiseConv2DGraphBuilder::build().
coco::Padding2D tflimport::conv2D_padding | ( | const tflite::Conv2DOptions * | options, |
const tensor::Shape & | ifm_shape, | ||
const tensor::Shape & | kernel_shape | ||
) |
Definition at line 88 of file Padding.cpp.
References nncc::core::ADT::tensor::Shape::dim(), and get_padding().
Referenced by tflimport::Conv2DGraphBuilder::build().
void tflimport::copy_tensors | ( | GraphBuilderContext * | ctx | ) |
Copy values of tfl tensors into coco::Data if the data was not copied.
Definition at line 84 of file Frontend.cpp.
References tflimport::GraphBuilderContext::bags(), tflimport::GraphBuilderContext::buffer(), tflimport::GraphBuilderContext::d(), tflimport::GraphBuilderContext::graph(), tflimport::GraphBuilderContext::tensor(), tflimport::TflBufferContext::tensor_buffer(), and tflimport::TensorContext::type().
coco::Padding2D tflimport::depthwiseConv2D_padding | ( | const tflite::DepthwiseConv2DOptions * | options, |
const tensor::Shape & | ifm_shape, | ||
const tensor::Shape & | kernel_shape | ||
) |
Definition at line 96 of file Padding.cpp.
References nncc::core::ADT::tensor::Shape::dim(), and get_padding().
Referenced by tflimport::DepthwiseConv2DGraphBuilder::build().
coco::Padding2D tflimport::get_padding | ( | const tensor::Shape & | ifm_shape, |
const int | kernel_w, | ||
const int | kernel_h, | ||
tflite::Padding | padding, | ||
int | stride_w, | ||
int | stride_h, | ||
int | dilation_w_factor, | ||
int | dilation_h_factor | ||
) |
Compute [top padding + bottom padding] (or [left padding + right padding]). If this returns an even number, top = return value / 2 and bottom = return value - top If this returns an odd number, top = return value / 2 and bottom = return value - top (so, bottom = top + 1)
Code based on https://www.tensorflow.org/api_guides/python/nn#Convolution
Definition at line 38 of file Padding.cpp.
References nncc::core::ADT::tensor::Shape::dim(), coco::Padding2D::left(), nncc::core::ADT::tensor::Shape::rank(), and coco::Padding2D::top().
Referenced by conv2D_padding(), depthwiseConv2D_padding(), and pool2D_padding().
coco::Padding2D tflimport::pool2D_padding | ( | const tflite::Pool2DOptions * | options, |
const tensor::Shape & | ifm_shape, | ||
const int | filter_w, | ||
const int | filter_h | ||
) |
Definition at line 81 of file Padding.cpp.
References get_padding().
Referenced by tflimport::AvgPool2DGraphBuilder::build(), and tflimport::MaxPool2DGraphBuilder::build().
void tflimport::set_module_inputs | ( | coco::Module * | m, |
TensorContext & | ctx, | ||
TensorBags & | bags, | ||
const IndexVector & | inputs | ||
) |
Set module input operands and its information.
Definition at line 36 of file Frontend.cpp.
References tflimport::TensorBags::bag(), m, tflimport::TensorContext::name(), and tflimport::TensorContext::shape().
void tflimport::set_module_outputs | ( | coco::Module * | m, |
TensorContext & | ctx, | ||
TensorBags & | bags, | ||
const IndexVector & | outputs | ||
) |
Set module output operands and its information.
Definition at line 60 of file Frontend.cpp.
References tflimport::TensorBags::bag(), m, tflimport::TensorContext::name(), and tflimport::TensorContext::shape().