NAME

AI::MXNet::TestUtils - Convenience subs used in tests.

same

Test if two pdl arrays are the same

Parameters
----------
a : pdl
b : pdl

reldiff

Calculate the relative difference between two input arrays

Calculated by :math:`\\frac{|a-b|_1}{|a|_1 + |b|_1}`

Parameters
----------
a : pdl
b : pdl

almost_equal

Test if two pdl arrays are almost equal.

check_consistency

Check symbol gives the same output for different running context

Parameters
----------
sym : Symbol or list of Symbols
    symbol(s) to run the consistency test
ctx_list : list
    running context. See example for more detail.
scale : float, optional
    standard deviation of the inner normal distribution. Used in initialization
grad_req : str or list of str or dict of str to str
    gradient requirement.