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

circlechef operator builder for BCQFullyConnected More...

#include <BCQFullyConnected.h>

Collaboration diagram for circlechef::CircleOpBCQFullyConnected:

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 BCQFullyConnected

Definition at line 28 of file BCQFullyConnected.h.

Member Function Documentation

◆ build()

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

Implements circlechef::CircleOpChef.

Definition at line 45 of file BCQFullyConnected.cpp.

48{
49 auto op_params = op->builtin_options_as_BCQFullyConnectedOptions();
50 assert(op_params != nullptr);
51
52 auto operation = model_recipe->add_operation();
53
54 operation->set_type("BCQFullyConnected");
55
56 auto op_options = operation->mutable_bcq_fully_connected_options();
57
58 op_options->set_weights_hidden_size(op_params->weights_hidden_size());
59 op_options->set_activation(as_circlechef_activation(op_params->fused_activation_function()));
60
61 return operation;
62}
circlechef::Activation as_circlechef_activation(const circle::ActivationFunctionType type)
Definition Convert.cpp:55

References circlechef::as_circlechef_activation().

◆ filler()

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

Implements circlechef::CircleOpChef.

Definition at line 24 of file BCQFullyConnected.cpp.

26{
27 const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
28
29 import->set_tensor_filler(inputs[1]);
30 import->set_tensor_filler(inputs[3]);
31
32 const circle::Tensor *tensor2 = import->tensors()->Get(inputs[2]);
33 assert(tensor2->type() == circle::TensorType::TensorType_INT32);
34 const circle::Buffer *buffer2 = import->buffers()->Get(tensor2->buffer());
35 auto vec2 = extract_buffer<int32_t>(buffer2);
36 import->set_tensor_filler(inputs[2], vec2);
37
38 const circle::Tensor *tensor4 = import->tensors()->Get(inputs[4]);
39 assert(tensor4->type() == circle::TensorType::TensorType_INT32);
40 const circle::Buffer *buffer4 = import->buffers()->Get(tensor4->buffer());
41 auto vec4 = extract_buffer<int32_t>(buffer4);
42 import->set_tensor_filler(inputs[4], vec4);
43}
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: