Skip to content

Commit

Permalink
Reducing memory footprint of one_hot for Large Array Testing (apache#…
Browse files Browse the repository at this point in the history
…16136)

* reducing memory footprint of one_hot for Large Tensor

* removing one_hot from large_vector and changing large_array test to incorporate large vector part of the test
  • Loading branch information
access2rohit authored and Rohit Kumar Srivastava committed Sep 25, 2019
1 parent 8249bbc commit 6cc5c34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
10 changes: 5 additions & 5 deletions tests/nightly/test_large_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

# dimension constants
MEDIUM_X = 10000
VLARGE_X = 4300000000
LARGE_X = 100000000
SMALL_X = 100
SMALL_Y = 50
Expand Down Expand Up @@ -1197,12 +1198,11 @@ def test_slice_axis():


def test_one_hot():
a = nd.array(np.zeros(SMALL_Y))
a[0] = 1
a[-1] = 1
b = nd.one_hot(a, LARGE_X)
#default dtype of ndarray is float32 which cannot index elements over 2^32
a = nd.array([1, (VLARGE_X - 1)], dtype=np.int64)
b = nd.one_hot(a, VLARGE_X)
b[0][1] == 1
b[-1][1] == 1
b[1][-1] == 1


def test_full():
Expand Down
9 changes: 0 additions & 9 deletions tests/nightly/test_large_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,15 +714,6 @@ def test_full():
assert a[-1] == 3


def test_one_hot():
a = nd.zeros(10)
a[0] = 1
a[-1] = 1
b = nd.one_hot(a, LARGE_X)
assert b[0][1] == 1
assert b[-1][1] == 1


if __name__ == '__main__':
import nose
nose.runmodule()

0 comments on commit 6cc5c34

Please sign in to comment.