bitorch.layers.extensions.layer_implementation.BaseImplementation

class bitorch.layers.extensions.layer_implementation.BaseImplementation(*args: Any, **kwargs: Any)[source]

Defines the class interface of a custom layer implementation of a certain layer type.

Methods

__init__

can_clone

Returns whether this layer class supports the implementation of a given layer recipe.

create_clone_from

Create a new layer based on a given layer recipe (can be expected to be from the default category).

is_default_implementation

returns:

whether this implementation is the default implementation of the current layer type

__init__(*args: Any, **kwargs: Any) None[source]
classmethod can_clone(recipe: LayerRecipe) Tuple[bool, str][source]

Returns whether this layer class supports the implementation of a given layer recipe.

Parameters:

recipe (LayerRecipe) – the layer which should be checked for cloning

Returns:

Whether the layer can be cloned or not and an info message if it can not be cloned

classmethod create_clone_from(recipe: LayerRecipe, device: Optional[device] = None) Any[source]

Create a new layer based on a given layer recipe (can be expected to be from the default category).

Parameters:
  • recipe – the layer which should be cloned

  • device – the device on which the layer is going to be run

Returns:

A clone of the LayerRecipe in the current class implementation

classmethod is_default_implementation() bool[source]
Returns:

whether this implementation is the default implementation of the current layer type

Return type:

bool