bitorch.layers.extensions.layer_recipe.LayerRecipe

class bitorch.layers.extensions.layer_recipe.LayerRecipe(layer: LayerContainer, args: Tuple[Any, ...], kwargs: Dict[str, Any])[source]

Data class to store a layer object and the arguments used to create it. It allows to create other implementations of the same layer later on.

Methods

__init__

get_arg

Get an argument from the stored args or kwargs.

get_positional_arg

Get a positional argument from the stored args.

Attributes

layer

args

kwargs

__init__(layer: LayerContainer, args: Tuple[Any, ...], kwargs: Dict[str, Any]) None
get_arg(pos: int, key: str, default: T) T[source]

Get an argument from the stored args or kwargs.

Parameters:
  • pos – the position of the argument if given as a positional arg

  • key – the name of the argument

  • default – the default value of the argument

Returns:

the argument value retrieved

get_positional_arg(pos: int) Any[source]

Get a positional argument from the stored args.

Parameters:

pos – the position of the argument if given as a positional arg

Returns:

the argument value retrieved