Skip to content

Commit ccdb772

Browse files
committed
Made tensor copies a little more efficient.
1 parent a66a24f commit ccdb772

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

dlib/dnn/tensor.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,13 @@ namespace dlib
292292

293293
resizable_tensor(const resizable_tensor& item) : _annotation(item.annotation())
294294
{
295-
// TODO, do the copy with cuda?
296295
copy_size(item);
297-
std::memcpy(data_instance.host(), item.host(), data_instance.size()*sizeof(float));
296+
memcpy(data_instance, item.data_instance);
298297
}
299298
resizable_tensor(const tensor& item) : _annotation(item.annotation())
300299
{
301-
// TODO, do the copy with cuda?
302300
copy_size(item);
303-
std::memcpy(data_instance.host(), item.host(), data_instance.size()*sizeof(float));
301+
memcpy(*this, item);
304302
}
305303

306304
resizable_tensor(resizable_tensor&& item) { swap(item); }

0 commit comments

Comments
 (0)