Fork me on GitHub

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


any ideas?! :thinking_face:


I have neanderthal 0.28.0 installed


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


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])))))


@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...


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.

✔️ 4

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


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