File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -886,18 +886,20 @@ function test_saveload()
886886end
887887
888888function test_clamp ()
889- dims = rand_dims ()
890- @info (" NDArray::clamp::dims = $dims " )
891-
892- j_array, nd_array = rand_tensors (dims)
893- clip_up = maximum (abs .(j_array)) / 2
894- clip_down = 0
895- clipped = clamp (nd_array, clip_down, clip_up)
889+ @info (" NDArray::clamp::dims" )
890+
891+ A = [1 2 3 ;
892+ 4 5 6 ;
893+ 7 8 9. ]
894+ B = [3 3 3 ;
895+ 4 5 6 ;
896+ 7 8 8. ]
897+ x = NDArray (A)
898+ y = clamp (x, 3. , 8. )
896899
897900 # make sure the original array is not modified
898- @test copy (nd_array) ≈ j_array
899-
900- @test all (clip_down .<= copy (clipped) .<= clip_up)
901+ @test copy (x) ≈ A
902+ @test copy (y) ≈ B
901903
902904 @info (" NDArray::clamp!" )
903905 let
You can’t perform that action at this time.
0 commit comments