Instructions to use marcsun13/topk with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use marcsun13/topk with Kernels:
# !pip install kernels from kernels import get_kernel # a version (or an explicit revision) is required; see the "Files and versions" tab for the available ones kernel = get_kernel("marcsun13/topk", version=1) - Notebooks
- Google Colab
- Kaggle
File size: 320 Bytes
5bb63f9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <torch/library.h>
#include "registration.h"
#include "torch_binding.h"
TORCH_LIBRARY_EXPAND(TORCH_EXTENSION_NAME, ops) {
ops.def("top_k(Tensor logits, int k, bool softmax) -> Tensor[]");
#if defined(METAL_KERNEL)
ops.impl("top_k", torch::kMPS, &top_k);
#endif
}
REGISTER_EXTENSION(TORCH_EXTENSION_NAME)
|