layers.linear_projection_config

Classes

LinearProjectionConfig

Configuration for a LinearProjection layer.

Module Contents

class layers.linear_projection_config.LinearProjectionConfig(/, **data)

Bases: pydantic.BaseModel

Configuration for a LinearProjection layer.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

input_dim: int = None

Input dimension of the linear projection.

output_dim: int = None

Output dimension of the linear projection.

ndim: None | int = None

Number of dimensions of the input domain. Either None (Linear projection), 1D (sequence), 2D, or 3D. Defaults to None.

bias: bool = None

If true, use bias term in the linear projection. Defaults to True.

optional: bool = None

If true and input_dim==output_dim (i.e., there is no up/down projection), then the identity mapping is used. Defaults to False.

init_weights: emmi.types.InitWeightsMode = None

Initialization method of the weights of the MLP. Options are “torch” (i.e., similar to the module) or “truncnormal002”, or “zero”.Defaults to “torch”.

validate_ndim()

Validate the ndim field to ensure it is either None, 1, 2, or 3.

Return type:

None