Blealtan / efficient-kan

An efficient pure-PyTorch implementation of Kolmogorov-Arnold Network (KAN).
MIT License
3.49k stars 306 forks source link

Layer fails on inputs that have been transposed previously #36

Open tRosenflanz opened 1 month ago

tRosenflanz commented 1 month ago

Using your implementation on the data that has been transposed previously causes a RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead. error. Just replacing https://github.com/Blealtan/efficient-kan/blob/605b8c2ae24b8085bd11b96896a17eabe12f6736/src/efficient_kan/kan.py#L156 with a reshape fixed it. Maybe worth to fix this if you want the layer to be a full drop in for nn.Linear

akaashdash commented 1 month ago

Oh I didn't know this was a thing when I made that PR. You learn something new every day.

https://github.com/Blealtan/efficient-kan/pull/37 should fix