| 6 | |
| 7 | namespace { |
| 8 | std::pair<TensorLayoutArray, Convolution3DForwardImpl::Param> sub_opr_config( |
| 9 | const Convolution3DForwardImpl::AlgoBase::SizeArgs& args) { |
| 10 | TensorLayout src_pg = *args.src_layout; |
| 11 | TensorLayout filter_pg = *args.filter_layout; |
| 12 | TensorLayout dst_pg = *args.dst_layout; |
| 13 | |
| 14 | auto nr_grp = args.filter_meta.group; |
| 15 | size_t c_pos; |
| 16 | if (args.filter_meta.format == param::Convolution3D::Format::NCDHW) { |
| 17 | c_pos = 1; |
| 18 | } else { |
| 19 | megdnn_assert( |
| 20 | args.filter_meta.format == param::Convolution3D::Format::NDHWC, |
| 21 | "invalid conv format"); |
| 22 | c_pos = 4; |
| 23 | } |
| 24 | filter_pg.remove_axis_inplace(0); |
| 25 | src_pg.shape[c_pos] /= nr_grp; |
| 26 | dst_pg.shape[c_pos] /= nr_grp; |
| 27 | |
| 28 | megdnn::param::Convolution3D param = args.opr->param(); |
| 29 | param.sparse = megdnn::param::Convolution3D::Sparse::DENSE; |
| 30 | std::pair<TensorLayoutArray, Convolution3DForwardImpl::Param> ret; |
| 31 | ret.first = {src_pg, filter_pg, dst_pg}; |
| 32 | ret.second = param; |
| 33 | |
| 34 | return ret; |
| 35 | } |
| 36 | |
| 37 | std::pair<TensorLayoutArray, std::unique_ptr<Convolution3DForward>> prepare_sub_opr( |
| 38 | const Convolution3DForwardImpl::AlgoBase::SizeArgs& args) { |
no test coverage detected