Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Fix PIR Unittest No.74】Fix some test cast in PIR mode #64350

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
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
21 changes: 16 additions & 5 deletions python/paddle/base/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import paddle
from paddle.base.framework import _set_expected_place
from paddle.pir.core import datatype_to_vartype

from . import core
from .data_feeder import BatchedTensorProvider, DataFeeder
Expand All @@ -35,6 +36,7 @@
default_main_program,
default_startup_program,
in_dygraph_mode,
in_pir_mode,
program_guard,
)
from .layers.io import (
Expand Down Expand Up @@ -840,10 +842,16 @@ def _init_iterable(self):
self._wait_thread_ends()
self._var_names = [v.name for v in self._feed_list]
self._shapes = [v.shape for v in self._feed_list]
self._dtypes = [v.dtype for v in self._feed_list]
self._need_check_feed = [
v.desc.need_check_feed() for v in self._feed_list
]
if in_pir_mode():
self._dtypes = [
datatype_to_vartype[v.dtype] for v in self._feed_list
]
self._need_check_feed = [False for v in self._feed_list]
else:
self._dtypes = [v.dtype for v in self._feed_list]
self._need_check_feed = [
v.desc.need_check_feed() for v in self._feed_list
]
self._queue = core.init_lod_tensor_blocking_queue(
core.Variable(), self._capacity, self._keep_order
)
Expand Down Expand Up @@ -874,7 +882,10 @@ def _init_non_iterable(self):
ranks.append(len(feed_data.shape))
shapes.append(feed_data.shape)
lod_levels.append(feed_data.lod_level)
need_check_feed.append(int(feed_data.desc.need_check_feed()))
if in_pir_mode():
need_check_feed.append(0)
else:
need_check_feed.append(int(feed_data.desc.need_check_feed()))

queue_name = data_loader_unique_name_generator(
'lod_tensor_blocking_queue'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,5 @@ def setUp(self):


if __name__ == '__main__':
paddle.enable_static()
unittest.main()