Skip to content

Commit 7c7d3d6

Browse files
committed
Fix mac
1 parent 7cb6fe7 commit 7c7d3d6

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

paddle/fluid/framework/ir/attention_lstm_fuse_pass.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ void PrepareLSTMWeight(const LoDTensor& W_forget_w0,
216216

217217
float* out_data = out->mutable_data<float>(platform::CPUPlace());
218218
std::array<const float*, 4> tensors(
219-
{W_forget_w0.data<float>(), W_input_w0.data<float>(),
220-
W_output_w0.data<float>(), W_cell_w0.data<float>()});
219+
{{W_forget_w0.data<float>(), W_input_w0.data<float>(),
220+
W_output_w0.data<float>(), W_cell_w0.data<float>()}});
221221
std::array<const float*, 4> tensors1(
222-
{W_forget_w1.data<float>(), W_input_w1.data<float>(),
223-
W_output_w1.data<float>(), W_cell_w1.data<float>()});
222+
{{W_forget_w1.data<float>(), W_input_w1.data<float>(),
223+
W_output_w1.data<float>(), W_cell_w1.data<float>()}});
224224

225225
for (int row = 0; row < D; row++) {
226226
for (int col = 0; col < 4; col++) {
@@ -243,8 +243,8 @@ void PrepareLSTMBias(const LoDTensor& B_forget, const LoDTensor& B_input,
243243
const LoDTensor& B_output, const LoDTensor& B_cell,
244244
LoDTensor* out) {
245245
std::array<const float*, 4> tensors(
246-
{B_forget.data<float>(), B_input.data<float>(), B_output.data<float>(),
247-
B_cell.data<float>()});
246+
{{B_forget.data<float>(), B_input.data<float>(), B_output.data<float>(),
247+
B_cell.data<float>()}});
248248

249249
PADDLE_ENFORCE_EQ(B_forget.dims().size(), 1);
250250
int D = B_forget.dims()[0];

paddle/fluid/inference/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ get_property(fluid_modules GLOBAL PROPERTY FLUID_MODULES)
1717
# paddle_fluid_origin exclude inference api interface
1818
cc_library(paddle_fluid_origin DEPS ${fluid_modules} paddle_fluid_api)
1919

20-
if(NOT APPLE)
20+
if(APPLE)
2121
add_subdirectory(api)
2222
endif()
2323

paddle/fluid/inference/analysis/argument.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct Argument {
6666
PADDLE_ENFORCE_NOT_NULL(data);
6767
PADDLE_ENFORCE(!attrs_.count(key), "duplicate attr called %s", key);
6868
attrs_[key] = data;
69-
attr_deleters_[key] = [data, key, this]() {
69+
attr_deleters_[key] = [data, key]() {
7070
VLOG(3) << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
7171
VLOG(3) << "argument delete attr: " << key;
7272
delete data;

paddle/fluid/inference/api/api_impl.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,13 @@ std::unique_ptr<PaddlePredictor> NativePaddlePredictor::Clone() {
175175
LOG(ERROR) << "fail to call Init";
176176
return nullptr;
177177
}
178+
#ifdef __clang__
179+
// fix clang compile error
180+
return cls;
181+
#else
178182
// fix manylinux compile error.
179183
return std::move(cls);
184+
#endif
180185
}
181186

182187
bool NativePaddlePredictor::SetFeed(const std::vector<PaddleTensor> &inputs,
@@ -310,7 +315,12 @@ std::unique_ptr<PaddlePredictor> CreatePaddlePredictor<
310315
if (!dynamic_cast<NativePaddlePredictor *>(predictor.get())->Init(nullptr)) {
311316
return nullptr;
312317
}
318+
#ifdef __clang__
319+
//fix clang compile error
320+
return predictor;
321+
#else
313322
return std::move(predictor);
323+
#endif
314324
}
315325

316326
} // namespace paddle

paddle/fluid/inference/api/helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <sys/time.h>
1818
#include <algorithm>
19+
#include <numeric>
1920
#include <sstream>
2021
#include <string>
2122
#include <vector>

0 commit comments

Comments
 (0)