crystal-data / num.cr

Scientific computing in pure Crystal
MIT License
151 stars 12 forks source link

Standard backend for all Tensors #55

Closed christopherzimmerman closed 3 years ago

christopherzimmerman commented 3 years ago

Right now, all types of Tensors are implemented separately, so ClTensors and Tensors have entirely separate implementations. There are plenty of other backends I would like to support:

Ideally, these should not require multiple implementations, but rather be created as interfaces that can all be developed in a single class.

This would be a major overhaul to existing implementations, but I think Tensor(T) should become Tensor(T, V), where T is a base Crystal data type, and V is a backend implementation.

This would also have to not break Num::Grad and Num::NN, which would mean that all gates would work across all backends, or at least raise unimplemented errors at compile time vs. runtime.