Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/marian.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Junczys-Dowmunt <junczys@amu.edu.pl>2017-10-27 01:07:20 +0300
committerMarcin Junczys-Dowmunt <junczys@amu.edu.pl>2017-10-27 01:07:20 +0300
commitfdd9516e982dad030b2fac36acab4184e27e532b (patch)
tree2a65e091e5cc48ec42767118ce1f5d0dd6898035 /src/graph/node_operators_unary.h
parentc84244f76c66336d98f5ce5130f198e49b7f6b79 (diff)
fixed bug in transpose for ndarray
Diffstat (limited to 'src/graph/node_operators_unary.h')
-rw-r--r--src/graph/node_operators_unary.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/graph/node_operators_unary.h b/src/graph/node_operators_unary.h
index 852d6d02..9881357c 100644
--- a/src/graph/node_operators_unary.h
+++ b/src/graph/node_operators_unary.h
@@ -702,9 +702,12 @@ struct TransposeNodeOp : public UnaryNodeOp {
template <class... Args>
Shape newShape(Expr a, Shape permute) {
- Shape shape;
+ Shape shape = a->shape();
+
+ UTIL_THROW_IF2(shape.size() != permute.size(),
+ "Shape and transpose axis have different number of dimensions");
- for(int i = 0; i < 4; ++i)
+ for(int i = 0; i < shape.size(); ++i)
shape.set(i, a->shape()[permute[i]]);
return shape;