phlower.nn.LayerScaler

class phlower.nn.LayerScaler(scaling_method)[source]

Bases: IGenericPhlowerCoreModule[IPhlowerLayerParameters, PhlowerTensor], Module

LayerScaler is a neural network module that performs a scaling operation on the input tensor.

Parameters:

scaling_method (str) – The method of scaling to apply. Supported methods are: - “signed_log”: Applies the signed logarithm function to the input. - “asinh”: Applies the inverse hyperbolic sine function to the input.

Examples

>>> layer_scaler = LayerScaler(
...     scaling_method="signed_log"
... )
>>> layer_scaler(data)

Methods

forward(data, *[, field_data])

forward function which overloads torch.nn.Module

from_setting(setting)

Create LayerScaler from setting object

get_nn_name()

Return name of LayerScaler

Attributes

T_destination

call_super_init

dump_patches

training

forward(data, *, field_data=None, **kwards)[source]

forward function which overloads torch.nn.Module

Parameters:
  • data (IPhlowerTensorCollections) – IPhlowerTensorCollections data which receives from predecessors

  • field_data (ISimulationField | None) – ISimulationField | None Constant information through training or prediction

Returns:

Tensor object

Return type:

PhlowerTensor

classmethod from_setting(setting)[source]

Create LayerScaler from setting object

Parameters:

setting (LayerScalerSetting) – LayerScalerSetting setting object

Returns:

LayerScaler

Return type:

Self

classmethod get_nn_name()[source]

Return name of LayerScaler

Returns:

name

Return type:

str