tqchen commented on a change in pull request #5533:
URL: https://github.com/apache/incubator-tvm/pull/5533#discussion_r421129652
##########
File path: include/tvm/runtime/object.h
##########
@@ -350,6 +350,39 @@ inline RelayRefType GetRef(const ObjectType* ptr);
template <typename SubRef, typename BaseRef>
inline SubRef Downcast(BaseRef ref);
+template <typename T> class ObjectPtr;
+
+/*!
+ * \brief Get an object ptr type from a raw object ptr.
+ *
+ * \param ptr The object pointer
+ * \tparam BaseType The reference type
+ * \tparam ObjectType The object type
+ * \return The corresponding ObjectPtr type
+ */
+template <typename BaseType, typename ObjectType,
+ typename std::enable_if<!std::is_same<BaseType, ObjectType>::value,
int>::type = 0>
+inline ObjectPtr<BaseType> GetObjectPtr(ObjectType* ptr);
+
+/*!
+ * \brief Get an object ptr type from a raw object ptr.
+ *
+ * \param ptr The object pointer
+ * \tparam ObjectType The object type
+ * \return The corresponding ObjectPtr type
+ */
+template <typename ObjectType>
+inline ObjectPtr<ObjectType> GetObjectPtr(ObjectType* ptr);
Review comment:
Let us simply unify this function with the above one so that users won't
be confused about the variants
##########
File path: include/tvm/arith/analyzer.h
##########
@@ -107,6 +107,7 @@ class ConstIntBound : public ObjectRef {
*/
class ConstIntBoundAnalyzer {
public:
+ using BoundMapType = std::unordered_map<ObjectPtr<const PrimExprNode>,
ConstIntBound, ObjectHash>;
Review comment:
yes, PrimExpr itself exposes the ptr as const pointer
----------------------------------------------------------------
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:
[email protected]