Instructions to use kernels-community/relu with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use kernels-community/relu with Kernels:
# !pip install kernels from kernels import get_kernel kernel = get_kernel("kernels-community/relu") - Notebooks
- Google Colab
- Kaggle
File size: 457 Bytes
a3d05b3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <torch/library.h>
#include "registration.h"
#include "torch_binding.h"
TORCH_LIBRARY_EXPAND(TORCH_EXTENSION_NAME, ops) {
ops.def("relu(Tensor! out, Tensor input) -> ()");
#if defined(CUDA_KERNEL) || defined(ROCM_KERNEL)
ops.impl("relu", torch::kCUDA, &relu);
#elif defined(METAL_KERNEL)
ops.impl("relu", torch::kMPS, relu);
#elif defined(XPU_KERNEL)
ops.impl("relu", torch::kXPU, &relu);
#endif
}
REGISTER_EXTENSION(TORCH_EXTENSION_NAME) |