The following is an example:
dtype = "float32"
x_shape = (1, 32, 16, 16)
w_shape = (6, 6, 64, 32)
x_data = np.random.random_sample(x_shape).astype(dtype)
w_data = np.random.random_sample(w_shape).astype(dtype)
np.savetxt("x_np.npy", x_data.flatten())
np.savetxt("w_np.npy", w_data.flatten())
x_np = np.loadtxt("x_np.npy").reshape(x_shape).astype(dtype)
w_np = np.loadtxt("w_np.npy").reshape(w_shape).astype(dtype)
x = relay.var("x", shape=x_shape, dtype=dtype)
w = relay.var("w", shape=w_shape, dtype=dtype)
y = relay.nn.contrib_conv2d_winograd_without_weight_transform(
x,
w,
kernel_size=(3, 3),
padding=(1, 1),
groups=1,
dilation=(1, 1),
channels=64,
tile_size=8,
data_layout="NHWC",
kernel_layout="HWIO",
)
func = relay.Function([x, w], y)
mod = tvm.IRModule().from_expr(func)
params = {}
inputs = {"x":tvm.nd.array(x_np), "w":tvm.nd.array(w_np)}
with tvm.transform.PassContext(opt_level=2):
exe = relay.backend.vm.compile(mod=mod, params=params, target="llvm")
vm = tvm.runtime.vm.VirtualMachine(exe, device=tvm.device("llvm"))
out = vm.run(**{**params, **inputs})
The result of each run with the same input is different.