This is an automated email from the ASF dual-hosted git repository.
lanking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 8cae72e julia/ndarray: fix flaky test cases for `clamp` (#14776)
8cae72e is described below
commit 8cae72eeadd3ab59de1b1ad81c202f6eb513e07e
Author: Iblis Lin <[email protected]>
AuthorDate: Thu Apr 25 06:44:34 2019 +0800
julia/ndarray: fix flaky test cases for `clamp` (#14776)
ref: #14757
---
julia/test/unittest/ndarray.jl | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/julia/test/unittest/ndarray.jl b/julia/test/unittest/ndarray.jl
index 26695e8..638963f 100644
--- a/julia/test/unittest/ndarray.jl
+++ b/julia/test/unittest/ndarray.jl
@@ -886,18 +886,20 @@ function test_saveload()
end
function test_clamp()
- dims = rand_dims()
- @info("NDArray::clamp::dims = $dims")
-
- j_array, nd_array = rand_tensors(dims)
- clip_up = maximum(abs.(j_array)) / 2
- clip_down = 0
- clipped = clamp(nd_array, clip_down, clip_up)
+ @info("NDArray::clamp::dims")
+
+ A = [1 2 3;
+ 4 5 6;
+ 7 8 9.]
+ B = [3 3 3;
+ 4 5 6;
+ 7 8 8.]
+ x = NDArray(A)
+ y = clamp(x, 3., 8.)
# make sure the original array is not modified
- @test copy(nd_array) ≈ j_array
-
- @test all(clip_down .<= copy(clipped) .<= clip_up)
+ @test copy(x) ≈ A
+ @test copy(y) ≈ B
@info("NDArray::clamp!")
let