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

tflchef operator builder for ArgMin More...

#include <ArgMin.h>

Collaboration diagram for tflchef::TFliteOpArgMin:

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 ArgMin

Definition at line 28 of file ArgMin.h.

Member Function Documentation

◆ build()

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

Implements tflchef::TFliteOpChef.

Definition at line 37 of file ArgMin.cpp.

38{
39 tflchef::Operation *operation = ctx->chefop;
40 const tflite::Operator *op = ctx->tflop;
41
42 auto op_params = op->builtin_options_as_ArgMinOptions();
43 assert(op_params != nullptr);
44
45 operation->set_type("ArgMin");
46
47 auto op_options = operation->mutable_argmin_options();
48
49 op_options->set_output_type(as_tflchef_type(op_params->output_type()));
50
51 return operation;
52}
tflchef::TensorType as_tflchef_type(const tflite::TensorType type)
Definition Convert.cpp:22

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

◆ filler()

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

Implements tflchef::TFliteOpChef.

Definition at line 24 of file ArgMin.cpp.

26{
27 // filler for second input, argmin/dim
28 const auto &inputs = *op->inputs();
29
30 const tflite::Tensor *dim_tensor = import->tensors()->Get(inputs[1]);
31 assert(dim_tensor->type() == tflite::TensorType::TensorType_INT32);
32 const tflite::Buffer *buffer = import->buffers()->Get(dim_tensor->buffer());
33 auto vec = extract_buffer<int32_t>(buffer);
34 import->set_tensor_filler(inputs[1], vec);
35}

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