spark.core.specs#

Classes#

PortSpecs

Base specification for a port of an SparkModule.

InputSpec

Specification for an input port of an SparkModule.

OutputSpec

Specification for an output port of an SparkModule.

PortMap

Specification for an output port of an SparkModule.

ModuleSpecs

Specification for SparkModule automatic constructor.

Module Contents#

class spark.core.specs.PortSpecs(payload_type, shape, dtype, description=None)[source]#

Base specification for a port of an SparkModule.

Parameters:
payload_type: type[spark.core.payloads.SparkPayload] | None[source]#
shape: tuple[int, Ellipsis] | list[tuple[int, Ellipsis]] | None[source]#
dtype: jax.typing.DTypeLike | None[source]#
description: str | None = None[source]#
to_dict()[source]#

Serialize PortSpecs to dictionary

Return type:

dict[str, Any]

classmethod from_dict(dct)[source]#

Deserialize dictionary to PortSpecs

Parameters:

dct (dict)

Return type:

Self

class spark.core.specs.InputSpec(payload_type, shape, dtype, description=None)[source]#

Bases: PortSpecs

Specification for an input port of an SparkModule.

Parameters:
to_dict()[source]#

Serialize InputSpec to dictionary

Return type:

dict[str, Any]

classmethod from_dict(dct)[source]#

Deserialize dictionary to PortSpecs

Parameters:

dct (dict)

Return type:

Self

class spark.core.specs.OutputSpec(**kwargs)[source]#

Bases: PortSpecs

Specification for an output port of an SparkModule.

to_dict()[source]#

Serialize PortSpecs to dictionary

Return type:

dict[str, Any]

classmethod from_dict(dct)[source]#

Deserialize dictionary to PortSpecs

Parameters:

dct (dict)

Return type:

Self

class spark.core.specs.PortMap(origin, port)[source]#

Specification for an output port of an SparkModule.

Parameters:
origin: str[source]#
port: str[source]#
to_dict()[source]#

Serialize PortMap to dictionary

Return type:

dict[str, Any]

classmethod from_dict(dct)[source]#

Deserialize dictionary to PortMap

Parameters:

dct (dict)

Return type:

Self

class spark.core.specs.ModuleSpecs(name, module_cls, inputs, config)[source]#

Specification for SparkModule automatic constructor.

Parameters:
name: str[source]#
module_cls: type[spark.core.module.SparkModule][source]#
inputs: dict[str, list[PortMap]][source]#
config: spark.core.config.BaseSparkConfig[source]#
to_dict()[source]#

Serialize ModuleSpecs to dictionary

Return type:

dict[str, Any]

classmethod from_dict(dct)[source]#

Deserialize dictionary to ModuleSpecs

Parameters:

dct (dict)

Return type:

Self