Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions paddle/fluid/operators/filter_by_instag_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,26 @@ class FilterByInstagKernel : public framework::OpKernel<T> {
// expected auto = const int64_t
auto* x2_data = x2->data<int64_t>();
// e.g get [0, 1, 2, 3, ...]
auto x2_lods = x2->lod()[0];
size_t x2_lods_size = x2->dims()[0];
Vector<size_t> x1_lods(1, 0);
if (!is_x1_lod) {
for (int i = 0; i < x1->dims()[0]; i++) {
x1_lods.push_back(i + 1);
}
} else {
x1_lods = context.Input<LoDTensor>("Ins")->lod()[0];
// new: lod_level=0 => lod() return {}
if (x1->lod().size() != 0) {
x1_lods = x1->lod()[0];
} else {
for (int i = 0; i < x1->dims()[0]; i++) {
x1_lods.push_back(i + 1);
}
}
}
std::unordered_map<int64_t, int64_t> mmap_aux;
Vector<size_t> out_lods(1, 0);
for (size_t i = 0; i < x2_lods.size() - 1; i++) {
for (size_t j = x2_lods[i]; j < x2_lods[i + 1]; j++) {
for (size_t i = 0; i < x2_lods_size; i++) {
for (size_t j = i; j < i + 1; j++) {
if (filter_tag.find(x2_data[j]) != filter_tag.end()) {
size_t batch_len = x1_lods[i + 1] - x1_lods[i];
mmap_aux[out_lods.back()] = x1_lods[i];
Expand Down