From 9e406754d68f4c9d60497c72636455697c11d10f Mon Sep 17 00:00:00 2001 From: Leyuan Wang Date: Wed, 4 Sep 2019 17:16:42 -0700 Subject: [PATCH] add channels --- topi/python/topi/intel_graphics/conv2d.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/topi/python/topi/intel_graphics/conv2d.py b/topi/python/topi/intel_graphics/conv2d.py index 01ea34e2f1138..63cae4c7da8db 100644 --- a/topi/python/topi/intel_graphics/conv2d.py +++ b/topi/python/topi/intel_graphics/conv2d.py @@ -159,6 +159,11 @@ def _alter_conv2d_layout(attrs, inputs, tinfo, F): copy_inputs = [s for s in inputs] new_attrs = {k : attrs[k] for k in attrs.keys()} + + if F.__name__ == 'tvm.relay.op': + # Derive channels for frontends (e.g ONNX) that miss "channel" field. + new_attrs["channels"] = inputs[1].checked_type.shape[attrs['kernel_layout'].index('O')] + data, kernel = tinfo[0], tinfo[1] batch_size, in_channel, height, width = get_const_tuple(data.shape)