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

Commit

Permalink
Add operator dispatch and interoperability tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jullk committed Dec 9, 2019
1 parent d291ef4 commit 71e9e98
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/mxnet/numpy_dispatch_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def _run_with_array_ufunc_proto(*args, **kwargs):
'min',
'nonzero',
'ones_like',
'atleast_1d',
'atleast_2d',
'atleast_3d',
'prod',
'ravel',
'repeat',
Expand Down
25 changes: 25 additions & 0 deletions tests/python/unittest/test_numpy_interoperability.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,30 @@ def _add_workload_ones_like(array_pool):
OpArgMngr.add_workload('ones_like', array_pool['4x1'])


def _add_workload_atleast_nd():
a_0 = np.array(1)
b_0 = np.array(2)
a_1 = np.array([1, 2])
b_1 = np.array([2, 3])
a_2 = np.array([[1, 2], [1, 2]])
b_2 = np.array([[2, 3], [2, 3]])
a_3 = [a_2, a_2]
b_3 = [b_2, b_2]

OpArgMngr.add_workload('atleast_1d', a_0, b_0)
OpArgMngr.add_workload('atleast_1d', a_1, b_1)
OpArgMngr.add_workload('atleast_1d', a_2, b_2)
OpArgMngr.add_workload('atleast_1d', a_3, b_3)
OpArgMngr.add_workload('atleast_2d', a_0, b_0)
OpArgMngr.add_workload('atleast_2d', a_1, b_1)
OpArgMngr.add_workload('atleast_2d', a_2, b_2)
OpArgMngr.add_workload('atleast_2d', a_3, b_3)
OpArgMngr.add_workload('atleast_3d', a_0, b_0)
OpArgMngr.add_workload('atleast_3d', a_1, b_1)
OpArgMngr.add_workload('atleast_3d', a_2, b_2)
OpArgMngr.add_workload('atleast_3d', a_3, b_3)


def _add_workload_prod(array_pool):
OpArgMngr.add_workload('prod', array_pool['4x1'])

Expand Down Expand Up @@ -1374,6 +1398,7 @@ def _prepare_workloads():
_add_workload_mean(array_pool)
_add_workload_nonzero()
_add_workload_ones_like(array_pool)
_add_workload_atleast_nd()
_add_workload_prod(array_pool)
_add_workload_repeat(array_pool)
_add_workload_reshape()
Expand Down

0 comments on commit 71e9e98

Please sign in to comment.