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/11 01:52:58 UTC

[GitHub] [singa] dcslin opened a new pull request #625: [WIP]tensor.AsType()

dcslin opened a new pull request #625: [WIP]tensor.AsType()
URL: https://github.com/apache/singa/pull/625
 
 
   

----------------------------------------------------------------
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 #625: tensor.AsType()

Posted by GitBox <gi...@apache.org>.
dcslin commented on a change in pull request #625: tensor.AsType()
URL: https://github.com/apache/singa/pull/625#discussion_r392003376
 
 

 ##########
 File path: src/core/tensor/math_kernel.cu
 ##########
 @@ -184,6 +184,20 @@ __global__ void KernelAbs(const size_t n, const float *in, float *out) {
   }
 }
 
+__global__ void KernelAsType2(const size_t n, const float *in, int *out) {
 
 Review comment:
   Thank you, this is rectified.

----------------------------------------------------------------
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 #625: tensor.AsType()

Posted by GitBox <gi...@apache.org>.
dcslin commented on a change in pull request #625: tensor.AsType()
URL: https://github.com/apache/singa/pull/625#discussion_r392003311
 
 

 ##########
 File path: src/core/tensor/math_kernel.cu
 ##########
 @@ -184,6 +184,20 @@ __global__ void KernelAbs(const size_t n, const float *in, float *out) {
   }
 }
 
+__global__ void KernelAsType2(const size_t n, const float *in, int *out) {
+  for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < n;
+       i += blockDim.x * gridDim.x) {
+    out[i] = in[i];
 
 Review comment:
   I think it is working as implicit casting now

----------------------------------------------------------------
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 #625: tensor.AsType()

Posted by GitBox <gi...@apache.org>.
nudles merged pull request #625: tensor.AsType()
URL: https://github.com/apache/singa/pull/625
 
 
   

----------------------------------------------------------------
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 #625: [WIP]tensor.AsType()

Posted by GitBox <gi...@apache.org>.
nudles commented on a change in pull request #625: [WIP]tensor.AsType()
URL: https://github.com/apache/singa/pull/625#discussion_r391424456
 
 

 ##########
 File path: src/core/tensor/math_kernel.cu
 ##########
 @@ -184,6 +184,20 @@ __global__ void KernelAbs(const size_t n, const float *in, float *out) {
   }
 }
 
+__global__ void KernelAsType2(const size_t n, const float *in, int *out) {
 
 Review comment:
   can you give a better name?
   like KernelCastInt2Float or KernelInt2Float

----------------------------------------------------------------
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] joddiy commented on issue #625: [WIP]tensor.AsType()

Posted by GitBox <gi...@apache.org>.
joddiy commented on issue #625: [WIP]tensor.AsType()
URL: https://github.com/apache/singa/pull/625#issuecomment-598020442
 
 
   Hi, shicong, it works fine, thanks.

----------------------------------------------------------------
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 #625: tensor.AsType()

Posted by GitBox <gi...@apache.org>.
nudles commented on a change in pull request #625: tensor.AsType()
URL: https://github.com/apache/singa/pull/625#discussion_r392040380
 
 

 ##########
 File path: src/core/tensor/math_kernel.cu
 ##########
 @@ -184,6 +184,20 @@ __global__ void KernelAbs(const size_t n, const float *in, float *out) {
   }
 }
 
+__global__ void KernelAsType2(const size_t n, const float *in, int *out) {
+  for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < n;
+       i += blockDim.x * gridDim.x) {
+    out[i] = in[i];
 
 Review comment:
   better make it explicit. 

----------------------------------------------------------------
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 #625: [WIP]tensor.AsType()

Posted by GitBox <gi...@apache.org>.
nudles commented on a change in pull request #625: [WIP]tensor.AsType()
URL: https://github.com/apache/singa/pull/625#discussion_r391424684
 
 

 ##########
 File path: src/core/tensor/math_kernel.cu
 ##########
 @@ -184,6 +184,20 @@ __global__ void KernelAbs(const size_t n, const float *in, float *out) {
   }
 }
 
+__global__ void KernelAsType2(const size_t n, const float *in, int *out) {
+  for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < n;
+       i += blockDim.x * gridDim.x) {
+    out[i] = in[i];
 
 Review comment:
   do you need the cast operation like `out[i]=int(in[i])?

----------------------------------------------------------------
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 #625: [wip]tensor.AsType()

Posted by GitBox <gi...@apache.org>.
dcslin commented on a change in pull request #625: [wip]tensor.AsType()
URL: https://github.com/apache/singa/pull/625#discussion_r393475851
 
 

 ##########
 File path: src/core/tensor/math_kernel.cu
 ##########
 @@ -184,6 +184,20 @@ __global__ void KernelAbs(const size_t n, const float *in, float *out) {
   }
 }
 
+__global__ void KernelAsType2(const size_t n, const float *in, int *out) {
+  for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < n;
+       i += blockDim.x * gridDim.x) {
+    out[i] = in[i];
 
 Review comment:
   thank you for the suggestion. it is explicited now.

----------------------------------------------------------------
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 #625: tensor.AsType()

Posted by GitBox <gi...@apache.org>.
dcslin commented on issue #625: tensor.AsType()
URL: https://github.com/apache/singa/pull/625#issuecomment-598523093
 
 
   This is ready for merge

----------------------------------------------------------------
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 #625: [WIP]tensor.AsType()

Posted by GitBox <gi...@apache.org>.
dcslin commented on issue #625: [WIP]tensor.AsType()
URL: https://github.com/apache/singa/pull/625#issuecomment-597972910
 
 
   Hi @joddiy , before i clean the code, please check if this works for you?
   https://github.com/apache/singa/blob/41eca964faf7de14cea53c6ba465ce44e7cdfaa4/test/python/test_tensor.py#L340

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