ONE - On-device Neural Engine
Loading...
Searching...
No Matches
tflchef::TFliteOpReshape Class Reference

tflchef operator builder for Reshape More...

#include <Reshape.h>

Collaboration diagram for tflchef::TFliteOpReshape:

Public Member Functions

void filler (const tflite::Operator *op, TFliteImport *import, tflchef::ModelRecipe *model_recipe) const override
 
tflchef::Operation * build (RecipeChefContext *ctx) const override
 
- Public Member Functions inherited from tflchef::TFliteOpChef
virtual ~TFliteOpChef ()
 

Detailed Description

tflchef operator builder for Reshape

Definition at line 28 of file Reshape.h.

Member Function Documentation

◆ build()

tflchef::Operation * tflchef::TFliteOpReshape::build ( RecipeChefContext ctx) const
overridevirtual

Implements tflchef::TFliteOpChef.

Definition at line 37 of file Reshape.cpp.

38{
39 tflchef::Operation *operation = ctx->chefop;
40 const tflite::Operator *op = ctx->tflop;
41
42 operation->set_type("Reshape");
43
44 auto op_params = op->builtin_options_as_ReshapeOptions();
45 if (op_params != nullptr)
46 {
47 auto op_options = operation->mutable_reshape_options();
48
49 std::vector<int32_t> new_shape = as_index_vector(op_params->new_shape());
50 for (auto shape : new_shape)
51 {
52 op_options->add_new_shape(shape);
53 }
54 }
55
56 return operation;
57}
std::vector< T > as_index_vector(const flatbuffers::Vector< T > *flat_array)
Definition Convert.h:47

References tflchef::as_index_vector(), tflchef::RecipeChefContext::chefop, and tflchef::RecipeChefContext::tflop.

◆ filler()

void tflchef::TFliteOpReshape::filler ( const tflite::Operator *  op,
TFliteImport import,
tflchef::ModelRecipe *  model_recipe 
) const
overridevirtual

Implements tflchef::TFliteOpChef.

Definition at line 25 of file Reshape.cpp.

27{
28 const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
29
30 bool hasShape = (inputs.size() == 2);
31 if (hasShape)
32 {
33 fill_tensor_to_import(inputs[1], import);
34 }
35}
void fill_tensor_to_import(int32_t idx, TFliteImport *import)

References tflchef::as_index_vector(), and tflchef::fill_tensor_to_import().


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