You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2019/12/27 07:46:11 UTC

[GitHub] [incubator-tvm] wweic commented on a change in pull request #4581: [REFACTOR][RUNTIME] Update NDArray use the Unified Object System

wweic commented on a change in pull request #4581: [REFACTOR][RUNTIME] Update NDArray use the Unified Object System
URL: https://github.com/apache/incubator-tvm/pull/4581#discussion_r361599255
 
 

 ##########
 File path: include/tvm/runtime/ndarray.h
 ##########
 @@ -191,36 +144,40 @@ class NDArray {
       DLTensor* from, DLTensor* to, TVMStreamHandle stream = nullptr);
 
   TVM_DLL std::vector<int64_t> Shape() const;
-
   // internal namespace
   struct Internal;
+
  protected:
-  /*! \brief Internal Data content */
-  Container* data_{nullptr};
-  // enable internal functions
-  friend struct Internal;
   friend class TVMPODValue_;
-  friend class TVMArgValue;
   friend class TVMRetValue;
   friend class TVMArgsSetter;
-};
-
-/*!
- * \brief The type trait indicates subclass of TVM's NDArray.
- *  For irrelavant classes, code = -1.
- *  For TVM NDArray itself, code = 0.
- *  All subclasses of NDArray should override code > 0.
- */
-template<typename T>
-struct array_type_info {
-  /*! \brief the value of the traits */
-  static const int code = -1;
-};
-
-// Overrides the type trait for tvm's NDArray.
-template<>
-struct array_type_info<NDArray> {
-  static const int code = 0;
+  /*!
+   * \brief Get mutable internal container pointer.
+   * \return a mutable container pointer.
+   */
+  inline Container* get_mutable() const;
+  // Helper functions for FFI handling.
+  /*!
+   * \brief Construct NDArray's Data field from array handle in FFI.
+   * \param handle The array handle.
+   * \return The constructed NDArray.
 
 Review comment:
   The return type does not match `ObjectPtr`.

----------------------------------------------------------------
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