szha commented on a change in pull request #11984: Generalized broadcast_like
operator
URL: https://github.com/apache/incubator-mxnet/pull/11984#discussion_r210964534
##########
File path: src/operator/tensor/broadcast_reduce_op.h
##########
@@ -340,20 +351,60 @@ inline bool BroadcastLikeShape(const nnvm::NodeAttrs&
attrs,
CHECK_EQ(out_attrs->size(), 1U);
TShape& lhs_shape = (*in_attrs)[0];
TShape& rhs_shape = (*in_attrs)[1];
- TShape oshape = TShape(rhs_shape);
- if (lhs_shape.ndim() == 0 || lhs_shape.ndim() == 0) return false;
- CHECK_EQ(lhs_shape.ndim(), rhs_shape.ndim())
+ if ((lhs_shape.ndim() == 0) || (lhs_shape.ndim() == 0)) {
+ return false;
+ }
+
+ const BroadcastLikeParam& param =
nnvm::get<BroadcastLikeParam>(attrs.parsed);
+ TShape oshape;
+
+ // lhs or rhs or both params were not specified
+ if (!param.lhs_axes.has_value() || !param.rhs_axes.has_value()) {
+ CHECK_EQ(lhs_shape.ndim(), rhs_shape.ndim())
<< "Operand of shape " << lhs_shape << " cannot be broadcasted to " <<
rhs_shape;
Review comment:
indentation
----------------------------------------------------------------
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