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

Extracts and holds operand(tensor) information such as name, shape, and type. More...

#include <Context.h>

Public Member Functions

void prepare (const tflite::SubGraph *graph)
 
const std::string & name (uint32_t tensor_id)
 
const tensor::Shapeshape (uint32_t tensor_id)
 
const tflite::TensorType & type (uint32_t tensor_id)
 

Detailed Description

Extracts and holds operand(tensor) information such as name, shape, and type.

Definition at line 38 of file Context.h.

Member Function Documentation

◆ name()

const std::string & tflimport::TensorContext::name ( uint32_t  tensor_id)
inline

Definition at line 43 of file Context.h.

43{ return _name_ctx[tensor_id]; }

Referenced by tflimport::set_module_inputs(), and tflimport::set_module_outputs().

◆ prepare()

void tflimport::TensorContext::prepare ( const tflite::SubGraph *  graph)

Definition at line 35 of file Context.cpp.

36{
37 for (uint32_t tensor_id = 0; tensor_id < graph->tensors()->size(); ++tensor_id)
38 {
39 auto const tensor_info = graph->tensors()->Get(tensor_id);
40 auto const tensor_name = tensor_info->name()->str();
41 auto const tensor_shape = as_tensor_shape(tensor_info->shape());
42 auto const tensor_type = tensor_info->type();
43
44 _name_ctx[tensor_id] = tensor_name;
45 _shape_ctx[tensor_id] = tensor_shape;
46 _type_ctx[tensor_id] = tensor_type;
47 }
48}
const char * tensor_name(const circle::Tensor *tensor)
const char * tensor_type(const ::circle::Tensor *tensor)
Definition Helper.cpp:64
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(), and size.

◆ shape()

◆ type()

const tflite::TensorType & tflimport::TensorContext::type ( uint32_t  tensor_id)
inline

Definition at line 45 of file Context.h.

45{ return _type_ctx[tensor_id]; }

Referenced by tflimport::copy_tensors().


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