11 #ifndef CVCORE_MEMORY_H
12 #define CVCORE_MEMORY_H
14 #include <cuda_runtime_api.h>
38 void TensorBaseCopy2D(TensorBase &dst,
const TensorBase &src,
int dstPitch,
int srcPitch,
int widthInBytes,
int height,
51 typename std::enable_if<TL != HWC && TL != CHW && TL != NHWC && TL != NCHW>::type * =
nullptr>
66 template<TensorLayout TL, ChannelCount CC, ChannelType CT, typename std::enable_if<TL == HWC>::type * =
nullptr>
67 void Copy(Tensor<TL, CC, CT> &dst,
const Tensor<TL, CC, CT> &src,
cudaStream_t stream = 0)
71 dst.getWidth() * dst.getChannelCount() *
GetChannelSize(CT), src.getHeight(), stream);
83 template<TensorLayout TL, ChannelCount CC, ChannelType CT, typename std::enable_if<TL == NHWC>::type * =
nullptr>
84 void Copy(Tensor<TL, CC, CT> &dst,
const Tensor<TL, CC, CT> &src,
cudaStream_t stream = 0)
88 dst.getWidth() * dst.getChannelCount() *
GetChannelSize(CT), src.getDepth() * src.getHeight(),
101 template<TensorLayout TL, ChannelCount CC, ChannelType CT, typename std::enable_if<TL == CHW>::type * =
nullptr>
102 void Copy(Tensor<TL, CC, CT> &dst,
const Tensor<TL, CC, CT> &src,
cudaStream_t stream = 0)
106 src.getChannelCount() * src.getHeight(), stream);
118 template<TensorLayout TL, ChannelCount CC, ChannelType CT, typename std::enable_if<TL == NCHW>::type * =
nullptr>
119 void Copy(Tensor<TL, CC, CT> &dst,
const Tensor<TL, CC, CT> &src,
cudaStream_t stream = 0)
123 src.getDepth() * src.getChannelCount() * src.getHeight(), stream);
128 #endif // CVCORE_MEMORY_H