Skip to content

LinearOpticalSetup

svetlanna.LinearOpticalSetup

LinearOpticalSetup(elements: Iterable[Element])

Bases: Module

Linear optical network composed of Element instances. It works the same way as a torch.nn.Sequential module, but with some additional features.

Parameters:

  • elements (Iterable[Element]) –

    Optical elements that make up the setup. Elements are evaluated in the provided order.

Examples:

import svetlanna as sv

setup = sv.LinearOpticalSetup(
    elements=[
        element1,
        element2,
        element3,
    ]
)

output_wavefront = setup(input_wavefront)

reverse

reverse(Ein: Tensor) -> Tensor

Reverse propagation through the setup. All elements in the setup must have a reverse method. If any element lacks this method, a TypeError is raised.

Parameters:

  • Ein (Tensor) –

    Input wavefront to reverse propagate.

Returns:

  • Tensor

    Output wavefront after reverse propagation.

Raises:

  • TypeError

    If reverse propagation is not supported by all elements in the setup.