Skip to content

Commit 2ec40a4

Browse files
committed
Fix
1 parent fff45c0 commit 2ec40a4

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

paddle/fluid/pybind/data_set_py.cc

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class IterableDatasetWrapper {
140140
}
141141

142142
for (size_t j = 0; j < slots_.size(); ++j) {
143-
if (!IsValidLoDTensor(*tensors_[i][j])) {
143+
if (!IsValidDenseTensor(*tensors_[i][j])) {
144144
is_success = false;
145145
break;
146146
}
@@ -176,19 +176,9 @@ class IterableDatasetWrapper {
176176
}
177177

178178
private:
179-
bool IsValidLoDTensor(const phi::DenseTensor &tensor) const {
180-
auto &lod = tensor.lod();
181-
PADDLE_ENFORCE_LE(
182-
lod.size(),
183-
1,
184-
common::errors::InvalidArgument("LoD level must be not larger than 1"));
179+
bool IsValidDenseTensor(const phi::DenseTensor &tensor) const {
185180
if (!drop_last_) return true;
186-
187-
if (lod.empty()) {
188-
return static_cast<size_t>(tensor.dims()[0]) == batch_size_;
189-
} else {
190-
return lod[0].size() == batch_size_ + 1;
191-
}
181+
return static_cast<size_t>(tensor.dims()[0]) == batch_size_;
192182
}
193183

194184
private:

0 commit comments

Comments
 (0)