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

tflchef operator builder for SPLIT More...

#include <Split.h>

Collaboration diagram for tflchef::TFliteOpSplit:

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 SPLIT

Definition at line 28 of file Split.h.

Member Function Documentation

◆ build()

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

Implements tflchef::TFliteOpChef.

Definition at line 38 of file Split.cpp.

39{
40 tflchef::Operation *operation = ctx->chefop;
41 const tflite::Operator *op = ctx->tflop;
42
43 operation->set_type("Split");
44
45 auto op_options = operation->mutable_split_options();
46
47 auto op_params = op->builtin_options_as_SplitOptions();
48 assert(op_params != nullptr);
49
50 op_options->set_num_splits(op_params->num_splits());
51 return operation;
52}

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

◆ filler()

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

Implements tflchef::TFliteOpChef.

Definition at line 24 of file Split.cpp.

26{
27 const auto &inputs = *op->inputs();
28
29 // for input split_dim
30 // NOTE unlike other Ops, Split input 0 is split_dim
31 const tflite::Tensor *tensor = import->tensors()->Get(inputs[0]);
32 assert(tensor->type() == tflite::TensorType::TensorType_INT32);
33 const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
34 auto vec = extract_buffer<int32_t>(buffer);
35 import->set_tensor_filler(inputs[0], vec);
36}

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