for (int batch_idx = 0; batch_idx < _batch_size; ++batch_idx)
{
letterbox(images[batch_idx], blob_imgs_host[batch_idx], size);
cv::cuda::GpuMat blob_img_GPU;
blob_img_GPU.upload(blob_imgs_host[batch_idx]);
cout << "pointer_host:" << blob_imgs_host[batch_idx].ptr<float>() << endl;
CHECK(cudaMemcpyAsync(
(char *)_device_ptrs[0] + batch_idx * total_elements * blob_img_GPU.elemSize(),
blob_img_GPU.ptr<float>(),
total_elements * blob_img_GPU.elemSize(),
cudaMemcpyDeviceToDevice,
_stream));
}
When I use function cudaMemcpyAsync copy memory DeviceToDevice,the second parameters need to pass the device address of blob_img_GPU,How should I specify it? In my code, I use blob_img_GPU.ptr(),but it is fault. When I run the codeļ¼error with invalid argument.