tqchen opened a new pull request #4581: [REFACTOR][RUNTIME] Move NDArray to 
Object System
URL: https://github.com/apache/incubator-tvm/pull/4581
 
 
   Previously NDArray has its own object reference counting mechanism.
   This PR migrates NDArray to the unified object protocol.
   
   The calling convention of NDArray remained intact.
   That means NDArray still has its own type_code and
   its handle is still DLTensor compatible.
   
   In order to do so, this PR added a few minimum runtime type
   detection in TVMArgValue and RetValue only when the corresponding
   type is a base type(ObjectRef) that could also refer to NDArray.
   
   This means that even if we return a base reference object ObjectRef
   which refers to the NDArray. The type_code will still be translated
   correctly as kNDArrayContainer.
   If we assign a non-base type(say Expr) that we know is not compatible
   with NDArray during compile time, no runtime type detection will be 
performed.
   
   This PR also adopts the object protocol for NDArray sub-classing and
   removed the legacy NDArray subclass protocol.
   Examples in apps/extension are now updated to reflect that.
   
   Making NDArray as an Object brings all the benefits of the object system.
   For example, we can now use the Array container to store NDArrays.

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


With regards,
Apache Git Services

Reply via email to