def test_resize_bilinear(): x = sym.Variable("x") y = sym.resize(x, size=(60, 60), method="BILINEAR", name="y", layout="NHWC") dtype = "float32" dshape = (1, 32, 32, 4) oshape = (1, 60, 60, 4) shape_dict = {"x": dshape} dtype_dict = {"x": dtype} for target, ctx in ctx_list(): graph, lib, _ = nnvm.compiler.build(y, target, shape_dict, dtype_dict) m = graph_runtime.create(graph, lib, ctx) a_np = np.random.uniform(size=dshape).astype(dtype) data = tvm.nd.array(a_np) m.run(x=data) out = m.get_output(0, tvm.nd.empty(oshape, dtype)) b_np = topi.testing.bilinear_resize_python(a_np, (60, 60), "NHWC") tvm.testing.assert_allclose(out.asnumpy(), b_np, rtol=1e-5, atol=1e-5)