提交 b3baff20 编写于 作者: W wangguibao 提交者: iCode

Merge "Fix image classification bug"

......@@ -63,9 +63,11 @@ int ReaderOp::inference() {
// tls resource assignment
size_t dense_capacity = 3 * resize.width * resize.height;
size_t len = dense_capacity * sizeof(float) * sample_size;
float* data =
reinterpret_cast<float*>(MempoolWrapper::instance().malloc(len));
if (data == NULL) {
// Allocate buffer in PaddleTensor, so that buffer will be managed by the Tensor
in_tensor.data.Resize(len);
float *data = reinterpret_cast<float *>(in_tensor.data.data());
if (in_tensor.data.data() == NULL) {
LOG(ERROR) << "Failed create temp float array, "
<< "size=" << dense_capacity * sample_size * sizeof(float);
return -1;
......@@ -144,9 +146,6 @@ int ReaderOp::inference() {
}
}
}
paddle::PaddleBuf pbuf(data, len);
in_tensor.data = pbuf;
in->push_back(in_tensor);
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册