This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#13385 [Clojure] - Turn examples into integration tests
- Loading branch information
Showing
2 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...package/examples/cnn-text-classification/test/cnn_text_classification/classifier_test.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(ns cnn-text-classification.classifier-test | ||
(:require | ||
[clojure.test :refer :all] | ||
[org.apache.clojure-mxnet.module :as module] | ||
[org.apache.clojure-mxnet.ndarray :as ndarray] | ||
[org.apache.clojure-mxnet.util :as util] | ||
[org.apache.clojure-mxnet.context :as context] | ||
[cnn-text-classification.classifier :as classifier])) | ||
|
||
; | ||
; The one and unique classifier test | ||
; | ||
(deftest classifier-test | ||
(let [train | ||
(classifier/train-convnet | ||
{:devs [(context/default-context)] | ||
:embedding-size 50 | ||
:batch-size 10 | ||
:test-size 100 | ||
:num-epoch 1 | ||
:max-examples 1000})] | ||
(is (= ["data"] (util/scala-vector->vec (module/data-names train)))) | ||
(is (= 20 (count (ndarray/->vec (-> train module/outputs first first))))))) | ||
;(prn (util/scala-vector->vec (data-shapes train))) | ||
;(prn (util/scala-vector->vec (label-shapes train))) | ||
;(prn (output-names train)) | ||
;(prn (output-shapes train)) |