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

Commit

Permalink
reducing memory footprint of one_hot for Large Tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohit Kumar Srivastava committed Sep 10, 2019
1 parent 9675a2d commit 2838fea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/nightly/test_large_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,12 +715,13 @@ def test_full():


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


if __name__ == '__main__':
Expand Down

0 comments on commit 2838fea

Please sign in to comment.