You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/04/10 02:33:11 UTC

[GitHub] [incubator-tvm] hlu1 opened a new pull request #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack

hlu1 opened a new pull request #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack
URL: https://github.com/apache/incubator-tvm/pull/5301
 
 
   In some cases, the shape info in DLTensor.shape might not be dynamically allocated and may cease to exist after passing the DLTensor to NDArray. We can avoid this problem by setting NDArray::Container.shape_ at construction time and assign it back to DLTensor.shape.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] tqchen commented on issue #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack

Posted by GitBox <gi...@apache.org>.
tqchen commented on issue #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack
URL: https://github.com/apache/incubator-tvm/pull/5301#issuecomment-612059197
 
 
   get you, Thanks @hlu1 !

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] tqchen commented on issue #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack

Posted by GitBox <gi...@apache.org>.
tqchen commented on issue #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack
URL: https://github.com/apache/incubator-tvm/pull/5301#issuecomment-611866774
 
 
   Good catch, thanks @hlu1 !

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] hlu1 commented on issue #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack

Posted by GitBox <gi...@apache.org>.
hlu1 commented on issue #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack
URL: https://github.com/apache/incubator-tvm/pull/5301#issuecomment-611909315
 
 
   Another thing that's related:
   
   ```
   std::vector<int64_t> NDArray::Shape() const {
     return get_mutable()->shape_;
   }
   ```
   https://github.com/apache/incubator-tvm/blob/master/src/runtime/ndarray.cc#L251-L253
   
   If we don't set `shape_` in `NDArray::FromDLPack`, we'll need to fix `NDArray::Shape()` to make sure it returns the right shape info.
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] hlu1 commented on issue #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack

Posted by GitBox <gi...@apache.org>.
hlu1 commented on issue #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack
URL: https://github.com/apache/incubator-tvm/pull/5301#issuecomment-611907106
 
 
   I'm referring to the case that DLManagedTensor.dl_tensor.shape which is an int64_t* could be pointing to an array that's allocated in the stack and not on the heap. People are usually pretty careful to make sure the data is allocated on the heap and properly deleted in the deleter, but forget to do the same for the shape info.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] tqchen merged pull request #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack

Posted by GitBox <gi...@apache.org>.
tqchen merged pull request #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack
URL: https://github.com/apache/incubator-tvm/pull/5301
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] tqchen edited a comment on issue #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack

Posted by GitBox <gi...@apache.org>.
tqchen edited a comment on issue #5301: [NDArray] Set NDArray::Container.shape_ in NDArray::FromDLPack
URL: https://github.com/apache/incubator-tvm/pull/5301#issuecomment-611866774
 
 
   THanks @hlu1 however, according to the DLPack conventionm, the DLManagedTensor won't be deleted until the deleter is called, could it due to the exporter that violates the convention?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services