fp4-train / torch-ext /torch_binding.cpp
CharlesCNorton
Add fp4-train source, tests, and model card
7a139da
Raw
History Blame
545 Bytes
#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)