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

#include <Cast.h>

Collaboration diagram for CastChef:

Public Member Functions

 CastChef (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
 
- Public Member Functions inherited from OpChef
virtual ~OpChef ()=default
 
virtual flatbuffers::Offset< flatbuffers::Vector< uint8_t > > custom_value (flatbuffers::FlatBufferBuilder &fbb) const
 
virtual ~OpChef ()=default
 
virtual flatbuffers::Offset< flatbuffers::Vector< uint8_t > > custom_value (flatbuffers::FlatBufferBuilder &fbb) const
 

Detailed Description

Definition at line 22 of file Cast.h.

Constructor & Destructor Documentation

◆ CastChef()

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

Definition at line 25 of file Cast.h.

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

Member Function Documentation

◆ code()

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

Implements OpChef.

Definition at line 31 of file Cast.h.

31{ return tflite::BuiltinOperator_CAST; }

◆ type()

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

Implements OpChef.

Definition at line 33 of file Cast.h.

33{ return tflite::BuiltinOptions_CastOptions; }

◆ value()

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

Implements OpChef.

Definition at line 22 of file Cast.cpp.

23{
24 auto &operation = (*_operation);
25
26 if (!operation.has_cast_options())
27 return 0;
28
29 auto tflite_in_data_type = as_tflite_tensortype(operation.cast_options().in_data_type());
30 auto tflite_out_data_type = as_tflite_tensortype(operation.cast_options().out_data_type());
31
32 tflite::CastOptionsBuilder cast_options_builder{fbb};
33 cast_options_builder.add_in_data_type(tflite_in_data_type);
34 cast_options_builder.add_out_data_type(tflite_out_data_type);
35
36 return cast_options_builder.Finish().Union();
37}
void Finish(Offset< T > root, const char *file_identifier=nullptr)
Finish serializing a buffer by writing the root offset.
tflite::TensorType as_tflite_tensortype(const tflchef::TensorType &value)
Definition Convert.cpp:60

References as_tflite_tensortype(), and flatbuffers::FlatBufferBuilder::Finish().


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