24 lines
1.3 KiB
C++
24 lines
1.3 KiB
C++
#include <torch/extension.h>
|
|
|
|
void state_step_cuda(torch::Tensor v, torch::Tensor g, torch::Tensor refractory,
|
|
torch::Tensor arrival, torch::Tensor spikes,
|
|
torch::Tensor spike_counts, double g_decay, double alpha,
|
|
double rest, double reset, double threshold,
|
|
int64_t refractory_steps);
|
|
void force_step_cuda(torch::Tensor v, torch::Tensor refractory,
|
|
torch::Tensor spikes, torch::Tensor spike_counts,
|
|
torch::Tensor targets, torch::Tensor forced,
|
|
double reset, int64_t refractory_steps);
|
|
void fanout_cuda(torch::Tensor spikes, torch::Tensor indptr,
|
|
torch::Tensor indices, torch::Tensor weights,
|
|
torch::Tensor destination);
|
|
void fill_edges_cuda(torch::Tensor indptr, torch::Tensor sources,
|
|
torch::Tensor output_offsets, torch::Tensor output);
|
|
|
|
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
|
|
m.def("state_step", &state_step_cuda, "Fused exact LIF state update (CUDA)");
|
|
m.def("force_step", &force_step_cuda, "Apply external forced spikes (CUDA)");
|
|
m.def("fanout", &fanout_cuda, "Event-driven CSR fan-out (CUDA)");
|
|
m.def("fill_edges", &fill_edges_cuda, "Exact source-ordered CSR edge expansion (CUDA)");
|
|
}
|