Jazz 1.25.+
All Data Structures Namespaces Functions Variables Typedefs Pages
Public Member Functions | Private Member Functions | Private Attributes
jazz_bebop::OpCodes Class Reference

OpCodes: The opcodes. More...

#include <opcodes.h>

Inheritance diagram for jazz_bebop::OpCodes:
jazz_elements::Service

Public Member Functions

 OpCodes (pLogger a_logger, pConfigFile a_config)
 Bop: Start the OpCodes.
 
virtual StatusCode start ()
 A simple start()/shut_down() interface (Restart is: shut_down(TRUE):start())
 
virtual StatusCode shut_down ()
 
int latest_opset_version ()
 Get the latest opset version.
 
bool set_opset_version (int version)
 Set the opset version.
 
pOnnxOpCode get (stdName name)
 Get an ONNX OpCode.
 
- Public Member Functions inherited from jazz_elements::Service
 Service (pLogger a_logger, pConfigFile a_config)
 
virtual pChar const id ()
 
void log (int loglevel, const char *message)
 
void log_printf (int loglevel, const char *fmt,...)
 
bool get_conf_key (const char *key, int &value)
 
bool get_conf_key (const char *key, double &value)
 
bool get_conf_key (const char *key, std::string &value)
 

Private Member Functions

bool build_opcode_dict ()
 Build the opcode dictionary. This build the vector opcodes and the dictionary opcodes_idx from the content of onnx_conf.
 
bool fill_op_code (OnnxOpCode &op)
 Fill an ONNX OpCode. This completes all the fields of an OpCode other than name and version. It reads the configuration file onnx_conf and creates the necessary objects.
 
bool fill_all_dict_versions ()
 Fill all versions of the dictionary.
 
bool fill_tensor_types (TensorTypes &types, std::string &all_types)
 Fill the tensor types. This fills a list of tensor types from a string with the names of the types separated by commas.
 
bool fill_attribute_type (AttributeType &type, std::string &type_name)
 Fill the attribute type. This fills an attribute type from a string with the name of the type.
 

Private Attributes

ConfigFile onnx_conf = ConfigFile(nullptr)
 The ONNX opcodes reference stored as a ConfigFile.
 
int ir_vers = 0
 Argument of model.set_ir_version() (Stored as ONNX_IR_VERSION in config.)
 
int op_vers_latest = 0
 The latest opset version in onnx.ini.
 
int op_vers_current = 0
 The opset version in use, set by set_opset_version() or op_vers_latest.
 
OnnxOpCodeDict opcodes_idx = {}
 The index to the opcodes.
 
OnnxOpCodes opcodes = {}
 The opcodes parsed as binary objects.
 

Additional Inherited Members

- Data Fields inherited from jazz_elements::Service
pLogger p_log
 The logger.
 
pConfigFile p_conf
 The configuration file.
 

Detailed Description

OpCodes: The opcodes.

Constructor & Destructor Documentation

◆ OpCodes()

jazz_bebop::OpCodes::OpCodes ( pLogger  a_logger,
pConfigFile  a_config 
)

Bop: Start the OpCodes.

Parameters
a_loggerA pointer to the logger.
a_configA pointer to the configuration.

Member Function Documentation

◆ start()

StatusCode jazz_bebop::OpCodes::start ( )
virtual

A simple start()/shut_down() interface (Restart is: shut_down(TRUE):start())

Start (or restart) the Service

Returns
SERVICE_NO_ERROR if successful, some error if not.

This method should be overriden by something that actually starts the service, possibly using the configuration file in pConf.

Reimplemented from jazz_elements::Service.

◆ shut_down()

StatusCode jazz_bebop::OpCodes::shut_down ( )
virtual

Stop the Service

Returns
SERVICE_NO_ERROR if successful, some error if not.

This method should be overriden by something that actually stops the service, possibly using the configuration file in pConf.

Reimplemented from jazz_elements::Service.

◆ latest_opset_version()

int jazz_bebop::OpCodes::latest_opset_version ( )
inline

Get the latest opset version.

Returns
The latest opset version.

◆ set_opset_version()

bool jazz_bebop::OpCodes::set_opset_version ( int  version)
inline

Set the opset version.

Parameters
versionThe version to set.
Returns
True if the version was set. It must be between 1 and latest_opset_version().

◆ get()

pOnnxOpCode jazz_bebop::OpCodes::get ( stdName  name)
inline

Get an ONNX OpCode.

Parameters
nameThe name of the OpCode.
Returns
The OpCode. Null if not found. The version returned is highest version smaller or equal to the one set by set_opset_version().

◆ build_opcode_dict()

bool jazz_bebop::OpCodes::build_opcode_dict ( )
private

Build the opcode dictionary. This build the vector opcodes and the dictionary opcodes_idx from the content of onnx_conf.

Returns
True if the dictionary was built.

◆ fill_op_code()

bool jazz_bebop::OpCodes::fill_op_code ( OnnxOpCode op)
private

Fill an ONNX OpCode. This completes all the fields of an OpCode other than name and version. It reads the configuration file onnx_conf and creates the necessary objects.

Parameters
opThe OpCode to fill. (It must have the name and version set). This method fills its inputs, outputs and attributes.
Returns
True if the OpCode was filled.

◆ fill_all_dict_versions()

bool jazz_bebop::OpCodes::fill_all_dict_versions ( )
private

Fill all versions of the dictionary.

This fills every non existing version of an opcode to the previous existing one. E.g., if and opcode "foo" exists for versions 7 and 13, it makes the versions 8 to 12 point to the version 7 opcode and the versions 14 to 19 (latest) point to version 13.

This simplifies the search for the opcodes for any version predefined using set_opset_version().

Returns
True if all versions were filled

◆ fill_tensor_types()

bool jazz_bebop::OpCodes::fill_tensor_types ( TensorTypes types,
std::string &  all_types 
)
private

Fill the tensor types. This fills a list of tensor types from a string with the names of the types separated by commas.

Parameters
typesThe list of types to fill.
all_typesThe string with the names of the types separated by commas.
Returns
True if all types were found.

◆ fill_attribute_type()

bool jazz_bebop::OpCodes::fill_attribute_type ( AttributeType type,
std::string &  type_name 
)
private

Fill the attribute type. This fills an attribute type from a string with the name of the type.

Parameters
typeThe attribute type to fill.
type_nameThe name of the type.
Returns
True if the type was found.

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