Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Reducing memory footprint of one_hot for Large Array Testing #16136

Merged
merged 2 commits into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()