def qtransform(qnode, a, framework=jnp):
    'Transforms every RY(y) gate in a circuit to RX(-a*cos(y))'

    def construct(self, args, kwargs):
        'New quantum tape construct method, that performs\n        the transform on the tape in a define-by-run manner'
        t_op = []
        QNode.construct(self, args, kwargs)
        new_ops = []
        for o in self.qtape.operations:
            if isinstance(o, qml.RY):
                t_op.append(qml.RX(((- a) * framework.cos(o.data[0])), wires=o.wires))
                new_ops.append(t_op[(- 1)])
            else:
                new_ops.append(o)
        self.qtape._ops = new_ops
        self.qtape._update()
    import copy
    new_qnode = copy.deepcopy(qnode)
    new_qnode.construct = construct.__get__(new_qnode, QNode)
    return new_qnode
Transforms every RY(y) gate in a circuit to RX(-a*cos(y))
def qtransform(qnode, a, framework=jnp):
    

    def construct(self, args, kwargs):
        'New quantum tape construct method, that performs\n        the transform on the tape in a define-by-run manner'
        t_op = []
        QNode.construct(self, args, kwargs)
        new_ops = []
        for o in self.qtape.operations:
            if isinstance(o, qml.RY):
                t_op.append(qml.RX(((- a) * framework.cos(o.data[0])), wires=o.wires))
                new_ops.append(t_op[(- 1)])
            else:
                new_ops.append(o)
        self.qtape._ops = new_ops
        self.qtape._update()
    import copy
    new_qnode = copy.deepcopy(qnode)
    new_qnode.construct = construct.__get__(new_qnode, QNode)
    return new_qnode