29 return circle::ActivationFunctionType_NONE;
31 return circle::ActivationFunctionType_RELU;
33 return circle::ActivationFunctionType_RELU6;
43namespace circle_detail
60 circle::BuiltinOperator custom_code = circle::BuiltinOperator_CUSTOM;
71 return circle::Padding_VALID;
80 bool same_padding_criterion_1 =
81 (
static_cast<uint32_t
>(ofm.
_dims[1]) == (ifm.
_dims[1] - 1) / stride->vertical() + 1) &&
82 (
static_cast<uint32_t
>(ofm.
_dims[2]) == (ifm.
_dims[2] - 1) / stride->horizontal() + 1);
85 bool same_padding_criterion_2 =
89 if (same_padding_criterion_1 && same_padding_criterion_2)
90 return circle::Padding_SAME;
98 return circle::Padding_VALID;
100 return circle::Padding_SAME;
107 for (uint32_t in = 0; in < graph->inputs()->
size(); ++in)
110 auto name = graph->inputs()->at(in)->name();
114 for (uint32_t out = 0; out < graph->outputs()->
size(); ++out)
117 auto name = graph->outputs()->at(out)->name();
123 gd.
_data_format = circle::DataFormat::DataFormat_CHANNELS_LAST;
135 TFLTensorIndexAnnotation(
const TFLTensorIndex &index) : _index{index}
151 assert(node->
annot<TFLTensorIndexAnnotation>() ==
nullptr);
152 node->
annot(std::make_unique<TFLTensorIndexAnnotation>(tensor_id));
157 assert(node->
annot<TFLTensorIndexAnnotation>() !=
nullptr);
158 return node->
annot<TFLTensorIndexAnnotation>()->index();
#define INTERNAL_EXN(msg)
@ brief throw internal exception with message
#define INTERNAL_EXN_V(msg, val)
@ brief throw internal exception with message and value
const T * annot(void) const
Retrieve a stored annotation of type T.
Logical unit of computation.
uint32_t left(void) const
uint32_t bottom(void) const
uint32_t right(void) const
Stride configuration for N-dimensional spatial operations.
void registerGraphIOName(loco::Graph *graph, SerializedModelData &gd)
Register graph input and output names to SerializedModelData.
circle::Padding getOpPadding(const loco::Padding2D *pad, const loco::Stride< 2 > *stride, const ShapeDescription &ifm, const ShapeDescription &ofm)
TFLTensorIndex get_tensor_index(loco::Node *node)
void set_tensor_index(loco::Node *node, const TFLTensorIndex &tensor_id)
circle::ActivationFunctionType to_circle_actfunc(locoex::FusedActFunc func)
Pull * pull_node(Graph *g, const GraphInputIndex &index)
Find a Pull node with a given input index.
Push * push_node(Graph *g, const GraphOutputIndex &index)
Find a Push node with a given output index.
std::vector< int32_t > _dims
uint32_t registerBuiltinOpcode(circle::BuiltinOperator builtin_code)
if opcode is not registered in table of opcodes add it
std::unordered_map< loco::Pull *, std::string > _pull_to_name
std::unordered_map< OpCode, std::string > _custom_operator_codes
std::unordered_map< loco::Push *, std::string > _push_to_name
std::unordered_map< OpCode, uint32_t > _operator_codes
uint32_t registerCustomOpcode(const std::string &custom_op)
circle::DataFormat _data_format
@DataFormat for SubGraph
Extensible Node Metadata.