# Beam-splitter in quantum neural networks

**URL:** <https://discuss.pennylane.ai/t/beam-splitter-in-quantum-neural-networks/7514>\
**Category:** PennyLane Strawberry Fields\
**Created:** [November 8, 2024, 1:23pm UTC](https://discuss.pennylane.ai/t/beam-splitter-in-quantum-neural-networks/7514 "2024-11-08T13:23:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giorgio\_Panichi](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/giorgio_panichi/32/3326_2.png) [@Giorgio\_Panichi](https://discuss.pennylane.ai/u/Giorgio_Panichi)\
**Post date:** [November 8, 2024, 1:23pm UTC](https://discuss.pennylane.ai/t/beam-splitter-in-quantum-neural-networks/7514/1 "2024-11-08T13:23:23Z")

</div>

I have an inquiry about the " Quantum neural network" page on Strawberry Fields ([Hardware and cloud — Strawberry Fields 0.23.0 documentation](https://strawberryfields.readthedocs.io/en/stable/introduction/photonic_hardware.html)).

Specifically on the " Extending to quantum neural networks" section the 1 to 4 qumode CV quantum neural network layers are shown and explained.

Here it’s explained that the BS (Beam Splitters) present in the circuit are “two-mode phaseless beamsplitters” which, as I understand, means that the BS\_gate will have only 1 parameter as it’s input.

On the other hand on the code below, on the “Utility function” section, two parameters are used in the BS\_Gate.  
Code below:

```auto
def interferometer(params, q):
    """Parameterised interferometer acting on ``N`` modes.

    Args:
        params (list[float]): list of length ``max(1, N-1) + (N-1)*N`` parameters.

            * The first ``N(N-1)/2`` parameters correspond to the beamsplitter angles
            * The second ``N(N-1)/2`` parameters correspond to the beamsplitter phases
            * The final ``N-1`` parameters correspond to local rotation on the first N-1 modes

        q (list[RegRef]): list of Strawberry Fields quantum registers the interferometer
            is to be applied to
    """
    N = len(q)
    theta = params[:N*(N-1)//2]
    phi = params[N*(N-1)//2:N*(N-1)]
    rphi = params[-N+1:]

    if N == 1:
        # the interferometer is a single rotation
        ops.Rgate(rphi[0]) | q[0]
        return

    n = 0 # keep track of free parameters

    # Apply the rectangular beamsplitter array
    # The array depth is N
    for l in range(N):
        for k, (q1, q2) in enumerate(zip(q[:-1], q[1:])):
            # skip even or odd pairs depending on layer
            if (l + k) % 2 != 1:
                ops.BSgate(theta[n], phi[n]) | (q1, q2)
                n += 1

    # apply the final local phase shifts to all modes except the last one
    for i in range(max(1, N - 1)):
        ops.Rgate(rphi[i]) | q[i]

```

Therefore I do not understand what is meant by “phase-less beam splitters”.

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [November 11, 2024, 7:42pm UTC](https://discuss.pennylane.ai/t/beam-splitter-in-quantum-neural-networks/7514/2 "2024-11-11T19:42:10Z")

</div>

Hi @Giorgio_Panichi , welcome to the Forum!

If you look [here in the docs for BSgate](https://strawberryfields.readthedocs.io/en/stable/code/api/strawberryfields.ops.BSgate.html) you’ll notice that the first parameter is the _transmittivity angle_ 𝜃, which is related to the transmission amplitude of the beamsplitter. The second parameter is the _phase angle_ 𝜙, which is related to the reflection amplitude of the beamsplitter. In this case there’s no global phase, which is why this is considered a phaseless beamsplitter. I know the term is confusing given that they’re all angles, but I hope this clarified things a bit.

Let me know if this helps!
