提交 8dd56af4 编写于 作者: P pangyoki

change array to vector

上级 4fdc6ad4
...@@ -13,6 +13,8 @@ See the License for the specific language governing permissions and ...@@ -13,6 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#pragma once #pragma once
#include <vector>
#include "paddle/fluid/framework/generator.h" #include "paddle/fluid/framework/generator.h"
#include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/operator.h"
...@@ -31,8 +33,7 @@ void MultinomialFunctor(T* out_data, const T* in_data, ...@@ -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_samples, const bool replacement,
const int64_t num_categories, const int64_t num_categories,
const int64_t num_distributions) { const int64_t num_distributions) {
const int64_t C = num_categories; std::vector<T> cumulative_probs(num_categories);
T cumulative_probs[C];
std::uniform_real_distribution<T> dist(0, 1); std::uniform_real_distribution<T> dist(0, 1);
auto gen_ptr = framework::DefaultCPUGenerator(); auto gen_ptr = framework::DefaultCPUGenerator();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册