ONE - On-device Neural Engine
Loading...
Searching...
No Matches
MatMulChef Class Referencefinal

#include <MatMul.h>

Collaboration diagram for MatMulChef:

Public Member Functions

 MatMulChef (const tflchef::Operation *operation)
 
tflite::BuiltinOperator code (void) const override
 
tflite::BuiltinOptions type (void) const override
 
flatbuffers::Offset< void > value (flatbuffers::FlatBufferBuilder &fbb) const override
 
flatbuffers::Offset< flatbuffers::Vector< uint8_t > > custom_value (flatbuffers::FlatBufferBuilder &fbb) const override
 
- Public Member Functions inherited from OpChef
virtual ~OpChef ()=default
 
virtual ~OpChef ()=default
 

Detailed Description

Definition at line 22 of file MatMul.h.

Constructor & Destructor Documentation

◆ MatMulChef()

MatMulChef::MatMulChef ( const tflchef::Operation *  operation)
inlineexplicit

Definition at line 25 of file MatMul.h.

25 : _operation{operation}
26 {
27 // DO NOTHING
28 }

Member Function Documentation

◆ code()

tflite::BuiltinOperator MatMulChef::code ( void  ) const
inlineoverridevirtual

Implements OpChef.

Definition at line 31 of file MatMul.h.

31{ return tflite::BuiltinOperator_CUSTOM; }

◆ custom_value()

flatbuffers::Offset< flatbuffers::Vector< uint8_t > > MatMulChef::custom_value ( flatbuffers::FlatBufferBuilder fbb) const
overridevirtual

REGISTER_OP("MatMul") .Input("a: T") .Input("b: T") .Output("product: T") .Attr("transpose_a: bool = false") .Attr("transpose_b: bool = false") .Attr("T: {half, float, double, int32, complex64, complex128}") .SetShapeFn(shape_inference::MatMulShape)

Reimplemented from OpChef.

Definition at line 29 of file MatMul.cpp.

30{
31 auto &operation = (*_operation);
32
33 check_custom_op_value(operation, "MatMul");
34
46 auto flex_buffers = std::make_unique<flexbuffers::Builder>();
47 size_t map_start = flex_buffers->StartMap();
48
49 flex_buffers->Bool("transpose_a", operation.matmul_options().transpose_a());
50 flex_buffers->Bool("transpose_b", operation.matmul_options().transpose_b());
51 // TODO how do we support other types?
52 flex_buffers->Int("T", tflite::TensorType_FLOAT32);
53
54 flex_buffers->EndMap(map_start);
55 flex_buffers->Finish();
56
57 auto circle_custom_options = fbb.CreateVector(flex_buffers->GetBuffer());
59}
void check_custom_op_value(const tflchef::Operation &operation, const std::string &op_type)
Definition OpUtils.cpp:21
Offset< Vector< T > > CreateVector(const T *v, size_t len)
Serialize an array into a FlatBuffer vector.
flatbuffers::Offset< flatbuffers::Vector< uint8_t > > circle_custom_options(flatbuffers::FlatBufferBuilder &fb, const luci::CircleNode *node)

References check_custom_op_value(), and flatbuffers::FlatBufferBuilder::CreateVector().

◆ type()

tflite::BuiltinOptions MatMulChef::type ( void  ) const
inlineoverridevirtual

Implements OpChef.

Definition at line 33 of file MatMul.h.

33{ return tflite::BuiltinOptions_NONE; }

◆ value()

flatbuffers::Offset< void > MatMulChef::value ( flatbuffers::FlatBufferBuilder fbb) const
overridevirtual

Implements OpChef.

Definition at line 23 of file MatMul.cpp.


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