P.2.2 - Error: 'tensor' object is not callable

I’m constantly getting the error that the tensor object is not callable. Could someone point out what I am doing wrong?

Hey @Qimi and welcome to the forum! :slight_smile:

I’m not sure what’s happening here. I tried the same solution and it’s working for me:

estimation_wires = [0, 1, 2]
target_wires = [3]

def apply_controlled_powers_of_U(unitary):
        unitary (array [complex]): A unitary matrix

    #for k in estimation_wires:
    for i in range(len(estimation_wires)):
        U = U_power_2k(unitary, len(estimation_wires)-i-1)
        qml.ctrl(qml.QubitUnitary, control=estimation_wires[i])(U, wires=target_wires)

Can you put print(qml.about()) above the function and show me what it says?

Thank you @isaacdevlugt for having a look at my solution. It is really strange, I just tried again and now it is working.

For completeness, my output of qml.about() is:

Name: PennyLane
Version: 0.31.0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: https://github.com/PennyLaneAI/pennylane
License: Apache License 2.0
Location: /var/lang/lib/python3.10/site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml
Required-by: PennyLane-Lightning

Platform info:           Linux-4.14.255-328-268.540.amzn2.x86_64-x86_64-with-glibc2.26
Python version:          3.10.12
Numpy version:           1.23.5
Scipy version:           1.10.0
Installed devices:
- default.gaussian (PennyLane-0.31.0)
- default.mixed (PennyLane-0.31.0)
- default.qubit (PennyLane-0.31.0)
- default.qubit.autograd (PennyLane-0.31.0)
- default.qubit.jax (PennyLane-0.31.0)
- default.qubit.tf (PennyLane-0.31.0)
- default.qubit.torch (PennyLane-0.31.0)
- default.qutrit (PennyLane-0.31.0)
- null.qubit (PennyLane-0.31.0)
- lightning.qubit (PennyLane-Lightning-0.31.0)
1 Like

Strange! Okay… well, glad it’s working for you now. Let us know if you have any more issues :slight_smile: