ONE - On-device Neural Engine
Loading...
Searching...
No Matches
circlechef::CircleOpBCQGather Class Reference

circlechef operator builder for BCQGather More...

#include <BCQGather.h>

Collaboration diagram for circlechef::CircleOpBCQGather:

Public Member Functions

void filler (const circle::Operator *op, CircleImport *import, circlechef::ModelRecipe *model_recipe) const override
 
circlechef::Operation * build (const circle::Operator *op, CircleImport *import, circlechef::ModelRecipe *model_recipe) const override
 
- Public Member Functions inherited from circlechef::CircleOpChef
virtual ~CircleOpChef ()
 

Detailed Description

circlechef operator builder for BCQGather

Definition at line 28 of file BCQGather.h.

Member Function Documentation

◆ build()

circlechef::Operation * circlechef::CircleOpBCQGather::build ( const circle::Operator *  op,
CircleImport import,
circlechef::ModelRecipe *  model_recipe 
) const
overridevirtual

Implements circlechef::CircleOpChef.

Definition at line 50 of file BCQGather.cpp.

52{
53 auto op_params = op->builtin_options_as_BCQGatherOptions();
54 assert(op_params != nullptr);
55
56 auto operation = model_recipe->add_operation();
57
58 operation->set_type("BCQGather");
59
60 auto op_options = operation->mutable_bcq_gather_options();
61
62 op_options->set_input_hidden_size(op_params->input_hidden_size());
63 op_options->set_axis(op_params->axis());
64
65 return operation;
66}

◆ filler()

void circlechef::CircleOpBCQGather::filler ( const circle::Operator *  op,
CircleImport import,
circlechef::ModelRecipe *  model_recipe 
) const
overridevirtual

Implements circlechef::CircleOpChef.

Definition at line 24 of file BCQGather.cpp.

26{
27 const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
28
29 import->set_tensor_filler(inputs[0]);
30
31 const circle::Tensor *tensor1 = import->tensors()->Get(inputs[1]);
32 assert(tensor1->type() == circle::TensorType::TensorType_INT32);
33 const circle::Buffer *buffer1 = import->buffers()->Get(tensor1->buffer());
34 auto vec1 = extract_buffer<int32_t>(buffer1);
35 import->set_tensor_filler(inputs[1], vec1);
36
37 const circle::Tensor *tensor2 = import->tensors()->Get(inputs[2]);
38 assert(tensor2->type() == circle::TensorType::TensorType_INT32);
39 const circle::Buffer *buffer2 = import->buffers()->Get(tensor2->buffer());
40 auto vec2 = extract_buffer<int32_t>(buffer2);
41 import->set_tensor_filler(inputs[2], vec2);
42
43 const circle::Tensor *tensor3 = import->tensors()->Get(inputs[3]);
44 assert(tensor3->type() == circle::TensorType::TensorType_INT32);
45 const circle::Buffer *buffer3 = import->buffers()->Get(tensor3->buffer());
46 auto vec3 = extract_buffer<int32_t>(buffer3);
47 import->set_tensor_filler(inputs[3], vec3);
48}
std::vector< T > as_index_vector(const flatbuffers::Vector< T > *flat_array)
Definition Convert.h:43

References circlechef::as_index_vector().


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