-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
DLPack Conversion API #1573
DLPack Conversion API #1573
Conversation
Parameters | ||
---------- | ||
dltensor : DLPack tensor | ||
|
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.
add description
python/tvm/contrib/dlpack.py
Outdated
|
||
Parameters | ||
---------- | ||
tvm_func: Built tvm function operating on arrays |
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.
numpy docstring convention
tvm_func: Function
The original tvm function input
include/tvm/runtime/c_runtime_api.h
Outdated
TVM_DLL int TVMArrayToDLPack(TVMArrayHandle from, | ||
DLManagedTensor** out); | ||
|
||
/**/ |
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.
Add comment block here
Wrapped tvm function that operates on PyTorch tensors | ||
""" | ||
import torch | ||
import torch.utils.dlpack |
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.
add a check to see if tvm_func is callable and raise error if it is not
python/tvm/contrib/dlpack.py
Outdated
return tvm_func(*args) | ||
return _wrapper | ||
|
||
def to_pytorch(tvm_func): |
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.
to_pytorch_func to avoid confusion
Thanks @eqy ! this is merged |
Hi! I think you could check whether the sentence under |
@wkcn Thanks for pointing this out, that line should be changed to |
cc @eqy |
#1589 should fix the problem |
Yes. #1589 has fixed the problem :-) |
(do not merge yet)
cc @tqchen