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
Download torch-ext/torch_binding.cpp from marcsun13/topk: direct link, hf CLI and curl.
- Browser
- Download file 320 Bytes
-
https://huggingface.co/marcsun13/topk/resolve/main/torch-ext/torch_binding.cpp
- Command line
-
hf download hf://marcsun13/topk/torch-ext/torch_binding.cpp
-
curl -L -o torch_binding.cpp https://huggingface.co/marcsun13/topk/resolve/main/torch-ext/torch_binding.cpp
320 Bytes
| TORCH_LIBRARY_EXPAND(TORCH_EXTENSION_NAME, ops) { | |
| ops.def("top_k(Tensor logits, int k, bool softmax) -> Tensor[]"); | |
| ops.impl("top_k", torch::kMPS, &top_k); | |
| } | |
| REGISTER_EXTENSION(TORCH_EXTENSION_NAME) | |