You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@singa.apache.org by GitBox <gi...@apache.org> on 2020/03/19 07:31:25 UTC

[GitHub] [singa] dcslin opened a new pull request #632: make astype return new tensor

dcslin opened a new pull request #632: make astype return new tensor
URL: https://github.com/apache/singa/pull/632
 
 
   

----------------------------------------------------------------
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] [singa] dcslin commented on a change in pull request #632: make astype return new tensor

Posted by GitBox <gi...@apache.org>.
dcslin commented on a change in pull request #632: make astype return new tensor
URL: https://github.com/apache/singa/pull/632#discussion_r395624001
 
 

 ##########
 File path: src/core/tensor/tensor.cc
 ##########
 @@ -152,29 +152,24 @@ Tensor Resize(const Tensor &in, const Shape &shape) {
     }                                                                          \
   } while (0)
 
-Tensor &Tensor::AsType(const DataType type) {
+// return new tensor
+Tensor Tensor::AsType(const DataType type) {
 
 Review comment:
   Yes. We could add a flag to indicate this explictly. But second thought is, by adding in-place flag, `in-place=True` is also expected to be available. Then, it go back to the previous discussion, if we want to do `in-place` for multi-referenced tensor, what is the expected behavior?

----------------------------------------------------------------
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] [singa] nudles commented on a change in pull request #632: make astype return new tensor

Posted by GitBox <gi...@apache.org>.
nudles commented on a change in pull request #632: make astype return new tensor
URL: https://github.com/apache/singa/pull/632#discussion_r395412130
 
 

 ##########
 File path: src/core/tensor/tensor.cc
 ##########
 @@ -152,29 +152,24 @@ Tensor Resize(const Tensor &in, const Shape &shape) {
     }                                                                          \
   } while (0)
 
-Tensor &Tensor::AsType(const DataType type) {
+// return new tensor
+Tensor Tensor::AsType(const DataType type) {
 
 Review comment:
   do we need to add a flag for in-place? default can be False.

----------------------------------------------------------------
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] [singa] nudles commented on a change in pull request #632: make astype return new tensor

Posted by GitBox <gi...@apache.org>.
nudles commented on a change in pull request #632: make astype return new tensor
URL: https://github.com/apache/singa/pull/632#discussion_r395954782
 
 

 ##########
 File path: src/core/tensor/tensor.cc
 ##########
 @@ -152,29 +152,24 @@ Tensor Resize(const Tensor &in, const Shape &shape) {
     }                                                                          \
   } while (0)
 
-Tensor &Tensor::AsType(const DataType type) {
+// return new tensor
+Tensor Tensor::AsType(const DataType type) {
 
 Review comment:
   Do we have `in-place` for any other tensor functions?
   the behavior is 
   1. in-place = true, then reuse the memory (only works if the bitwidth is the same for the two data types).
   2. in-place= false, return a tensor with a new memory block.
   
   case 1 is a bit confusing for the case that the bitwidths are different for the two data types although it may save some cost.
   
   so let's just ignore the in-place flag.
   
   is your concern in the same?

----------------------------------------------------------------
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] [singa] dcslin commented on issue #632: make astype return new tensor

Posted by GitBox <gi...@apache.org>.
dcslin commented on issue #632: make astype return new tensor
URL: https://github.com/apache/singa/pull/632#issuecomment-601029839
 
 
   fix: https://github.com/apache/singa/issues/630

----------------------------------------------------------------
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] [singa] dcslin commented on a change in pull request #632: make astype return new tensor

Posted by GitBox <gi...@apache.org>.
dcslin commented on a change in pull request #632: make astype return new tensor
URL: https://github.com/apache/singa/pull/632#discussion_r396194217
 
 

 ##########
 File path: src/core/tensor/tensor.cc
 ##########
 @@ -152,29 +152,24 @@ Tensor Resize(const Tensor &in, const Shape &shape) {
     }                                                                          \
   } while (0)
 
-Tensor &Tensor::AsType(const DataType type) {
+// return new tensor
+Tensor Tensor::AsType(const DataType type) {
 
 Review comment:
   Yes. this is my concern.
   
   Currently the `in place` flag are available in python tensor api. No one in cpp tensor api yet.
   
   

----------------------------------------------------------------
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] [singa] nudles merged pull request #632: make astype return new tensor

Posted by GitBox <gi...@apache.org>.
nudles merged pull request #632: make astype return new tensor
URL: https://github.com/apache/singa/pull/632
 
 
   

----------------------------------------------------------------
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