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_r211408234
 
 

 ##########
 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:
   @nswamy I'm now skeptical of my Scala changes. For example, I'm not sure 
that the additions to `arange` in `NDArray.scala` are correct. My concern is 
that the only way that you can even use the new inference feature is via 
backward inference, because the inference is based on the output shape of the 
tensor produced by `arange`, which must be inferred from a different part of 
the graph. So unless I'm missing something, calling the imperative `arange` 
function with `infer_range = true` will always fail as it has to produce an 
`NDArray` *immediately*, but this is not possible because backward inference is 
only relevant for symbols.
   
   The new functionality should work in the symbolic context, however. 
   EDIT: to answer your original question, I'd prefer to add a Scala test to 
verify this last claim! If i did the wrong thing before... I don't trust myself 
now. Plus, if you agree, I should delete the imperative version of the new 
`arange` functionality from all language APIs.

----------------------------------------------------------------
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

Reply via email to