File size: 545 Bytes
7a139da | 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("fp4_quantize(Tensor x, Tensor(a!) resid, bool stochastic, int seed, int step) -> (Tensor, Tensor)");
ops.def("fp4_dequantize(Tensor packed, Tensor scale, int M, int K) -> Tensor");
#if defined(CUDA_KERNEL) || defined(ROCM_KERNEL)
ops.impl("fp4_quantize", torch::kCUDA, &fp4_quantize);
ops.impl("fp4_dequantize", torch::kCUDA, &fp4_dequantize);
#endif
}
REGISTER_EXTENSION(TORCH_EXTENSION_NAME)
|