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

tflchef operator builder for StridedSlice More...

#include <StridedSlice.h>

Collaboration diagram for tflchef::TFliteOpStridedSlice:

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 StridedSlice

Definition at line 28 of file StridedSlice.h.

Member Function Documentation

◆ build()

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

Implements tflchef::TFliteOpChef.

Definition at line 40 of file StridedSlice.cpp.

41{
42 tflchef::Operation *operation = ctx->chefop;
43 const tflite::Operator *op = ctx->tflop;
44
45 auto op_params = op->builtin_options_as_StridedSliceOptions();
46 assert(op_params != nullptr);
47
48 operation->set_type("StridedSlice");
49
50 auto op_options = operation->mutable_strided_slice_options();
51
52 op_options->set_begin_mask(op_params->begin_mask());
53 op_options->set_end_mask(op_params->end_mask());
54 op_options->set_ellipsis_mask(op_params->ellipsis_mask());
55 op_options->set_new_axis_mask(op_params->new_axis_mask());
56 op_options->set_shrink_axis_mask(op_params->shrink_axis_mask());
57 return operation;
58}

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

◆ filler()

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

Implements tflchef::TFliteOpChef.

Definition at line 24 of file StridedSlice.cpp.

26{
27 const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
28
29 // for begin, end and strides
30 for (int32_t index = 1; index <= 3; ++index)
31 {
32 const tflite::Tensor *tensor = import->tensors()->Get(inputs[index]);
33 assert(tensor->type() == tflite::TensorType::TensorType_INT32);
34 const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
35 auto vec = extract_buffer<int32_t>(buffer);
36 import->set_tensor_filler(inputs[index], vec);
37 }
38}
loco::GraphInputIndex index(const TFPlaceholder *node)
Definition TFNode.cpp:54
std::vector< T > as_index_vector(const flatbuffers::Vector< T > *flat_array)
Definition Convert.h:47

References tflchef::as_index_vector().


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