From 08b73b68c4f7fae5a45c980cf28037ffc50a4ab2 Mon Sep 17 00:00:00 2001 From: zenghsh3 Date: Fri, 31 Aug 2018 12:34:11 +0800 Subject: [PATCH] fix bug of sampling_id_op --- paddle/fluid/operators/sampling_id_op.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/paddle/fluid/operators/sampling_id_op.h b/paddle/fluid/operators/sampling_id_op.h index 01308e416a9..a2bffa9c8ef 100644 --- a/paddle/fluid/operators/sampling_id_op.h +++ b/paddle/fluid/operators/sampling_id_op.h @@ -53,8 +53,13 @@ class SamplingIdKernel : public framework::OpKernel { static_cast(context.Attr("min")), static_cast(context.Attr("max"))); +<<<<<<< HEAD + std::vector ids(batch_size); + for (size_t i = 0; i < batch_size; ++i) { +======= std::vector ids(batch_size); for (int i = 0; i < batch_size; ++i) { +>>>>>>> 823c4f87beff04e4029e3f4a183658621ca8f01b T r = dist(engine); int idx = width - 1; for (int j = 0; j < width; ++j) { @@ -63,7 +68,11 @@ class SamplingIdKernel : public framework::OpKernel { break; } } +<<<<<<< HEAD + ids[i] = int64_t(idx); +======= ids[i] = ins_vector[idx]; +>>>>>>> 823c4f87beff04e4029e3f4a183658621ca8f01b } std::vector out_dim; -- GitLab