Tvm.context attribute not found

Hi all!

I am trying to implement the code provided in the following link:

Everything works, except when I get to the following code block:

mod =, args, target)
ctx = tvm.context(target, 0)
data, weight, out = d2ltvm.get_conv_data(
            c, c, n, k, p, s, lambda x: tvm.nd.array(x, ctx=ctx), conv_type='depthwise')
mod(data, weight, out)

data, weight, bias, out_mx = d2ltvm.get_conv_data_mxnet(c, c, n, k, p, s, conv_type='depthwise')
d2ltvm.depthwise_conv_mxnet(data, weight, bias, out_mx, k, p, s)
np.testing.assert_allclose(out_mx[0].asnumpy(), out.asnumpy(), atol=1e-5)

Specifically, the line ctx = tvm.context(target, 0) seems to be throwing an error. The error is shown below:

I tried searching online, and in this forum, but was unable to find a fix. Please let me know what I am doing wrong! I apologize if this has been asked before/is a known issue!

it is changed to tvm.device

1 Like

Thank you! That seemed to work!