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

Commit

Permalink
add relevant tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitij12345 committed Jul 11, 2019
1 parent 9f35c99 commit df3551b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/python/unittest/test_higher_order_grad.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,44 @@ def grad_grad_op(x):
check_second_order_unary(array, cos, grad_grad_op)


@with_seed()
def test_arcsin():
def arcsin(x):
return nd.arcsin(x)

def grad_grad_op(x):
return x / nd.sqrt((1-x**2)**3)

for dim in range(1, 5):
shape = rand_shape_nd(dim)
array = random_arrays(shape)
# Hack: Decrease std_dev to make
# sure all elements
# are in range -1 to 1
# i.e. Domain of arcsin
array *= 0.2
check_second_order_unary(array, arcsin, grad_grad_op)


@with_seed()
def test_arccos():
def arccos(x):
return nd.arccos(x)

def grad_grad_op(x):
return -x / nd.sqrt((1-x**2)**3)

for dim in range(1, 5):
shape = rand_shape_nd(dim)
array = random_arrays(shape)
# Hack: Decrease std_dev to make
# sure all elements
# are in range -1 to 1
# i.e. Domain of arccos
array *= 0.2
check_second_order_unary(array, arccos, grad_grad_op)


@with_seed()
def test_relu():
def relu(x):
Expand Down

0 comments on commit df3551b

Please sign in to comment.