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_r385972583
##########
File path: src/runtime/ndarray.cc
##########
@@ -185,6 +185,18 @@ NDArray NDArray::FromDLPack(DLManagedTensor* tensor) {
return NDArray(GetObjectPtr<Object>(data));
}
+void NDArray::CopyToBytes(void* data, size_t nbytes) const {
+ CHECK(data != nullptr);
+ CHECK(data_ != nullptr);
+ CHECK_EQ(TVMArrayCopyToBytes(&get_mutable()->dl_tensor, data, nbytes), 0);
Review comment:
We should move the impl of TVMArrayCopyToBytes to here, and call this
function from that function instead. So exceptions can be directly throw out
without in C++
----------------------------------------------------------------
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