diff --git a/paddle/fluid/operators/multinomial_op.h b/paddle/fluid/operators/multinomial_op.h index 93504cc3b3d7da7497bc1b3938cb8f5df430008c..b3d5d393834eb03dada4e8e8aed001815cf6a700 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();