-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Conversation
@@ -335,7 +335,7 @@ class NDArraySuite extends FunSuite with BeforeAndAfterAll with Matchers { | |||
} | |||
|
|||
test("arange") { | |||
for (i <- 0 until 5) { | |||
for (i <- 0 until 10000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of increasing the number of iterations, could you maybe add a test case that specifically hits the behaviour you're trying to circumvent here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. That's definitely a better solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lanking520 @nswamy could you give me a hand here and review the scala code?
Thanks a lot for your contribution - nice catch! |
Oops |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Fix relative difference scala * Increase number of cases for scala arange test * Add cases where arange produces NDArray of [0] * Remote whitespace
* Fix relative difference scala * Increase number of cases for scala arange test * Add cases where arange produces NDArray of [0] * Remote whitespace
* Fix relative difference scala * Increase number of cases for scala arange test * Add cases where arange produces NDArray of [0] * Remote whitespace
Description
Fix #14402 where division by zero occurs in relative difference calculation, making
arange
tests fail.Solution: if
diff
is near 0f, i.e <Float.MinPositiveValue
just return it instead of dividing bynorm
.Also
increase number of test cases to 10000add test cases wherearange
produces NDArray of [0.0f] to catch this. Test is not flaky anymore.Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
#14413 @lanking520 @perdasilva