提交 cda5dc7c 编写于 作者: H HexToString

fix auto padding

上级 fcd0242f
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <errno.h> #include <errno.h>
#include <algorithm> #include <algorithm>
#include <cmath>
#include <cstring> #include <cstring>
#include <functional> #include <functional>
#include <list> #include <list>
...@@ -65,7 +64,7 @@ struct Task { ...@@ -65,7 +64,7 @@ struct Task {
typedef InItemT InType; typedef InItemT InType;
typedef OutItemT OutType; typedef OutItemT OutType;
typedef Task<InItemT, OutItemT> TaskT; typedef Task<InItemT, OutItemT> TaskT;
typedef std::vector<size_t> ShapeVector; typedef std::vector<int> ShapeVector;
typedef std::vector<ShapeVector> VectorOfShapeVector; typedef std::vector<ShapeVector> VectorOfShapeVector;
typedef baidu::paddle_serving::predictor::MempoolWrapper MempoolWrapper; typedef baidu::paddle_serving::predictor::MempoolWrapper MempoolWrapper;
...@@ -497,7 +496,7 @@ class BatchTasks { ...@@ -497,7 +496,7 @@ class BatchTasks {
typedef typename TaskT::InType InType; typedef typename TaskT::InType InType;
typedef typename TaskT::OutType OutType; typedef typename TaskT::OutType OutType;
typedef TaskMeta<TaskT> TaskMetaT; typedef TaskMeta<TaskT> TaskMetaT;
typedef std::vector<size_t> ShapeVector; typedef std::vector<int> ShapeVector;
typedef std::vector<ShapeVector> VectorOfShapeVector; typedef std::vector<ShapeVector> VectorOfShapeVector;
typedef std::vector<size_t> LodVector; typedef std::vector<size_t> LodVector;
typedef std::vector<LodVector> PaddleTensorLod; typedef std::vector<LodVector> PaddleTensorLod;
...@@ -567,9 +566,9 @@ class BatchTasks { ...@@ -567,9 +566,9 @@ class BatchTasks {
return 2; return 2;
} }
vector<size_t> multiplies_1(vector_of_max_shape.size()); std::vector<size_t> multiplies_1(vector_of_max_shape.size());
vector<size_t> multiplies_2(vector_of_max_shape.size()); std::vector<size_t> multiplies_2(vector_of_max_shape.size());
vector<size_t> temp_multiplies(vector_of_max_shape.size()); std::vector<size_t> temp_multiplies(vector_of_max_shape.size());
VectorOfShapeVector temp_vector_max_shape(vector_of_max_shape.size()); VectorOfShapeVector temp_vector_max_shape(vector_of_max_shape.size());
for (size_t i = 0; i < vector_of_max_shape.size(); ++i) { for (size_t i = 0; i < vector_of_max_shape.size(); ++i) {
if (vector_of_max_shape[i].size() != task_vector_shape[i].size()) if (vector_of_max_shape[i].size() != task_vector_shape[i].size())
...@@ -590,8 +589,8 @@ class BatchTasks { ...@@ -590,8 +589,8 @@ class BatchTasks {
task_vector_shape[i].end(), task_vector_shape[i].end(),
1, 1,
std::multiplies<size_t>()); std::multiplies<size_t>());
if ((abs(temp_multiplies[i] - multiplies_1[i]) <= ABSOLUTE_ERROR && if ((labs(temp_multiplies[i] - multiplies_1[i]) <= ABSOLUTE_ERROR &&
abs(temp_multiplies[i] - multiplies_2[i]) <= ABSOLUTE_ERROR) || labs(temp_multiplies[i] - multiplies_2[i]) <= ABSOLUTE_ERROR) ||
(temp_multiplies[i] / multiplies_1[i] >= RELATIVE_ERROR && (temp_multiplies[i] / multiplies_1[i] >= RELATIVE_ERROR &&
temp_multiplies[i] / multiplies_2[i] >= RELATIVE_ERROR)) { temp_multiplies[i] / multiplies_2[i] >= RELATIVE_ERROR)) {
continue; continue;
...@@ -698,7 +697,7 @@ class BatchTasks { ...@@ -698,7 +697,7 @@ class BatchTasks {
// batch.merge_tasks() is thread-safe function // batch.merge_tasks() is thread-safe function
// cause batch is a local variable and Task is just read, not written. // cause batch is a local variable and Task is just read, not written.
void copy_element_value(size_t) void merge_tasks() { void merge_tasks() {
if (_taskmeta_vector.size() <= 0) { if (_taskmeta_vector.size() <= 0) {
return; return;
} }
...@@ -1396,7 +1395,7 @@ class TaskExecutor { ...@@ -1396,7 +1395,7 @@ class TaskExecutor {
typedef typename TaskT::OutVectorT OutVectorT; typedef typename TaskT::OutVectorT OutVectorT;
typedef std::vector<TaskT> TaskArrayT; typedef std::vector<TaskT> TaskArrayT;
typedef baidu::paddle_serving::predictor::MempoolWrapper MempoolWrapper; typedef baidu::paddle_serving::predictor::MempoolWrapper MempoolWrapper;
typedef std::vector<size_t> ShapeVector; typedef std::vector<int> ShapeVector;
typedef std::vector<ShapeVector> VectorOfShapeVector; typedef std::vector<ShapeVector> VectorOfShapeVector;
TaskExecutor() TaskExecutor()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册