Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Revert "[clojure][generator] ndarray/symbol api random merged (#14800)"
Browse files Browse the repository at this point in the history
This reverts commit 5dd9fa2.
  • Loading branch information
gigasquid authored Apr 26, 2019
1 parent 5dd9fa2 commit 95d624d
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 731 deletions.
298 changes: 98 additions & 200 deletions contrib/clojure-package/src/dev/generator.clj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

(ns org.apache.clojure-mxnet.ndarray-api
"Experimental NDArray API"
(:refer-clojure
:exclude [* - + > >= < <= / cast concat flatten identity load max
min repeat reverse set sort take to-array empty shuffle
ref])
(:refer-clojure :exclude [* - + > >= < <= / cast concat flatten identity load max
min repeat reverse set sort take to-array empty shuffle
ref])

(:require [org.apache.clojure-mxnet.base :as base]
[org.apache.clojure-mxnet.context :as mx-context]
[org.apache.clojure-mxnet.shape :as mx-shape]
Expand Down

This file was deleted.

This file was deleted.

47 changes: 6 additions & 41 deletions contrib/clojure-package/test/dev/generator_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,6 @@
(is (= "foo-bar" (gen/clojure-case "Foo_Bar")))
(is (= "div+" (gen/clojure-case "/+"))))

(deftest fn-name->random-fn-name
(is (= "poisson" (gen/fn-name->random-fn-name "-random-poisson")))
(is (= "poisson-like" (gen/fn-name->random-fn-name "-sample-poisson"))))

(deftest remove-prefix
(is (= "randint" (gen/remove-prefix "-random-" "-random-randint")))
(is (= "exponential" (gen/remove-prefix "-sample-" "-sample-exponential"))))

(deftest in-namespace-random?
(is (gen/in-namespace-random? "random_randint"))
(is (gen/in-namespace-random? "sample_poisson"))
(is (not (gen/in-namespace-random? "rnn")))
(is (not (gen/in-namespace-random? "activation"))))

(defn ndarray-reflect-info [name]
(->> gen/ndarray-public-no-default
(filter #(= name (str (:name %))))
Expand Down Expand Up @@ -331,25 +317,14 @@
(deftest test-write-to-file
(testing "symbol-api"
(let [fname "test/test-symbol-api.clj"
fns (gen/all-symbol-api-functions gen/op-names)
_ (gen/write-to-file [(first fns) (second fns)]
(gen/symbol-api-gen-ns false)
_ (gen/write-to-file [(first gen/all-symbol-api-functions)
(second gen/all-symbol-api-functions)]
gen/symbol-api-gen-ns
fname)
good-contents (slurp "test/good-test-symbol-api.clj")
contents (slurp fname)]
(is (= good-contents contents))))

(testing "symbol-random-api"
(let [fname "test/test-symbol-random-api.clj"
fns (gen/all-symbol-random-api-functions gen/op-names)
_ (gen/write-to-file [(first fns) (second fns)]
(gen/symbol-api-gen-ns true)
fname)
good-contents (slurp "test/good-test-symbol-random-api.clj")
contents (slurp fname)]
(is (= good-contents contents))))


(testing "symbol"
(let [fname "test/test-symbol.clj"
_ (gen/write-to-file [(first gen/all-symbol-functions)]
Expand All @@ -361,24 +336,14 @@

(testing "ndarray-api"
(let [fname "test/test-ndarray-api.clj"
fns (gen/all-ndarray-api-functions gen/op-names)
_ (gen/write-to-file [(first fns) (second fns)]
(gen/ndarray-api-gen-ns false)
_ (gen/write-to-file [(first gen/all-ndarray-api-functions)
(second gen/all-ndarray-api-functions)]
gen/ndarray-api-gen-ns
fname)
good-contents (slurp "test/good-test-ndarray-api.clj")
contents (slurp fname)]
(is (= good-contents contents))))

(testing "ndarray-random-api"
(let [fname "test/test-ndarray-random-api.clj"
fns (gen/all-ndarray-random-api-functions gen/op-names)
_ (gen/write-to-file [(first fns) (second fns)]
(gen/ndarray-api-gen-ns true)
fname)
good-contents (slurp "test/good-test-ndarray-random-api.clj")
contents (slurp fname)]
(is (= good-contents contents))))

(testing "ndarray"
(let [fname "test/test-ndarray.clj"
_ (gen/write-to-file [(first gen/all-ndarray-functions)]
Expand Down
95 changes: 0 additions & 95 deletions contrib/clojure-package/test/good-test-ndarray-random-api.clj

This file was deleted.

118 changes: 0 additions & 118 deletions contrib/clojure-package/test/good-test-symbol-random-api.clj

This file was deleted.

Loading

0 comments on commit 95d624d

Please sign in to comment.