taliesinb commented on a change in pull request #12064: Allow stop of arange to
be inferred from dims.
URL: https://github.com/apache/incubator-mxnet/pull/12064#discussion_r211406817
##########
File path: contrib/clojure-package/src/org/apache/clojure_mxnet/symbol.clj
##########
@@ -135,7 +135,17 @@
([start stop {:keys [step repeat dtype]
:or {step (float 1) repeat (int 1) dtype base/MX_REAL_TYPE}
:as opts}]
- (Symbol/arange (float start) ($/option (float stop)) step repeat nil dtype))
+ (Symbol/arange (float start) ($/option (float stop)) step repeat false nil
dtype))
+ ([start stop]
+ (arange start stop {})))
+
+(defn arange-with-inference
+ "Behaves like arange operator, but infers the stop value from the output
shape,
Review comment:
Hmm @gigasquid I'm finding the instructions in the `README.md` file a little
unclear in places. For example, under "Build from MXNET Source", I find this
instruction a bit cryptic:
> then replace the correct jar for your architecture in the project.clj,
example `[org.apache.mxnet/mxnet-full_2.11-osx-x86_64-cpu "1.3.0-SNAPSHOT"]`
I would find this easier to understand if it was very explicit, such as
"replace X with Y in section Z".
Here is what my project.clj contained out of the box:
```
;; Jars from Nexus
;[org.apache.mxnet/mxnet-full_2.11-osx-x86_64-cpu "1.2.1"]
;[org.apache.mxnet/mxnet-full_2.11-linux-x86_64-cpu "1.2.1"]
;[org.apache.mxnet/mxnet-full_2.11-linux-x86_64-gpu "1.2.1"]
;;; CI
[org.apache.mxnet/mxnet-full_2.11-linux-x86_64-cpu
"1.3.0-SNAPSHOT"]
```
At this point, not knowing what to replace with what, I read the section
"Cloning the repo and running from source", which mentions uncommenting rather
than replacing. That section is also a bit confusing:
> you will need to replace the native version of the line in the project
dependencies with your configuration.
Which line? What is a "native version of the line"? Perhaps it could say
"you will need to find and uncomment the appropriate line in the dependencies
section of the project.clj file, and comment the rest". We could also make the
project.clj section clearer so its more obvious what to do:
```
;; default behavior, to be used by the CI bot on github;
comment this line and
;; uncomment the appropriate line in one of the other
sections
[org.apache.mxnet/mxnet-full_2.11-linux-x86_64-cpu
"1.3.0-SNAPSHOT"]
;; use a prebuilt JAR from Nexus
;[org.apache.mxnet/mxnet-full_2.11-linux-x86_64-cpu "1.2.1"]
;[org.apache.mxnet/mxnet-full_2.11-linux-x86_64-gpu "1.2.1"]
;[org.apache.mxnet/mxnet-full_2.11-osx-x86_64-cpu "1.2.1"]
;;; build a local JAR from source
;[org.apache.mxnet/mxnet-full_2.11-linux-x86_64-cpu
"1.3.0-SNAPSHOT"]
;[org.apache.mxnet/mxnet-full_2.11-linux-x86_64-gpu
"1.3.0-SNAPSHOT"]
;[org.apache.mxnet/mxnet-full_2.11-osx-x86_64-cpu
"1.3.0-SNAPSHOT"]
```
Now, while the instructions could be a bit clearer, I did figure out the
point eventually, and so I tried adding this line and commenting the rest:
```
[org.apache.mxnet/mxnet-full_2.11-osx-x86_64-cpu "1.3.0-SNAPSHOT"]
```
After running `lein clean` and `lein test` I get this:
```
Generating symbol file
INFO MXNetJVM: Try loading mxnet-scala from native path.
INFO MXNetJVM: Try loading mxnet-scala-osx-x86_64-gpu from native path.
INFO MXNetJVM: Try loading mxnet-scala-osx-x86_64-cpu from native path.
WARN MXNetJVM: MXNet Scala native library not found in path. Copying native
library from the archive. Consider installing the library somewhere in the path
(for Windows: PATH, for Linux: LD_LIBRARY_PATH), or specifying by Java cmd
option -Djava.library.path=[lib path].
INFO org.apache.mxnet.util.NativeLibraryLoader: Replaced .dylib with .jnilib
INFO org.apache.mxnet.util.NativeLibraryLoader: Loading
libmxnet-scala.jnilib from /lib/native/ copying to mxnet-scala
[2
```
That WARN makes it sound like it's not using the library I built earlier
using `make scalainstall`, which will mean I can't actually test my new
functionality! Wasn't `make scalainstall` supposed to make the MXNet scala
libraries available for everyone on my system?
How should I fix this?
Also, an ergonomics question: the test suite takes a while to run. With
Python, it was very easy to just run the new tests I added using e.g.
`nosetests -v tests/python/unittest/test_operator.py`. Is there a similar
incantation for Clojure?
Thanks in advance for your help!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services