Skip to content

Commit

Permalink
Assert kernel layout
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthesun committed Jun 3, 2019
1 parent 262a9c8 commit 395408f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions topi/python/topi/x86/conv2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,17 @@ def _alter_conv2d_layout(attrs, inputs, tinfo, F):

dtype = data.dtype
out_dtype = dtype if out_dtype in ("same", "") else out_dtype
kshape = get_const_tuple(kernel.shape)
is_depthwise = groups == kshape[0] and kshape[1] == 1

# only optimize for NCHW
if layout != 'NCHW':
return None
if groups != 1 and not is_depthwise:
return None

assert attrs["kernel_layout"] == "OIHW"
kshape = get_const_tuple(kernel.shape)
is_depthwise = groups == kshape[0] and kshape[1] == 1

dispatch_ctx = autotvm.task.DispatchContext.current
target = tvm.target.current_target()
# query schedule and fallback if necessary
Expand Down

0 comments on commit 395408f

Please sign in to comment.