anirudhacharya commented on a change in pull request #14613: [MXNET-978] Higher order gradient support for some unary operators URL: https://github.com/apache/incubator-mxnet/pull/14613#discussion_r289497323
########## File path: tests/python/unittest/test_higher_order_grad.py ########## @@ -15,13 +15,52 @@ # specific language governing permissions and limitations # under the License. -import math +import math from mxnet import nd, autograd from mxnet.test_utils import assert_almost_equal, random_arrays from common import with_seed +@with_seed() +def test_sin(): + def sin(x): + return nd.sin(x) + + def grad_grad_op(x): + return -nd.sin(x) + + arrays = random_arrays((2, 2), (2, 3), (4, 5, 2), (3, 1, 4, 5)) + for array in arrays: + check_second_order_unary(array, sin, grad_grad_op) Review comment: I think `check_second_order_unary` function should be moved to `python/mxnet/test_utils.py` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
