Blealtan / efficient-kan

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

AssertionError #26

Open leedrake5 opened 1 month ago

leedrake5 commented 1 month ago

I am pretty sure this is really just a dimensionally issue, but trying to use KANLinear to substitute for nn.Linear to try this approach out. I can use the tutorial to get it to work with MNIST just fine, but it doesn't work well outside the box, almost certainly because I am missing something.

I keep getting the error for forward:

assert x.dim() == 2 and x.size(1) == self.in_features
AssertationError

All I am doing is dropping KANLinear in for nn.Linear, and keeping in_features and out_features the same hidden size. Is there a way forward can be edited to allow non-image inputs?

Blealtan commented 1 month ago

My fault. I assumed the layer should accept 2d inputs, which is not the case for nn.Linear. The outer dimensions should be simply view as flattened. Will fix soon.