gigasquid commented on a change in pull request #14305: [Clojure] Helper 
function for n-dim vector to ndarray
URL: https://github.com/apache/incubator-mxnet/pull/14305#discussion_r264014076
 
 

 ##########
 File path: contrib/clojure-package/src/org/apache/clojure_mxnet/util.clj
 ##########
 @@ -218,15 +218,25 @@
     (throw (ex-info error-msg
                     (s/explain-data spec value)))))
 
-(s/def ::non-empty-seq sequential?)
+(s/def ::non-empty-seq (s/and sequential? not-empty))
 (defn to-array-nd
   "Converts any N-D sequential structure to an array
    with the same dimensions."
-  [s]
-  (validate! ::non-empty-seq s "Invalid N-D sequence")
-  (if (sequential? (first s))
-    (to-array (mapv to-array-nd s))
-    (to-array s)))
+  [nd-seq]
+  (validate! ::non-empty-seq nd-seq "Invalid N-D sequence")
+  (if (sequential? (first nd-seq))
+    (to-array (mapv to-array-nd nd-seq))
+    (to-array nd-seq)))
+
+(defn nd-seq-shape
 
 Review comment:
   Nice!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to