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

tflchef operator builder for Gather More...

#include <Gather.h>

Collaboration diagram for tflchef::TFliteOpGather:

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 Gather

Definition at line 28 of file Gather.h.

Member Function Documentation

◆ build()

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

Implements tflchef::TFliteOpChef.

Definition at line 42 of file Gather.cpp.

43{
44 tflchef::Operation *operation = ctx->chefop;
45 const tflite::Operator *op = ctx->tflop;
46
47 auto op_params = op->builtin_options_as_GatherOptions();
48 assert(op_params != nullptr);
49
50 operation->set_type("Gather");
51
52 auto op_options = operation->mutable_gather_options();
53
54 op_options->set_axis(op_params->axis());
55
56 return operation;
57}

References tflchef::RecipeChefContext::chefop, and tflchef::RecipeChefContext::tflop.

◆ filler()

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

Implements tflchef::TFliteOpChef.

Definition at line 24 of file Gather.cpp.

26{
27 // Nothing to do with filler
28 // But second input has filler for constant inputs
29 const auto &inputs = *op->inputs();
30
31 const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
32 assert(tensor->type() == tflite::TensorType::TensorType_INT32);
33 const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
34
35 if (buffer && buffer->data())
36 {
37 auto vec = extract_buffer<int32_t>(buffer);
38 import->set_tensor_filler(inputs[1], vec);
39 }
40}

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