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_r212477584
 
 

 ##########
 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:
   @gigasquid ok we're good to go. I removed the pointless imperative function 
version of arange-with-inference, so I only had to add a test to 
`operator_test.clj`. 
   
   However, in doing this, I think I've picked up a problem with `approx=`, in 
which it incorrectly returns true if one of the comparisands (is that a word??) 
is shorter than the other, and differs in the remaining elements that the other 
does not have.
   
   For example, try change the test starting on line 200 to the following:
   
   ```
   (deftest ones
     (let [ones (sym/ones [2 2])
           exec (sym/simple-bind ones (context/default-context))]
       (is (approx= 1e-4
                    [1 1 1 1 9 9 9 9 9 9]
                    (-> exec (executor/forward) (executor/outputs) (first))))))
   ```
   
   (I've introduced the 9 9 9 9 9 9 here). This test still passes. 
   
   I've reported the issue here: 
https://github.com/apache/incubator-mxnet/issues/12320, and fixed it in this 
PR. It doesn't produce any regressions, luckily!
   
   If my new test looks good to you, we should be ready to merge!
   

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