Skip to content

Inconsistent threshold detection results in GBS using chain-rule method #146

@Hugh-888

Description

@Hugh-888

Inconsistent sampling results of GBS with detector='threshold' using chain-rule method
code:

# Initialize a 2-mode circuit with cutoff=5
cir = dq.QumodeCircuit(2, 'vac', cutoff=5, backend='gaussian')
# Define trainable parameters
r0 = torch.nn.Parameter(torch.tensor(0.5))
r1 = torch.nn.Parameter(torch.tensor(1.0))
# Add squeezing gates
cir.s(0, r=r0)
cir.s(1, r=r1)
# Define trainable parameter for beamsplitter
theta = torch.nn.Parameter(torch.tensor(1.0))
# Add a beamsplitter gate
cir.bs([0, 1], inputs=[theta, 1])
# Forward process
cir()
# Print the measurement results
# with different detectors
sample = cir.measure(shots=100, detector='threshold')
print(sample)
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions