Пример #1
0
def test_elemwise(mode):
    net = ElemwiseOpr(mode)
    tm_module, mge_result = get_traced_module(net, mge.tensor(net.data))
    _test_convert_result(net.data,
                         tm_module,
                         mge_result,
                         max_error,
                         input_name="a")
Пример #2
0
def test_elemwise_broadcast(mode):
    net = ElemwiseOpr(mode)
    tm_module, mge_result = get_traced_module(
        net, mge.tensor(np.array([2.0]).astype("float32")))
    _test_convert_result(np.array([2.0]),
                         tm_module,
                         mge_result,
                         max_error,
                         input_name="a")
Пример #3
0
def test_elemwise(mode):
    net = ElemwiseOpr(mode)
    mge_result = dump_mge_model(net, net.data, tmp_file)
    _test_convert_result(net.data, tmp_file, mge_result, max_error)
Пример #4
0
def test_elemwise_broadcast(mode):
    net = ElemwiseOpr(mode)
    mge_result = dump_mge_model(net,
                                np.array([2.0]).astype("float32"), tmp_file)
    _test_convert_result(
        np.array([2.0]).astype("float32"), tmp_file, mge_result, max_error)
Пример #5
0
def test_elemwise(mode):
    net = ElemwiseOpr(mode)
    traced_module, tm_result = get_traced_module(net, mge.tensor(net.data))
    print(traced_module.flatten().graph)

    _test_convert_result(mge.tensor(net.data), traced_module, tm_result)