

def test_where():

    def fun(x, y):
        b = np.where(C, x, y)
        return to_scalar(b)
    C = (npr.randn(4, 5) > 0)
    A = npr.randn(4, 5)
    B = npr.randn(4, 5)
    d_fun = (lambda a, b: to_scalar(grad(fun)(a, b)))
    check_grads(fun, A, B)
    check_grads(d_fun, A, B)

dataset/ETHPy150Open HIPS/autograd/tests/test_numpy.py test_where/original