projects
/
platform
/
upstream
/
tvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
02d3a59
)
[NDArray] Set shape_ in NDArray::FromDLPack (#5301)
author
hlu1
<14827759+hlu1@users.noreply.github.com>
Fri, 10 Apr 2020 14:42:54 +0000
(07:42 -0700)
committer
GitHub
<noreply@github.com>
Fri, 10 Apr 2020 14:42:54 +0000
(07:42 -0700)
src/runtime/ndarray.cc
patch
|
blob
|
history
diff --git
a/src/runtime/ndarray.cc
b/src/runtime/ndarray.cc
index
99594ee
..
ac12472
100644
(file)
--- a/
src/runtime/ndarray.cc
+++ b/
src/runtime/ndarray.cc
@@
-208,6
+208,10
@@
NDArray NDArray::FromDLPack(DLManagedTensor* tensor) {
// fill up content.
data->manager_ctx = tensor;
data->dl_tensor = tensor->dl_tensor;
+ // update shape_
+ data->shape_.resize(data->dl_tensor.ndim);
+ data->shape_.assign(data->dl_tensor.shape, data->dl_tensor.shape + data->dl_tensor.ndim);
+ data->dl_tensor.shape = data->shape_.data();
return NDArray(GetObjectPtr<Object>(data));
}