Kernels
universal / torch-ext /torch_binding.cpp
Ashiedu's picture
Initial kernel bundle upload: universal
df5d07c verified
Raw
History Blame Contribute Delete
568 Bytes
#include <torch/library.h>
#include "registration.h"
#include "torch_binding.h"
TORCH_LIBRARY_EXPAND(TORCH_EXTENSION_NAME, ops) {
ops.def("universal(Tensor! out, Tensor input) -> ()");
#if defined(CPU_KERNEL)
ops.impl("universal", torch::kCPU, &universal);
#elif defined(CUDA_KERNEL) || defined(ROCM_KERNEL)
ops.impl("universal", torch::kCUDA, &universal);
#elif defined(METAL_KERNEL)
ops.impl("universal", torch::kMPS, universal);
#elif defined(XPU_KERNEL)
ops.impl("universal", torch::kXPU, &universal);
#endif
}
REGISTER_EXTENSION(TORCH_EXTENSION_NAME)