Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTOR][RUNTIME] Update NDArray use the Unified Object System #4581

Merged
merged 2 commits into from
Dec 30, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address review comments
  • Loading branch information
tqchen committed Dec 29, 2019
commit 6a2a1adf7c5aa01f04fe3fd3d7400418456ce41a
9 changes: 3 additions & 6 deletions apps/extension/src/tvm_ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,11 @@ namespace tvm_ext {
* To use this extension, an external library should
*
* 1) Inherit TVM's NDArray and NDArray container,
* and define the trait `array_type_info` for this class.
*
* 2) Define a constructor in the inherited class that accepts
* a pointer to TVM's Container, which is nullable.
* 2) Follow the new object protocol to define new NDArray as a reference class.
*
* 3) On Python frontend, inherit `tvm.nd.NDArrayBase`,
* define the class attribute `_array_type_code` consistent to
* the C++ type trait, and register the subclass using `tvm.register_extension`.
* 3) On Python frontend, inherit `tvm.nd.NDArray`,
* register the type using tvm.register_object
*/
class NDSubClass : public tvm::runtime::NDArray {
public:
Expand Down
6 changes: 2 additions & 4 deletions include/tvm/runtime/ndarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class NDArray : public ObjectRef {
/*!
* \brief Construct NDArray's Data field from array handle in FFI.
* \param handle The array handle.
* \return The constructed NDArray.
* \return The corresponding ObjectPtr to the constructed container object.
*
* \note We keep a special calling convention for NDArray by passing
* ContainerBase pointer in FFI.
Expand Down Expand Up @@ -221,7 +221,7 @@ class NDArray::ContainerBase {
};

/*!
* \brief Object container class taht backs NDArray.
* \brief Object container class that backs NDArray.
* \note do not use this function directly, use NDArray.
*/
class NDArray::Container :
Expand Down Expand Up @@ -280,8 +280,6 @@ class NDArray::Container :
};

// implementations of inline functions
// the usages of functions are documented in place.a

/*!
* \brief return the size of data the DLTensor hold, in term of number of bytes
*
Expand Down