Converter

class webdnn.frontend.converter.Converter[source]

This class converts computation graph in other DNN library into WebDNN IR format.

If you want to implement your custom converter, see Use your custom operator.

convert(*args, **kwargs)[source]

Convert computation graph into WebDNN IR format. Arguments of this method is defined in each child class.

Returns:Graph in WebDNN IR format
get_variable(key)[source]

Gets variable object corresponding to the key.

Parameters:key (object) – key
Returns:variable object in WebDNN IR Format.
Return type:(Variable)
has_variable(key)[source]

Check whether variable object corresponding to the key is generated or not.

Parameters:key (object) – key
Returns:If True, the key is contained.
Return type:(bool)
classmethod register_handler(key)[source]

Decorator to register operator converter handler.

Parameters:key – operator type name. As default, it’s the class name for each operator instance. you can change this behavior by overriding serialize_operator_type().
Returns:
serialize_operator_type(operator)[source]

Serialize operators type in other DNN framework into strings

Parameters:operator (Type) – operator type in other DNN framework
Returns:serialized value
Return type:(str)
set_variable(key, variable)[source]

Stores variable object corresponding to the key.

Parameters:
  • key (object) – key
  • variable (Variable) – variable
  • overwrite (bool) – When False, if the key is already exist, KeyError is raised.