Hello everyone, I tried to do some coding on Colab. It seems that Colab have problem using pytorch interface. Here is my problem:
Code:
import os
import pennylane as qml
import numpy as np
import torch
from torch.autograd import Variable
import torch.optim as optim
dev = qml.device("default.qubit", wires=num_qubits)
qnode = qml.QNode(circuit, dev)
torch_qnode = qnode.to_torch()
print(type(dev))
print(type(qnode))
print(type(torch_qnode))
Output On Colab
<class ‘pennylane.devices.default_qubit.DefaultQubit’>
<class ‘pennylane.tape.qnode.QNode’>
<class ‘NoneType’>
Output On Local
output:
<class ‘pennylane.devices.default_qubit.DefaultQubit’>
<class ‘pennylane.interfaces.autograd.to_autograd..AutogradQNode’>
<class ‘pennylane.interfaces.torch.to_torch..TorchQNode’>
So, when I tried to call qnode function, it show up this error:
TypeError: ‘NoneType’ object is not callable
Did I miss pip install anything or add other things?