huangzhiyuan commented on a change in pull request #13730: Add mkldnn OP for
slice
URL: https://github.com/apache/incubator-mxnet/pull/13730#discussion_r245496990
##########
File path: src/operator/tensor/matrix_op.cc
##########
@@ -420,6 +421,30 @@ will return a new array with shape ``(2,1,3,4)``.
.add_argument("data", "NDArray-or-Symbol", "Source input")
.add_arguments(ExpandDimParam::__FIELDS__());
+void SliceExCPU(const nnvm::NodeAttrs& attrs,
+ const OpContext& ctx,
+ const std::vector<NDArray>& inputs,
+ const std::vector<OpReqType>& req,
+ const std::vector<NDArray>& outputs) {
+ CHECK_EQ(inputs.size(), 1);
+ CHECK_EQ(outputs.size(), 1);
+ const SliceParam& param = nnvm::get<SliceParam>(attrs.parsed);
+ auto in_stype = inputs[0].storage_type();
+ if (in_stype == kCSRStorage) {
+ SliceCsrImpl<cpu>(param, ctx, inputs[0], req[0], outputs[0]);
+#if MXNET_USE_MKLDNN == 1
+ } else if (in_stype == kDefaultStorage) {
+ if (SupportMKLDNN(inputs[0])) {
+ MKLDNNSlice(param, ctx, inputs[0], req[0], outputs[0]);
+ } else {
+ FallBackCompute(SliceOpForward<cpu>, attrs, ctx, inputs, req, outputs);
+ }
+#endif
+ } else {
+ LOG(FATAL) << "Slice not implemented for storage type" << in_stype;
Review comment:
This situation is implemented in this line:
https://github.com/huangzhiyuan/incubator-mxnet/blob/mkldnn-slice/src/operator/tensor/matrix_op-inl.h#L432
Not in SliceExCPU().
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services