提交 fd4f7c3a 编写于 作者: T tensor-tang

refine seq2batch

上级 3a0b6f97
...@@ -38,13 +38,14 @@ class CopyMatrixRowsFunctor<platform::CPUDeviceContext, T> { ...@@ -38,13 +38,14 @@ class CopyMatrixRowsFunctor<platform::CPUDeviceContext, T> {
auto width = dst_dims[1]; auto width = dst_dims[1];
auto* src_data = src.data<T>(); auto* src_data = src.data<T>();
auto* dst_data = dst->data<T>(); auto* dst_data = dst->data<T>();
for (int i = 0; i < height; ++i) { const int sz = width * sizeof(T);
if (is_src_index) { if (is_src_index) {
memcpy(dst_data + i * width, src_data + index[i] * width, for (int i = 0; i < height; ++i) {
width * sizeof(T)); memcpy(dst_data + i * width, src_data + index[i] * width, sz);
} else { }
memcpy(dst_data + index[i] * width, src_data + i * width, } else {
width * sizeof(T)); for (int i = 0; i < height; ++i) {
memcpy(dst_data + index[i] * width, src_data + i * width, sz);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册