Describe the bug
Feedforward operations are useful in QML since it allows us to encode certain parameters conditional on certain measurements. Currently, FeedForwardBlock rejects any perceval Experiment with parameters encoded outside the initial layer.
To Reproduce
from merlin.algorithms import FeedForwardBlock
from perceval import *
experiment = Experiment(3)
experiment.add(0, Unitary.random(3))
experiment.with_input([1, 1, 0])
experiment.add(0, Detector.pnr())
x_param = P("x")
feedforward = FFCircuitProvider(1, 0, Circuit(2))
feedforward.add_configuration([0], BS(x_param) // BS(P("A")))
feedforward.add_configuration([1], BS(x_param) // BS(P("B")))
experiment.add(0, feedforward)
feedforward = FeedForwardBlock(
experiment,
trainable_parameters=["A", "B"],
input_parameters=["x"]
)
Observed results
Immediate ValueError.
ValueError: The first stage must use all of the input parameters. Create you own stages with variable input parameters with the partial measurement strategy instead
Expected behavior
FeedForward block should be able to inspect all of the configurations in the feedforward configurator and detect all parameters.
Describe the bug
Feedforward operations are useful in QML since it allows us to encode certain parameters conditional on certain measurements. Currently,
FeedForwardBlockrejects any percevalExperimentwith parameters encoded outside the initial layer.To Reproduce
Observed results
Immediate ValueError.
Expected behavior
FeedForward block should be able to inspect all of the configurations in the feedforward configurator and detect all parameters.