uncomplicate / deep-diamond

A fast Clojure Tensor & Deep Learning library
https://aiprobook.com
Eclipse Public License 1.0
432 stars 17 forks source link

No implementation of method: :diamond-factory of protocol: #5

Closed zendevil closed 3 years ago

zendevil commented 3 years ago

Here's the require statement:


(ns foo.foo.core
  (:require 
            [foo.core :refer [random]]
            [uncomplicate.neanderthal
             [core :refer :all]
             [native :refer :all]]
            [uncomplicate.diamond
             [dnn :refer :all]
             [tensor :refer :all]

            ))

Using the tensor function like so:

 (tensor 4 [1 1 1 1] :float :nchw)

gives the following error

No implementation of method: :diamond-factory of protocol:
   #'uncomplicate.diamond.internal.protocols/DiamondFactoryProvider found for
   class: java.lang.Long

Why was diamond-factory protocol not found?

blueberry commented 3 years ago

You didn't load uncomplicate.diamond.native namespace (or some other namespace that would set the default engine, for example cudnn).

zendevil commented 3 years ago

Adding

[uncomplicate.diamond.native :refer :all]

in the require statement gives the same error. What namespace sets the default engine in macOS? Here's the require statement.

(ns foo.foo.core
  (:require 
            [foo.core :refer [random]]
            [uncomplicate.diamond.native]
            [uncomplicate.diamond.dnn]
            [uncomplicate.diamond.metrics]
            [uncomplicate.neanderthal
             [core :refer :all]
             [native :refer :all]]
            [uncomplicate.diamond.tensor :refer [tensor desc]]
            ))
zendevil commented 3 years ago

I've loaded every single namespace in deep diamond. Here's my require statement:

(ns foo.flight.core

  (:require 
            [clojure.math.numeric-tower :refer [expt]]
            [uncomplicate.diamond.native]
            [uncomplicate.diamond.dnn]
            [uncomplicate.diamond.metrics]
            [uncomplicate.neanderthal
             [core :refer :all]
             [native :refer :all]]
            [uncomplicate.diamond.tensor :refer [tensor desc]]
            [uncomplicate.neanderthal.opencl]
            [uncomplicate.diamond.internal.dnnl.factory]
            [uncomplicate.diamond.internal.dnnl.factory]
            [uncomplicate.diamond.internal
             [cost]
             [network]
             [protocols]
             [utils]]
            [uncomplicate.diamond.internal.dnnl
             [constants]
             [core]
             [directed]
             [factory]
             [file-channel]
             [impl]
             [protocols]
             [tensor]]
            [uncomplicate.diamond.internal.neanderthal
             [directed]
             [factory]]
            ))

But I'm still getting the same error.

blueberry commented 3 years ago

I don't know how would randomly loading namespaces solve a problem, so I can't comment much on that.

Please enable SIP and see examples from the DD test folder.