def test_flatten_linear(): net = LinearOpr("flatten") tm_module, mge_result = get_traced_module(net, mge.tensor(net.data1)) _test_convert_result(net.data1, tm_module, mge_result, max_error, convert_backend=4)
def test_linear(): net = LinearOpr() inp_dtype = dtype.qint8(16.0 / 128.0) qat_net, inps = get_qat_net(inp_dtype, net, shape=(10, 100)) traced_module, tm_result = get_traced_module(qat_net, inps[0]) inp = inps[0].astype(inp_dtype) _test_convert_result(inp, traced_module, tm_result, max_err, require_quantize=False)
def test_linear(): net = LinearOpr() inp_dtype = dtype.qint8(16.0 / 128.0) qat_net, inps = get_qat_net(inp_dtype, net, shape=(10, 100)) traced_module, tm_result = get_traced_module(qat_net, inps[0]) print(traced_module.flatten().graph) out_dtype = traced_module.graph.outputs[0].qparams scale = out_dtype.scale.numpy() inp = inps[0].astype(inp_dtype) _test_convert_result( inp, traced_module, tm_result, scale=scale, require_quantize=True, max_err=max_error, )
def test_linear(): net = LinearOpr() mge_result = dump_mge_model(net, net.data, tmp_file) _test_convert_result(net.data, tmp_file, mge_result, max_error)
def test_linear(): net = LinearOpr() net.eval() tm_module, mge_result = get_traced_module(net, mge.tensor(net.data)) _test_convert_result(net.data, tm_module, mge_result, max_error)
def test_linear(): net = LinearOpr() 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)