Skip to content

Commit

Permalink
Fix (#70015)
Browse files Browse the repository at this point in the history
  • Loading branch information
co63oc authored Dec 9, 2024
1 parent d6b74b7 commit 84fff6c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion paddle/fluid/pybind/eager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void EmptyTensorInitializer(TensorObject* self,
} else {
VLOG(6) << "in EmptyTensorInitializer, create DenseTensor";
if (var_type == paddle::framework::proto::VarType::DENSE_TENSOR) {
// TODO(jiabin): Maybe support LOD later
// TODO(jiabin): Maybe support LegacyLoD later
std::shared_ptr<phi::DenseTensor> dense_tensor = nullptr;
if (dims.size() == 1 && dims[0] == 0) {
std::shared_ptr<phi::Allocation> allocation_ptr = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions paddle/fluid/pybind/eager_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ paddle::Tensor CreateTensorFromVarDesc(
autograd_meta->SetStopGradient(var_desc.StopGradient());

if (var_type == paddle::framework::proto::VarType::DENSE_TENSOR) {
// TODO(jiabin): Maybe support LOD later
// TODO(jiabin): Maybe support LegacyLoD later
std::shared_ptr<phi::DenseTensor> dense_tensor = nullptr;
if (dims.size() == 1 && dims[0] == 0) {
std::shared_ptr<phi::Allocation> allocation_ptr = nullptr;
Expand Down Expand Up @@ -1998,7 +1998,7 @@ paddle::Tensor CreateTensorFromValue(const pir::Value& value) {
autograd_meta->SetStopGradient(GetValueBoolAttr(value, kAttrStopGradients));

if (value.type().isa<paddle::dialect::DenseTensorType>()) {
// TODO(jiabin): Maybe support LOD later
// TODO(jiabin): Maybe support LegacyLoD later
std::shared_ptr<phi::DenseTensor> dense_tensor = nullptr;
auto dtype = paddle::dialect::TransToPhiDataType(
value.type().dyn_cast<paddle::dialect::DenseTensorType>().dtype());
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/pybind/protobuf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ void BindVarDesc(pybind11::module *m) {
.value("FEED_MINIBATCH", pd::proto::VarType::FEED_MINIBATCH)
.value("FETCH_LIST", pd::proto::VarType::FETCH_LIST)
.value("STEP_SCOPES", pd::proto::VarType::STEP_SCOPES)
.value("LOD_RANK_TABLE", pd::proto::VarType::LOD_RANK_TABLE)
.value("DENSE_TENSOR_ARRAY", pd::proto::VarType::DENSE_TENSOR_ARRAY)
.value("PLACE_LIST", pd::proto::VarType::PLACE_LIST)
.value("READER", pd::proto::VarType::READER)
Expand Down
4 changes: 2 additions & 2 deletions paddle/fluid/pybind/reader_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,11 @@ void BindReader(py::module *module) {
});

m.def(
"init_lod_tensor_blocking_queue",
"init_dense_tensor_blocking_queue",
[](framework::Variable &var,
size_t capacity,
bool is_ordered) -> py::object {
VLOG(1) << "init_lod_tensor_blocking_queue";
VLOG(1) << "init_dense_tensor_blocking_queue";
if (is_ordered) {
auto *holder = var.GetMutable<
reader::OrderedMultiDeviceDenseTensorBlockingQueueHolder>();
Expand Down
8 changes: 3 additions & 5 deletions paddle/fluid/pybind/tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,9 @@ void BindTensor(pybind11::module &m) { // NOLINT
return std::make_unique<phi::DenseTensor>(new_offset_lod);
}))
.def(py::init([]() { return std::make_unique<phi::DenseTensor>(); }))
// We implement offset based LOD in C++ while we use length based with
// Python API. So we changed set_lod to set_recursive_sequence_lengths
// to
// avoid misuse.
// The discussion is here:
// We implement offset based LegacyLoD in C++ while we use length based
// with Python API. So we changed set_lod to
// set_recursive_sequence_lengths to avoid misuse. The discussion is here:
// https://github.com/PaddlePaddle/Paddle/issues/10855
.def(
"set_lod",
Expand Down
6 changes: 3 additions & 3 deletions python/paddle/base/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def _init_iterable(self):
self._shapes = []
self._dtypes = []
self._need_check_feed = []
self._blocking_queue = core.init_lod_tensor_blocking_queue(
self._blocking_queue = core.init_dense_tensor_blocking_queue(
core.Variable(), self._capacity, False
)
self._reader = None
Expand Down Expand Up @@ -854,7 +854,7 @@ def _init_iterable(self):
self._need_check_feed = [
v.desc.need_check_feed() for v in self._feed_list
]
self._queue = core.init_lod_tensor_blocking_queue(
self._queue = core.init_dense_tensor_blocking_queue(
core.Variable(), self._capacity, self._keep_order
)
self._reader = None
Expand Down Expand Up @@ -898,7 +898,7 @@ def _init_non_iterable(self):
double_buffer_name = data_loader_unique_name_generator('double_buffer')

var = global_scope().var(queue_name)
self._queue = core.init_lod_tensor_blocking_queue(
self._queue = core.init_dense_tensor_blocking_queue(
var, self._capacity, self._keep_order
)

Expand Down
4 changes: 2 additions & 2 deletions python/paddle/io/dataloader/dataloader_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def _init_thread(self):
]
self._dtypes = [v.dtype for v in self._feed_list]
# if only 1 place, do not need to keep order
self._blocking_queue = core.init_lod_tensor_blocking_queue(
self._blocking_queue = core.init_dense_tensor_blocking_queue(
core.Variable(),
self._blocking_queue_capacity,
len(self._places) > 1,
Expand Down Expand Up @@ -507,7 +507,7 @@ def _init_thread(self):
]
self._dtypes = [v.dtype for v in self._feed_list]
# if only 1 place, do not need to keep order
self._blocking_queue = core.init_lod_tensor_blocking_queue(
self._blocking_queue = core.init_dense_tensor_blocking_queue(
core.Variable(), self._outstanding_capacity, len(self._places) > 1
)
core._set_max_memory_map_allocation_pool_size(
Expand Down

0 comments on commit 84fff6c

Please sign in to comment.