Commit 153fd7ff by Animesh Jain Committed by Yizhi Liu

[AlterOpLayout][x86] NHWC to NCHWc conv support. (#4080)

parent b5bcdbb0
...@@ -158,7 +158,6 @@ def _alter_conv2d_layout(attrs, inputs, tinfo, F): ...@@ -158,7 +158,6 @@ def _alter_conv2d_layout(attrs, inputs, tinfo, F):
return None return None
return F.nn.contrib_conv2d_nchwc_int8(*copy_inputs, **new_attrs) return F.nn.contrib_conv2d_nchwc_int8(*copy_inputs, **new_attrs)
if data_layout == 'NCHW' and attrs['kernel_layout'] == 'OIHW':
# (oc, ic, h, w) -> (OC, IC, h, w, ic, oc) # (oc, ic, h, w) -> (OC, IC, h, w, ic, oc)
new_attrs['kernel_layout'] = 'OIHW%di%do' % (ic_bn, oc_bn) new_attrs['kernel_layout'] = 'OIHW%di%do' % (ic_bn, oc_bn)
# Store altered operator's config # Store altered operator's config
...@@ -172,7 +171,6 @@ def _alter_conv2d_layout(attrs, inputs, tinfo, F): ...@@ -172,7 +171,6 @@ def _alter_conv2d_layout(attrs, inputs, tinfo, F):
if F.__name__ == 'nnvm.symbol': if F.__name__ == 'nnvm.symbol':
return F.contrib.conv2d_NCHWc(*copy_inputs, **new_attrs) return F.contrib.conv2d_NCHWc(*copy_inputs, **new_attrs)
return F.nn.contrib_conv2d_nchwc(*copy_inputs, **new_attrs) return F.nn.contrib_conv2d_nchwc(*copy_inputs, **new_attrs)
return None
@conv2d_legalize.register("cpu") @conv2d_legalize.register("cpu")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment