tqchen commented on code in PR #11391:
URL: https://github.com/apache/tvm/pull/11391#discussion_r882889885
##########
include/tvm/runtime/ndarray.h:
##########
@@ -156,23 +156,26 @@ class NDArray : public ObjectRef {
TVM_DLL static NDArray Empty(ShapeTuple shape, DLDataType dtype, Device dev,
Optional<String> mem_scope = NullOpt);
/*!
- * \brief Create a NDArray backed by an external DLTensor.
+ * \brief Try to create a NDArray backed by an external DLTensor without
copying.
*
- * This allows us to create a NDArray using the memory
- * allocated by an external source. Responsibility for memory
- * retaining lies with the external source.
- * \param dl_tensor The DLTensor to copy from.
+ * Fail if DLTensor is not contiguous.
+ * If AbilityOfZeroCopyForDLTensor is true a NDArray is created
+ * using the memory allocated by an external source.
+ * Responsibility for memory retaining lies with the external source.
+ * Otherwise new NDArray is created, the data is copied from the DLTensor.
Review Comment:
I agree that FromExternalDLTensor in this case should check alignment,
--
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]