phlower.nn.Reducer¶
- class phlower.nn.Reducer(activation, operator, nodes=None)[source]¶
Bases:
IPhlowerCoreModule
,Module
Reducer is a neural network module that performs a reduction operation on the input tensor.
- Parameters:
activation (str) – Name of the activation function to apply to the output.
operator (str) – Name of the operator to apply to the input tensors. “add” or “mul”. Default is “add”.
nodes (list[int]) – List of feature dimension sizes (The last value of tensor shape).
Examples
>>> reducer = Reducer(activation="relu", operator="add", nodes=[10, 20, 30]) >>> reducer(data)
Methods
forward
(data, *[, field_data])forward function which overloads torch.nn.Module
from_setting
(setting)Create Reducer from setting object
Return name of Reducer
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: