ComplexSeparatedCombination

class ComplexSeparatedCombination(combination: str | Combination | type[Combination] | None = None, combination_kwargs: Mapping[str, Any] | None = None, imag_combination: str | Combination | type[Combination] | None = None, imag_combination_kwargs: Mapping[str, Any] | None = None)[source]

Bases: Combination

A combination for mixed complex & real representations.

Initialize the combination.

Note

if non-instantiated combinations are passed, separate instances will be created for real and imaginary parts

Parameters:
  • combination (str | Combination | type[Combination] | None) – the real combination, or a hint thereof

  • combination_kwargs (Mapping[str, Any] | None) – keyword-based parameters for the real combination

  • imag_combination (str | Combination | type[Combination] | None) – the imaginary combination, or a hint thereof. If None, use combination for both.

  • imag_combination_kwargs (Mapping[str, Any] | None) – keyword-based parameters for the imaginary combination; only used if imag_combination is not None

Methods Summary

forward(xs)

Combine a sequence of individual representations.

output_shape(input_shapes)

Calculate the output shape for the given input shapes.

Methods Documentation

forward(xs: Sequence[Tensor]) Tensor[source]

Combine a sequence of individual representations.

Parameters:

xs (Sequence[Tensor]) – shape: (*batch_dims, *input_dims_i) the individual representations

Returns:

shape: (*batch_dims, *output_dims) a combined representation

Return type:

Tensor

output_shape(input_shapes: Sequence[tuple[int, ...]]) tuple[int, ...][source]

Calculate the output shape for the given input shapes.

Note

this method runs a single forward pass if no symbolic computation is available.

Parameters:

input_shapes (Sequence[tuple[int, ...]]) – the input shapes without the batch dimensions

Returns:

the output shape

Return type:

tuple[int, …]