Skip to content

Commit

Permalink
[numpy] Fix test_dynamic_shape.test_dynamic_shape (apache#14538)
Browse files Browse the repository at this point in the history
* Initial commit

* Address comments from Jun
  • Loading branch information
junrushao authored and reminisce committed Apr 13, 2019
1 parent a1e8f5f commit 6dd3995
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/c_api/c_api_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ struct MXAPIThreadLocalEntry {
data->resize(shapes.size());
size_t size = 0;
for (const auto& s : shapes) {
if (s.ndim() > 0);
size += s.ndim();
if (s.ndim() > 0) {
size += s.ndim();
}
}
buffer->resize(size);
int *ptr = buffer->data();
Expand Down
3 changes: 2 additions & 1 deletion src/imperative/imperative_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "./imperative_utils.h"
#include "./cached_op.h"
#include "../operator/operator_common.h"

namespace mxnet {
namespace imperative {
Expand Down Expand Up @@ -186,7 +187,7 @@ void NaiveRunGraph(
Imperative::Get()->InvokeOp(ctx, node.source->attrs, ndinputs, ndoutputs,
req, dispatch_mode, state);
for (size_t j = 0; j < ndoutputs.size(); ++j) {
if (ndoutputs[j]->shape().ndim() == 0) {
if (mxnet::op::shape_is_none(ndoutputs[j]->shape())) {
ndoutputs[j]->WaitToRead();
ndoutputs[j]->SetShapeFromChunk();
}
Expand Down

0 comments on commit 6dd3995

Please sign in to comment.