Exemple #1
0
def test_empty_like():
    test_case = Cases()
    for mnp_proto, onp_proto in zip(test_case.mnp_prototypes, test_case.onp_prototypes):
        actual = mnp.empty_like(mnp_proto).asnumpy()
        expected = onp.empty_like(onp_proto)
        assert actual.shape == expected.shape

        for mnp_dtype, onp_dtype in zip(test_case.mnp_dtypes,
                                        test_case.onp_dtypes):
            actual = mnp.empty_like(mnp_proto, dtype=mnp_dtype).asnumpy()
            expected = onp.empty_like(onp_proto, dtype=onp_dtype)
            match_meta(actual, expected)
def test_empty_like_exception():
    with pytest.raises(ValueError):
        mnp.empty_like([[1, 2, 3], [4, 5]])