phlower.nn.Rearrange

class phlower.nn.Rearrange(pattern, axes_lengths, save_as_time_series, save_as_voxel, **kwards)[source]

Bases: IPhlowerCoreModule, Module

Rearrange is a neural network module that performs a rearrange operation on the input tensor.

Parameters:
  • pattern (str) – Pattern of the rearrange operation.

  • axes_lengths (dict[str, int]) – Axes lengths of the rearrange operation.

  • save_as_time_series (bool) – Whether to save the output as a time series.

  • save_as_voxel (bool) – Whether to save the output as a voxel.

Examples

>>> rearrange = Rearrange(
...     pattern="t n f-> n f t",
...     axes_lengths={"f": 10, "t": 10},
...     save_as_time_series=True,
...     save_as_voxel=True
... )
>>> rearrange(data)

Methods

forward(data, *[, field_data])

forward function which overloads torch.nn.Module

from_setting(setting)

Create Rearrange from setting object

get_nn_name()

Return name of Rearrange

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

Parameters:

setting (RearrangeSetting) – setting object

Returns:

Rearrange

Return type:

Self

classmethod get_nn_name()[source]

Return name of Rearrange

Returns:

name

Return type:

str