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

Commit

Permalink
Change styles.
Browse files Browse the repository at this point in the history
  • Loading branch information
ckt624 committed Aug 19, 2019
1 parent ab34c76 commit aa45110
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/python/unittest/test_numpy_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ def vdot_backward(a, b):
test_vdot = TestVdot()
if hybridize:
test_vdot.hybridize()
a = rand_ndarray(shape = shape, dtype = dtype).as_np_ndarray()
b = rand_ndarray(shape = shape, dtype = dtype).as_np_ndarray()
a = rand_ndarray(shape=shape, dtype=dtype).as_np_ndarray()
b = rand_ndarray(shape=shape, dtype=dtype).as_np_ndarray()
a.attach_grad()
b.attach_grad()

Expand All @@ -261,7 +261,7 @@ def vdot_backward(a, b):
b_sym = mx.sym.Variable("b").as_np_ndarray()
mx_sym = mx.sym.np.vdot(a_sym, b_sym).as_nd_ndarray()
check_numeric_gradient(mx_sym, [a.as_nd_ndarray(), b.as_nd_ndarray()],
rtol=1e-1, atol=1e-1, dtype = dtype)
rtol=1e-1, atol=1e-1, dtype=dtype)


@with_seed()
Expand Down Expand Up @@ -332,8 +332,8 @@ def inner_backward(a, b):
test_inner = TestInner()
if hybridize:
test_inner.hybridize()
a = rand_ndarray(shape = a_shape, dtype = dtype).as_np_ndarray()
b = rand_ndarray(shape = b_shape, dtype = dtype).as_np_ndarray()
a = rand_ndarray(shape=a_shape, dtype=dtype).as_np_ndarray()
b = rand_ndarray(shape=b_shape, dtype=dtype).as_np_ndarray()
a.attach_grad()
b.attach_grad()

Expand All @@ -357,7 +357,7 @@ def inner_backward(a, b):
b_sym = mx.sym.Variable("b").as_np_ndarray()
mx_sym = mx.sym.np.inner(a_sym, b_sym).as_nd_ndarray()
check_numeric_gradient(mx_sym, [a.as_nd_ndarray(), b.as_nd_ndarray()],
rtol=1e-1, atol=1e-1, dtype = dtype)
rtol=1e-1, atol=1e-1, dtype=dtype)


@with_seed()
Expand All @@ -383,16 +383,16 @@ def hybrid_forward(self, F, a, b):
test_outer = TestOuter()
if hybridize:
test_outer.hybridize()
a = rand_ndarray(shape = a_shape, dtype = dtype).as_np_ndarray()
b = rand_ndarray(shape = b_shape, dtype = dtype).as_np_ndarray()
a = rand_ndarray(shape=a_shape, dtype=dtype).as_np_ndarray()
b = rand_ndarray(shape=b_shape, dtype=dtype).as_np_ndarray()
a.attach_grad()
b.attach_grad()

np_out = _np.outer(a.asnumpy(), b.asnumpy())
with mx.autograd.record():
mx_out = test_outer(a, b)
assert mx_out.shape == np_out.shape
assert_almost_equal(mx_out.asnumpy(), np_out, rtol = 1e-3, atol = 1e-5)
assert_almost_equal(mx_out.asnumpy(), np_out, rtol=1e-3, atol=1e-5)
mx_out.backward()

# Test imperative once again
Expand All @@ -405,7 +405,7 @@ def hybrid_forward(self, F, a, b):
b_sym = mx.sym.Variable("b").as_np_ndarray()
mx_sym = mx.sym.np.outer(a_sym, b_sym).as_nd_ndarray()
check_numeric_gradient(mx_sym, [a.as_nd_ndarray(), b.as_nd_ndarray()],
rtol=1e-1, atol=1e-1, dtype = dtype)
rtol=1e-1, atol=1e-1, dtype=dtype)


@with_seed()
Expand Down

0 comments on commit aa45110

Please sign in to comment.