Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[BACKPORT][BUGFIX][FEATURE] Add oneDNN 1D and 3D deconvolution support and fix bias #20292

Merged
merged 22 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7c9edad
[v1.x][BUGFIX] Implement oneDNN deconvolution primitives to deconvolu…
PawelGlomski-Intel May 11, 2021
bb95c34
[v1.x][FEATURE] Add MKLDNN Deconvolution 1D and 3D support (#20137)
PawelGlomski-Intel May 18, 2021
bcb4837
Use MXNET_USE_ONEDNN
PawelGlomski-Intel May 21, 2021
0dc6ea4
Fix test
PawelGlomski-Intel May 21, 2021
ca8528f
Apply formatter
PawelGlomski-Intel Aug 31, 2021
858ff66
Add native support for 3D deconvolution
PawelGlomski-Intel Aug 31, 2021
94bcdb6
Remove outdated check
PawelGlomski-Intel Sep 1, 2021
e450b94
Replace math.prod with np.prod
PawelGlomski-Intel Sep 1, 2021
e7326be
Check convolution layout only when it has value
PawelGlomski-Intel Sep 1, 2021
b8d512f
Remove outdated check
PawelGlomski-Intel Sep 1, 2021
9a7061f
Change tests
PawelGlomski-Intel Sep 2, 2021
4232c91
Increase default workspace size to mach convolution
PawelGlomski-Intel Sep 2, 2021
1c6103c
Fix deconv workspace size
PawelGlomski-Intel Sep 3, 2021
1a48697
Increase default deconv workspace size in python API
PawelGlomski-Intel Sep 3, 2021
30072b3
Disable 3D tests for GPU
PawelGlomski-Intel Sep 7, 2021
7abdd75
Add deconv arguments checks
PawelGlomski-Intel Sep 8, 2021
a0dbd07
Remove next_impl calls until it is fixed
PawelGlomski-Intel Sep 9, 2021
991858b
Share workspace
PawelGlomski-Intel Sep 20, 2021
ef2e095
Fix documentation
PawelGlomski-Intel Sep 20, 2021
c1b6b04
Add test_deconv_dilation
PawelGlomski-Intel Sep 20, 2021
5392c79
Fix check
PawelGlomski-Intel Sep 22, 2021
166f83c
Fix include order
PawelGlomski-Intel Sep 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/mxnet/ndarray/numpy_extension/_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,9 @@ def convolution(data=None, weight=None, bias=None, kernel=None, stride=None, dil
@set_module('mxnet.ndarray.numpy_extension')
def deconvolution(data=None, weight=None, bias=None, kernel=None, stride=None, dilate=None,
pad=None, adj=None, target_shape=None, num_filter=1, num_group=1,
workspace=512, no_bias=False, cudnn_tune=None,
workspace=1024, no_bias=False, cudnn_tune=None,
cudnn_off=False, layout=None):
r"""Computes 1D or 2D transposed convolution (aka fractionally strided convolution) of
r"""Computes 1D, 2D or 3D transposed convolution (aka fractionally strided convolution) of
the input tensor. This operation can be seen as the gradient of Convolution operation
with respect to its input. Convolution usually reduces the size of the input.
Transposed convolution works the other way, going from a smaller input
Expand Down
4 changes: 2 additions & 2 deletions python/mxnet/numpy_extension/_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,9 @@ def convolution(data=None, weight=None, bias=None, kernel=None, stride=None, dil
@set_module('mxnet.numpy_extension')
def deconvolution(data=None, weight=None, bias=None, kernel=None, stride=None, dilate=None,
pad=None, adj=None, target_shape=None, num_filter=1, num_group=1,
workspace=512, no_bias=False, cudnn_tune=None,
workspace=1024, no_bias=False, cudnn_tune=None,
cudnn_off=False, layout=None):
r"""Computes 1D or 2D transposed convolution (aka fractionally strided convolution) of
r"""Computes 1D, 2D or 3D transposed convolution (aka fractionally strided convolution) of
the input tensor. This operation can be seen as the gradient of Convolution operation
with respect to its input. Convolution usually reduces the size of the input.
Transposed convolution works the other way, going from a smaller input
Expand Down
2 changes: 1 addition & 1 deletion src/operator/deformable_convolution-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class DeformableConvolutionOp : public Operator {
index_t num_kernels_col2im_;
bool bias_term_; // has bias term?
bool is_1x1_;
}; // class ConvolutionOp
}; // class DeformableConvolutionOp

template <typename xpu>
Operator* CreateOp(DeformableConvolutionParam param,
Expand Down
2 changes: 1 addition & 1 deletion src/operator/modulated_deformable_convolution-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class ModulatedDeformableConvolutionOp : public Operator {
index_t im2col_step_;
bool bias_term_; // has bias term?
bool is_1x1_;
}; // class ConvolutionOp
}; // class ModulatedDeformableConvolutionOp

template <typename xpu>
Operator* CreateOp(ModulatedDeformableConvolutionParam param,
Expand Down
224 changes: 155 additions & 69 deletions src/operator/nn/convolution-inl.h

Large diffs are not rendered by default.

295 changes: 68 additions & 227 deletions src/operator/nn/deconvolution-inl.h

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions src/operator/nn/deconvolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ static bool DeconvolutionShape(const nnvm::NodeAttrs& attrs,
mxnet::ShapeVector* in_shape,
mxnet::ShapeVector* out_shape) {
const DeconvolutionParam& param_ = nnvm::get<DeconvolutionParam>(attrs.parsed);
#if MXNET_USE_CUDNN == 0
if (param_.kernel.ndim() > 2) {
LOG(FATAL) << "If not using CUDNN, only 1D or 2D Deconvolution is supported";
return false;
}
#endif // CUDNN

using namespace mshadow;
if (!param_.no_bias) {
Expand Down Expand Up @@ -413,9 +407,9 @@ DMLC_REGISTER_PARAMETER(DeconvolutionParam);
NNVM_REGISTER_OP(Deconvolution)
.add_alias("_npx_deconvolution")
.describe(
"Computes 1D or 2D transposed convolution (aka fractionally strided convolution) of the "
"input tensor. This operation can be seen as the gradient of Convolution operation with "
"respect to its input. Convolution usually reduces the size of the input. Transposed "
"Computes 1D, 2D or 3D transposed convolution (aka fractionally strided convolution) of "
"the input tensor. This operation can be seen as the gradient of Convolution operation "
"with respect to its input. Convolution usually reduces the size of the input. Transposed "
"convolution works the other way, going from a smaller input to a larger output while "
"preserving the connectivity pattern.")
.set_num_inputs([](const NodeAttrs& attrs) {
Expand Down
Loading