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

Commit

Permalink
fix expand_dims fall back when input's ndim is 0 (#16837)
Browse files Browse the repository at this point in the history
  • Loading branch information
wuxun-zhang authored and pengzhao-intel committed Nov 16, 2019
1 parent ec2f3a6 commit 69fd018
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/operator/nn/mkldnn/mkldnn_reshape.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ void MKLDNNReshapeForward(const nnvm::NodeAttrs& attrs,
const NDArray &output) {
// For mkldnn non-supported input, it shouldn't hold mkldnn memory, so let's simply fallback to
// naive implement.
if (input.shape().ndim() > 4 || !SupportMKLDNNQuantize(input.dtype())) {
const int input_ndims = input.shape().ndim();
if ((input_ndims < 1 || input_ndims > 4) || !SupportMKLDNNQuantize(input.dtype())) {
if (req != kWriteInplace) {
FallBackCompute(UnaryOp::IdentityCompute<cpu>, attrs, ctx, {input}, {req}, {output});
}
Expand Down

0 comments on commit 69fd018

Please sign in to comment.