diff --git a/paddle/fluid/operators/multinomial_op.h b/paddle/fluid/operators/multinomial_op.h index c025fc3d6ff3c9963d8103d8d852cf4ee46491be..93504cc3b3d7da7497bc1b3938cb8f5df430008c 100644 --- a/paddle/fluid/operators/multinomial_op.h +++ b/paddle/fluid/operators/multinomial_op.h @@ -31,7 +31,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) { - int64_t C = num_categories + 1; + const int64_t C = num_categories; T cumulative_probs[C]; std::uniform_real_distribution dist(0, 1);