ONE - On-device Neural Engine
Loading...
Searching...
No Matches
tflimport::TensorBags Class Reference

Pre-creates coco:Bags for each operands(tensors) More...

#include <TensorBags.h>

Public Member Functions

void prepare (const tflite::SubGraph *graph, std::unique_ptr< coco::Module > &m)
 
coco::Bagbag (int32_t tensor_id)
 
std::map< uint32_t, coco::Bag * >::iterator begin ()
 
std::map< uint32_t, coco::Bag * >::iterator end ()
 

Detailed Description

Pre-creates coco:Bags for each operands(tensors)

Definition at line 37 of file TensorBags.h.

Member Function Documentation

◆ bag()

◆ begin()

std::map< uint32_t, coco::Bag * >::iterator tflimport::TensorBags::begin ( )
inline

Definition at line 55 of file TensorBags.h.

55{ return _bag_ctx.begin(); }

◆ end()

std::map< uint32_t, coco::Bag * >::iterator tflimport::TensorBags::end ( )
inline

Definition at line 57 of file TensorBags.h.

57{ return _bag_ctx.end(); }

◆ prepare()

void tflimport::TensorBags::prepare ( const tflite::SubGraph *  graph,
std::unique_ptr< coco::Module > &  m 
)
inline

Definition at line 40 of file TensorBags.h.

41 {
42 for (uint32_t tensor_id = 0; tensor_id < graph->tensors()->size(); ++tensor_id)
43 {
44 auto const tensor_info = graph->tensors()->Get(tensor_id);
45 auto const tensor_shape = as_tensor_shape(tensor_info->shape());
46 auto const tensor_bag = m->entity()->bag()->create(num_elements(tensor_shape));
47
48 _bag_ctx[tensor_id] = tensor_bag;
49 }
50 }
uint32_t num_elements(const Shape &shape)
The number of elements of a feature map of a given shape.
Definition Shape.h:59
tensor::Shape as_tensor_shape(const flatbuffers::Vector< int32_t > *shape)
Converts flatbuffers::Vector to nncc::core::ADT::tensor::Shape.
Definition Convert.cpp:42
int32_t size[5]
Definition Slice.cpp:35

References tflimport::as_tensor_shape(), m, and size.


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