Closed jxgu1016 closed 6 years ago
Also, can we merge the two setup.py
together and make them share the same package name?
Sorry to close this issue mistakenly ...
You can merge the two Function
s and write:
if tensor.is_cuda():
# call CUDA code
else:
# call C++ code
inside your PyTorch Function
, or you can move it into C++ and write:
if (tensor.is_cuda()) {
// call CUDA code
} else {
// call C++ code
}
There's nothing to stop you from merging the setup.py
s, no. I won't do it for this example because things are supposed to be isolated.
Is there any way to automatically set the backends (cpu or gpu)? To merge the two
Function
into one and it will choose the proper backend according to what device we are using.