tqchen commented on a change in pull request #4970: Added CopyFromBytes and
CopyToBytes convenience methods to NDArray. Fixed typos.
URL: https://github.com/apache/incubator-tvm/pull/4970#discussion_r385990046
##########
File path: src/runtime/ndarray.cc
##########
@@ -185,6 +185,38 @@ NDArray NDArray::FromDLPack(DLManagedTensor* tensor) {
return NDArray(GetObjectPtr<Object>(data));
}
+void NDArray::CopyToBytes(void* data, size_t nbytes) const {
+ CHECK(data != nullptr);
Review comment:
Last change: perhaps it is better to bring the common impl in this function,
and TVMArrayCopyToBytes to a common function
```
void ArrayCopyToBytes(DLTensor* handle, void* data, size_t nbytes).
```
and have both functions call into this common function to avoid impl
duplications.
----------------------------------------------------------------
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