[SOLVED] Simple Example Error: AttributeError: 'TensorSlice' object has no attribute 'op'

Hi

I am trying to run the following simple code segment:

import tvm
import topi
import numpy as np

data = tvm.placeholder((1, 3, 224, 224))
kernel = tvm.placeholder((10, 3, 5, 5))

target = "llvm"
with tvm.target.create(target):
    C = topi.nn.conv2d(data, kernel, strides=1, padding=2, dilation=1)
    S = topi.generic.nn.schedule_conv2d_nchw(C)
    tvm_IR = tvm.lower(S, [data, kernel], name="test_add1")
    tvm_module = tvm.build_module(tvm_IR, target)

but I keep getting the following error:

File “tvm/topi/python/topi/x86/conv2d.py”, line 188, in
s = tvm.create_schedule([x.op for x in outs])
AttributeError: ‘TensorSlice’ object has no attribute ‘op’

Any ideas what is wrong ? I am basically trying to run a slightly modified example from:
https://docs.tvm.ai/tutorials/topi/intro_topi.html

but on a different backend. LLVM rather then cuda. From what I understand the LLVM will default to to the native cpu as backend. Am I missing something here ?

Thanks

1 Like

try to pass in [C] into the schedule_conv2d_nchw instead, from the error it seems to suggest that the function expect list of tensor as oppose to a single one

2 Likes

Thanks a lot that fixed the problem.