phlower.nn.Concatenator

class phlower.nn.Concatenator(activation, nodes=None)[source]

Bases: IPhlowerCoreModule, Module

This class is designed to concatenate multiple tensors along the last dimension and apply an activation function to the concatenated result.

Parameters:
  • nodes (list of int, optional) – List of feature dimension sizes (The last value of tensor shape). Defaults to None.

  • activation (str, optional) – Name of the activation function to apply to the output. Defaults to “identity” (no activation).

Examples

>>> concatenator = Concatenator(activation="relu")
>>> concatenator(data)

Methods

forward(data, *[, field_data])

forward function which overloads torch.nn.Module

from_setting(setting)

Create Concatenator from setting object

get_nn_name()

Return name of Concatenator

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 Concatenator from setting object

Parameters:

setting (ConcatenatorSetting) – setting object

Returns:

Concatenator

Return type:

Self

classmethod get_nn_name()[source]

Return name of Concatenator

Returns:

name

Return type:

str