From 8dd56af4bd423aaa9a14db4daf7bb5310e15e999 Mon Sep 17 00:00:00 2001 From: pangyoki Date: Fri, 11 Sep 2020 07:04:03 +0000 Subject: [PATCH] change array to vector --- paddle/fluid/operators/multinomial_op.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/operators/multinomial_op.h b/paddle/fluid/operators/multinomial_op.h index 93504cc3b3..b3d5d39383 100644 --- a/paddle/fluid/operators/multinomial_op.h +++ b/paddle/fluid/operators/multinomial_op.h @@ -13,6 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ #pragma once + +#include #include "paddle/fluid/framework/generator.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/operator.h" @@ -31,8 +33,7 @@ void MultinomialFunctor(T* out_data, const T* in_data, const int64_t num_samples, const bool replacement, const int64_t num_categories, const int64_t num_distributions) { - const int64_t C = num_categories; - T cumulative_probs[C]; + std::vector cumulative_probs(num_categories); std::uniform_real_distribution dist(0, 1); auto gen_ptr = framework::DefaultCPUGenerator(); -- GitLab