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 13e5b6a95016a4c3c9be575861b13f131c61d983..81d5953cf0a66bfcecf3f9819fbbf31919ef1856 100644 --- a/paddle/operators/mul_op.h +++ b/paddle/operators/mul_op.h @@ -24,9 +24,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 f1d43002dc56ff36a7145795f721422d97d4fdde..dd5cde0c5dbed624def8519b645c4bf464df7100 100644 --- a/paddle/operators/rowwise_add_op.h +++ b/paddle/operators/rowwise_add_op.h @@ -26,6 +26,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 = in0.matrix(); auto bias = in1.vec(); diff --git a/paddle/operators/softmax_op.h b/paddle/operators/softmax_op.h index 34a6c299bbff4da63ff179ae093c0c6866436d06..6d675ea5f669867685a6909b0b479b66d38d9b9d 100644 --- a/paddle/operators/softmax_op.h +++ b/paddle/operators/softmax_op.h @@ -26,6 +26,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 = input.matrix(); auto softmax = output->matrix(); @@ -40,19 +41,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