-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
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
creates cupydense in the data layer to be available as a Qobj #41
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 1182844552Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes in this PR are probably unnecessary as they are:
register_aliases
already allows one to specify thedtype
when creating a Qobj, although I would recommend adding "CuPyDense" to the list of aliases in the call toregister_aliases
.- it's unnecessary to add a creator for a data layer type, but as @AGaliciaMartinez pointed out, it probably would be useful to add one for the cupy array type.
I think a setup similar to the one in https://github.com/qutip/qutip-tensorflow/blob/main/src/qutip_tensorflow/core/data/convert.py would make more sense.
@hodgestar I checked the diff and this one is ready. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left two small comments, but looking much better.
src/qutip_cupy/__init__.py
Outdated
|
||
|
||
def is_cupy(data): | ||
return isinstance(data, cp.ndarray) # noqa: F821 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the noqa really needed now that we import cupy as cp at the top?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is that as the import is inside a try it fails to detect it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you double check?
When I do:
$ cat foo.py
try:
import math
except ImportError:
raise
def f():
print(math.pi)
$ flake8 foo.py
It doesn't print an error and in the code in this PR it doesn't print an error for del cp
either.
Looks like there were some breaking changes on dev.major |
Yep. Importantly data layer objects no longer support arithmetic operations via |
This lines were missing in order to be able to call operations from a Qobj and test all the functionality directly oin Qobjs.