PyTorch-based MLP

../../../../../../../_images/MLPro-SL-pool-afct-fnn-pytorch_class_diagram.drawio.png

Ver. 1.1.0 (2023-03-10)

This module provides a template ready-to-use MLP model using PyTorch.

class mlpro.sl.pool.afct.fnn.pytorch.mlp.PyTorchMLP(p_input_space: ~mlpro.bf.math.basics.MSpace, p_output_space: ~mlpro.bf.math.basics.MSpace, p_output_elem_cls=<class 'mlpro.bf.math.basics.Element'>, p_threshold=0, p_buffer_size=0, p_ada: bool = True, p_visualize: bool = False, p_logging=True, **p_kwargs)

Bases: MLP, PyTorchHelperFunctions

Template class for an adaptive bi-multivariate mathematical function that adapts by supervised learning using PyTorch-based MLP.

Parameters:
  • p_input_space (MSpace) – Input space of function

  • p_output_space (MSpace) – Output space of function

  • p_output_elem_cls – Output element class (compatible to/inherited from class Element)

  • p_threshold (float) – Threshold for the difference between a setpoint and a computed output. Computed outputs with a difference less than this threshold will be assessed as ‘good’ outputs. Default = 0.

  • p_buffer_size (int) – Initial size of internal data buffer. Default = 0 (no buffering).

  • p_ada (bool) – Boolean switch for adaptivity. Default = True.

  • p_visualize (bool) – Boolean switch for visualisation. Default = False.

  • p_logging – Log level (see constants of class Log). Default: Log.C_LOG_ALL

  • p_kwargs (Dict) – Further model specific parameters (to be specified in child class).

C_TYPE = 'PyTorch-based Adaptive Function using MLP'
C_BUFFER_CLS

alias of PyTorchBuffer

forward(p_input: Tensor) Tensor

Forward propagation in neural networks to generate some output using PyTorch.

Parameters:

p_input (Element) – Input data

Returns:

output – Output data

Return type:

Element