leandron opened a new issue #6410: URL: https://github.com/apache/incubator-tvm/issues/6410
When using `tvm.relay.transform.ConvertLayout` (in the context of #6302), I'm getting some errors that are not really clear on how they are related to the convert process. It seems `ConvertLayout` it is looking for `shape` (this check was introduced in #5284), when trying to find depthwise convolutions, but it doesn't seem to be the case for some imported models, and might need some fixing. https://github.com/apache/incubator-tvm/blob/4b48d89c79a72f7799606e845bdb1ed938baa115/python/tvm/relay/op/nn/_nn.py#L158-L164 This is the error I see, when trying to run `ConvertLayout` on an ONNX model: ``` AttributeError: <class 'tvm.relay.expr.TupleGetItem'> has no attribute shape ``` **To reproduce the issue, you can run the script below:** 1. Download resnet50: ``` wget https://github.com/onnx/models/raw/master/vision/classification/resnet/model/resnet50-v2-7.onnx ``` 2. Run the ConvertLayout following the script below: ``` import onnx import tvm from tvm import relay # boilerplate to load the ONNX model model = onnx.load("resnet50-v2-7.onnx") name = model.graph.input[0].name proto_shape = model.graph.input[0].type.tensor_type.shape.dim shape = [d.dim_value for d in proto_shape] shape_dict = {name: shape} mod, params = relay.frontend.from_onnx(model, shape_dict) # converting layout desired_layouts = {'nn.conv2d': ['NHWC', 'default']} seq = tvm.transform.Sequential([relay.transform.RemoveUnusedFunctions(), relay.transform.ConvertLayout(desired_layouts)]) with tvm.transform.PassContext(opt_level=3): mod = seq(mod) with relay.build_config(opt_level=3): graph, lib, params = relay.build(mod, "llvm", params=params) ``` PS: It also happens if I get a NHWC TFlite model and try to force it into an NHWC convertion, but that is a negative test, that is why I didn't add it here. cc @comaniac @jwfromm ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
