You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/04/07 23:45:31 UTC
[GitHub] [incubator-mxnet] ptrendx commented on a change in pull request
#17977: Relaxing type requirements for broadcast_like
ptrendx commented on a change in pull request #17977: Relaxing type requirements for broadcast_like
URL: https://github.com/apache/incubator-mxnet/pull/17977#discussion_r405177613
##########
File path: src/operator/tensor/broadcast_reduce_op_value.cc
##########
@@ -138,7 +138,16 @@ NNVM_REGISTER_OP(broadcast_like)
[](const NodeAttrs& attrs) {
return std::vector<std::string>{"lhs", "rhs"};
})
-.set_attr<nnvm::FInferType>("FInferType", ElemwiseType<2, 1>)
+.set_attr<nnvm::FInferType>("FInferType", [](const nnvm::NodeAttrs& attrs,
+ std::vector<int> *in_attrs,
+ std::vector<int> *out_attrs) {
+ CHECK_EQ(in_attrs->size(), 2) << " in operator " << attrs.name;
+ std::vector<int> checked_in_attrs = { (*in_attrs)[0] };
+ bool ret = !type_is_none((*in_attrs)[1]) &&
Review comment:
Yes, it is necessary - what `FInferType` returns is whether it succeeded in inferring all the types (so that if all operators return true we know that all types are inferred). That is why it is important to not lie and return true only if all types are really inferred (even if we do not actually do anything with the other type).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services