You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/01/16 13:54:49 UTC

[GitHub] TX2012LH opened a new issue #9454: copy tensor from gpu to cpu

TX2012LH opened a new issue #9454: copy tensor from gpu to cpu
URL: https://github.com/apache/incubator-mxnet/issues/9454
 
 
   I just want to copy a tensor from gpu to cpu and I did it as below. But it seems that the pointer `cpu_box1.dptr__` is sidorderly after carrying on `Copy`. 
   ```
     virtual void Forward(const OpContext &ctx,
                          const std::vector<TBlob> &in_data,
                          const std::vector<OpReqType> &req,
                          const std::vector<TBlob> &out_data,
                          const std::vector<TBlob> &aux_args) {
       using namespace mshadow;
       CHECK_EQ(in_data.size(), 4U);
       CHECK_EQ(out_data.size(), 1U);
       Stream<xpu> *s = ctx.get_stream<xpu>();
       Tensor<xpu, 4, DType> data1 = in_data[roiconv::kData1].get<xpu, 4, DType>(s);
       Tensor<xpu, 2, DType> rois1 = in_data[roiconv::kRois1].get<xpu, 2, DType>(s);
       Tensor<xpu, 4, DType> out = out_data[roiconv::kOut].get<xpu, 4, DType>(s);
       out = 0.0f;
       Tensor<cpu, 2, DType> cpu_box1 = NewTensor<cpu, DType>(rois1.shape_, 0.0f);
       mshadow::Copy(cpu_box1, rois1, s);
       ...
   }
   ```
   ### env
   mxnet v0.12
   cuda-8.0
   ubuntu 16.04
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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