phlower.nn.Accessor¶
- class phlower.nn.Accessor(nodes=None, activation='identity', index=0)[source]¶
Bases:
IPhlowerCoreModule
,Module
Accessor is a neural network module that provides access to specific tensor data with optional activation.
This module is designed to access and process specific elements from input tensor collections. It can extract data at a specified index and apply an activation function to the result.
- Parameters:
nodes (list[int] | None (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).
index (int (optional)) – The index to access from the input tensor. Defaults to 0.
Examples
>>> accessor = Accessor(activation="relu", index=2) >>> output = accessor(input_data) # Applies activation to data[2]
Methods
forward
(data, *[, field_data])forward function which overloads torch.nn.Module
from_setting
(setting)Create Accessor from setting object
Return name of Accessor
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: