uncomplicate

quadron 2020-03-30T13:40:00.001700Z

i'm trying to run the code snippets in the Deep Learning from Scratch to GPU series. cpu code runs fine, but when I try the cuda-specific code I get the following error: Execution error (IllegalArgumentException) at uncomplicate.fluokitten.protocols/eval12579$fn$G (protocols.clj:66). No implementation of method: :fmap! of protocol: #'uncomplicate.fluokitten.protocols/PseudoFunctor found for class: uncomplicate.neanderthal.internal.device.cublock.CUGEMatrix

quadron 2020-03-30T13:40:34.002Z

any ideas?! :thinking_face:

quadron 2020-03-30T13:41:32.002400Z

I have neanderthal 0.28.0 installed

quadron 2020-03-30T13:42:34.003Z

could it be that the blog post code is out of sync with newer versions of neanderthal?

quadron 2020-03-30T13:52:55.003700Z

this is the piece of code that throws the aforementioned exception: (cuda/with-default (with-release [factory (cuda-float (current-context) default-stream)] (with-release [cu-x-train (ge factory 4 10000) cu-y-train (ge factory 1 10000) inference (init! (inference-network factory 4 [(fully-connected 32 sigmoid) (fully-connected 16 tanh) (fully-connected 1 linear)])) training (training-network inference cu-x-train)] (transfer! x-train cu-x-train) (transfer! y-train cu-y-train) (time (sgd training cu-y-train quadratic-cost! 4000 [0.2 0.1 0.4])))))

2020-03-30T21:26:45.006700Z

@veix.q5 The blog post series was generated from live REPL, so everything should work. This particular exception is expected, since fmap! can't be run on the GPU. Without knowing what post and what code snippet exactly isn't working, I can't tell you why fmap! is called after all. Maybe I wanted to demonstrate that fmap! doesn't work, and that this code should be refactored, or perhaps you run this snippet out of order...

2020-03-30T21:28:08.007800Z

BTW the blog was written with an older version, but AFIK, the latest version should be compatible, and it is definitely not a cause of the fmap exception.

1✔️
quadron 2020-03-30T22:03:50.011800Z

@blueberry ah! thanks for the hint about the fmap! I was using a cpu weight initializer on the gpu.

2020-03-30T22:06:18.012400Z

Of course, there is a direct weight initializer for the GPU. read on 🙂