phlower.settings.ModuleSetting

class phlower.settings.ModuleSetting(*, nn_type, name, input_keys, output_key, destinations=None, no_grad=False, nn_parameters=None)[source]

Bases: IModuleSetting, BaseModel

Methods

get_destinations()

get_input_keys()

get_name()

get_output_info()

resolve(*resolved_outputs[, parent])

Attributes

model_computed_fields

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_extra

Get extra fields set during validation.

model_fields

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

nn_type

name of neural network type.

name

name of group

input_keys

key names of input variables

output_key

key names of output variables

destinations

name of destination modules.

no_grad

A Flag not to calculate gradient.

nn_parameters

parameters for neural networks.

Parameters:
  • nn_type (str)

  • name (str)

  • input_keys (list[str])

  • output_key (str)

  • destinations (list[str])

  • no_grad (bool)

  • nn_parameters (Annotated[IPhlowerLayerParameters, PlainValidator(func=~phlower.settings._module_parameter_setting._validate, json_schema_input_type=~typing.Any), PlainSerializer(func=~phlower.settings._module_parameter_setting._serialize, return_type=PydanticUndefined, when_used=always)])

destinations: list[str]

name of destination modules.

input_keys: list[str]

key names of input variables

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'destinations': FieldInfo(annotation=list[str], required=False, default_factory=<lambda>, frozen=True), 'input_keys': FieldInfo(annotation=list[str], required=True, frozen=True), 'name': FieldInfo(annotation=str, required=True, frozen=True), 'nn_parameters': FieldInfo(annotation=IPhlowerLayerParameters, required=False, default_factory=<lambda>, validate_default=True, metadata=[PlainValidator(func=<function _validate>, json_schema_input_type=typing.Any), PlainSerializer(func=<function _serialize>, return_type=PydanticUndefined, when_used='always')]), 'nn_type': FieldInfo(annotation=str, required=True, frozen=True), 'no_grad': FieldInfo(annotation=bool, required=False, default=False, frozen=True), 'output_key': FieldInfo(annotation=str, required=True, frozen=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

name: str

name of group

nn_parameters: PhlowerModuleParameters

parameters for neural networks. Allowed items depend on nn_type.

nn_type: str

name of neural network type. For example, GCN, MLP.

no_grad: bool

A Flag not to calculate gradient. Defauls to False.

output_key: str

key names of output variables