diff --git a/cmake/flags.cmake b/cmake/flags.cmake index c31e62fc08b531a38a851b71a033e14277eff015..34fd348893058980964d723490d9cc220a157b5a 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -124,6 +124,7 @@ set(GPU_COMMON_FLAGS -Wno-error=literal-suffix -Wno-error=unused-local-typedefs -Wno-error=unused-function # Warnings in Numpy Header. + -Wno-error=array-bounds # Warnings in Eigen::array ) if (APPLE) diff --git a/paddle/operators/mul_op.h b/paddle/operators/mul_op.h index 009ae8757f424ea4ec9864fbe1f4ab57069eed74..7bd1f7e759813b7309168a7d2aa253e3fc673b37 100644 --- a/paddle/operators/mul_op.h +++ b/paddle/operators/mul_op.h @@ -25,9 +25,10 @@ template class MulKernel : public framework::OpKernel { public: void Compute(const framework::KernelContext& context) const override { - Eigen::array, 1> dim_pair; - dim_pair[0].first = 1; - dim_pair[0].second = 0; + Eigen::array, 1> dim_pair = { + Eigen::IndexPair(1, 0)}; + // dim_pair[0].first = 1; + // dim_pair[0].second = 0; auto input0 = context.Input(0)->Get(); auto input1 = context.Input(1)->Get(); diff --git a/paddle/operators/rowwise_add_op.h b/paddle/operators/rowwise_add_op.h index ffe9378404e0220fc51593ac1db1c778ee9cbcbb..dc47fe7c847bd0c8c179ac0a5f44b8cc541b47cb 100644 --- a/paddle/operators/rowwise_add_op.h +++ b/paddle/operators/rowwise_add_op.h @@ -27,6 +27,7 @@ public: auto in0 = context.Input(0)->Get(); auto in1 = context.Input(1)->Get(); auto* out = context.Output(0)->GetMutable(); + out->mutable_data(context.GetPlace()); auto input = framework::EigenMatrix::From(in0); auto bias = framework::EigenVector::From(in1); diff --git a/paddle/operators/softmax_op.h b/paddle/operators/softmax_op.h index 53c626a7929dd150582ba0e65ff5183fe1198b04..500c188dbfcf28ae52c2d5b06466539e115acc4a 100644 --- a/paddle/operators/softmax_op.h +++ b/paddle/operators/softmax_op.h @@ -27,6 +27,7 @@ public: void Compute(const framework::KernelContext& context) const override { auto input = context.Input(0)->Get(); auto* output = context.Output(0)->GetMutable(); + output->mutable_data(context.GetPlace()); auto logits = framework::EigenMatrix::From(input); auto softmax = framework::EigenMatrix::From(*output); @@ -41,19 +42,21 @@ public: Eigen::DSizes batch_by_one(batch_size, 1); Eigen::DSizes one_by_class(1, num_classes); - auto shifted_logits = (logits - logits.maximum(along_class) - .eval() - .reshape(batch_by_one) - .broadcast(one_by_class)); + auto shifted_logits = (logits - + logits.maximum(along_class) + .eval() + .reshape(batch_by_one) + .broadcast(one_by_class)); softmax.device(*(context.GetEigenDevice())) = shifted_logits.exp(); softmax.device(*(context.GetEigenDevice())) = - (softmax * softmax.sum(along_class) - .inverse() - .eval() - .reshape(batch_by_one) - .broadcast(one_by_class)); + (softmax * + softmax.sum(along_class) + .inverse() + .eval() + .reshape(batch_by_one) + .broadcast(one_by_class)); } }; } // namespace operators