We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class QLayer_input(tq.QuantumModule): def __init__(self): super().__init__() self.n_wires = 4 self.encoder = tq.GeneralEncoder( [ {'input_idx': [0], 'func': 'rx', 'wires': [0]}, {'input_idx': [1], 'func': 'rx', 'wires': [1]}, {'input_idx': [2], 'func': 'rx', 'wires': [2]}, {'input_idx': [3], 'func': 'rx', 'wires': [3]}, ]) self.rx0 = tq.RX(has_params=True, trainable=True) self.rx1 = tq.RX(has_params=True, trainable=True) self.rx2 = tq.RX(has_params=True, trainable=True) self.rx3 = tq.RX(has_params=True, trainable=True) self.measure = tq.MeasureAll(tq.PauliZ) def forward(self, x): qdev = tq.QuantumDevice(n_wires=self.n_wires, bsz=x.shape[0], device=x.device) self.encoder(qdev, x) self.rx0(qdev, wires=0) self.rx1(qdev, wires=1) self.rx2(qdev, wires=2) self.rx3(qdev, wires=3) for k in range(self.n_wires): if k==self.n_wires-1: tqf.cnot(qdev, wires=[k, 0]) else: tqf.cnot(qdev, wires=[k, k+1]) `return(self.measure(qdev))`
this is a simple QNN, I want to know how to add noise in it? Are there any examples?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
this is a simple QNN, I want to know how to add noise in it? Are there any examples?
The text was updated successfully, but these errors were encountered: