Commit 4f7c01f4 authored by Davis King's avatar Davis King

Added more overloads of memcpy() for cuda_data_ptr.

parent b23c7186
...@@ -178,15 +178,31 @@ namespace dlib ...@@ -178,15 +178,31 @@ namespace dlib
} }
friend void memcpy( friend void memcpy(
cuda_data_ptr& src, cuda_data_ptr& dest,
const std::vector<T>& dest const std::vector<T>& src
) )
{ {
if (dest.size() != src.size()) if (src.size() != dest.size())
dest = cuda_data_ptr<T>(src.size()); src = cuda_data_ptr<T>(dest.size());
if (src.size() != 0) if (dest.size() != 0)
memcpy(src.pdata, dest.data()); memcpy(dest.pdata, src.data());
}
friend void memcpy(
cuda_data_ptr& dest,
const float* src
)
{
memcpy(dest.pdata, src);
}
friend void memcpy(
float* dest,
const cuda_data_ptr& src
)
{
memcpy(dest, src.pdata);
} }
private: private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment