From dd8faae3347622938cafd6c65254b85590aa1cc2 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 93504cc3b3d..b3d5d393834 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