Open ikkoham opened 1 week ago
This is a simple bug in parsing the typing.Callable
string in the argument type annotation. If you instead import as
from typing import Callable
and then remove typing.
def MyGenericAlgorithm(statePrep : Callable[[cudaq.qview], None]):
it should work. Still you should be able to keep the typing.
and it should work. We'll have to get a fix in for that.
Thank you for quick response. I confirmed that your suggestion works well!
Required prerequisites
Describe the bug
The example code in https://nvidia.github.io/cuda-quantum/latest/specification/cudaq/kernels.html does not work.
[10] CUDA-Q kernels can serve as input to other quantum kernels and invoked by kernel function body code. To support CUDA-Q kernel parameterization on callable quantum kernel code, programmers can leverage standard C++ template definitions or dynamic typing in language bindings such as Python:
Steps to reproduce the bug
It raises
AttributeError: 'Attribute' object has no attribute 'id'
Expected behavior
Work
Is this a regression? If it is, put the last known working version (or commit) here.
Not sure
Environment
Suggestions
No response