tqchen commented on code in PR #16827:
URL: https://github.com/apache/tvm/pull/16827#discussion_r1553985826
##########
src/relax/op/op_common.h:
##########
@@ -239,52 +239,91 @@ InferLayoutOutput InferLayoutUnaryEwise(const Call& call,
const Map<String, Array<String>>&
desired_layouts,
const VarLayoutMap& var_layout_map);
+/*!
+ * \brief Get the element dtype from StructInfo
+ *
+ * \param sinfo The StructInfo to expect
+ * \return The inferred element dtype.
+ * \throw Throw exception if the StructInfo doesn't have an element type.
+ */
+inline DataType GetElementDType(const StructInfo& sinfo) {
+ if (const auto* prim = sinfo.as<PrimStructInfoNode>()) {
+ return prim->dtype;
+ } else if (const auto* tensor = sinfo.as<TensorStructInfoNode>()) {
+ return tensor->dtype;
+ } else {
+ LOG(FATAL) << "TypeError: "
Review Comment:
Originally our error message would ask for TensorStructInfo. In this
particular case, would this error message be less informative than before?
Given this is a global change across all binary ops, would be good to cross
confirm the usages here and make error more informative.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]