提交 91e6dcb6 编写于 作者: W wangyang59

fixed a bug in Paddle::Vector::createCpuVectorFromNumpy

上级 70fecee0
...@@ -223,7 +223,7 @@ Vector* Vector::createCpuVectorFromNumpy(float* data, int dim, bool copy) { ...@@ -223,7 +223,7 @@ Vector* Vector::createCpuVectorFromNumpy(float* data, int dim, bool copy) {
auto retVec = new Vector(); auto retVec = new Vector();
if (copy) { if (copy) {
retVec->m->vec = paddle::Vector::create((size_t)dim, false); retVec->m->vec = paddle::Vector::create((size_t)dim, false);
return retVec; retVec->m->vec->copyFrom(data, dim);
} else { } else {
retVec->m->vec = paddle::Vector::create(data, (size_t)dim, false); retVec->m->vec = paddle::Vector::create(data, (size_t)dim, false);
} }
......
...@@ -150,3 +150,4 @@ if __name__ == '__main__': ...@@ -150,3 +150,4 @@ if __name__ == '__main__':
swig_paddle.initPaddle("--use_gpu=1" swig_paddle.initPaddle("--use_gpu=1"
if swig_paddle.isGpuVersion() else "--use_gpu=0") if swig_paddle.isGpuVersion() else "--use_gpu=0")
unittest.main() unittest.main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册