Lunderberg commented on code in PR #16827:
URL: https://github.com/apache/tvm/pull/16827#discussion_r1554126510
##########
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:
Good point, and this no longer tells the user which operation it was.
Updated.
--
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]