Skip to content

Commit fea4b9e

Browse files
committed
fix(nyz): fix unittest and platformtest bug
1 parent 66ff69b commit fea4b9e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.github/workflows/platform_test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
if: "!contains(github.event.head_commit.message, 'ci skip')"
1212
strategy:
1313
matrix:
14-
os: [macos-latest, windows-latest]
14+
os: [macos-13, windows-latest]
1515
python-version: [3.8, 3.9]
1616

1717
steps:

ding/rl_utils/td.py

+2
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ def nstep_return(data: namedtuple, gamma: Union[float, list], nstep: int, value_
266266
if value_gamma is None:
267267
return_ = return_tmp + (gamma ** nstep) * next_value * (1 - done)
268268
else:
269+
if np.isscalar(value_gamma):
270+
value_gamma = torch.full_like(next_value, value_gamma)
269271
value_gamma = view_similar(value_gamma, next_value)
270272
done = view_similar(done, next_value)
271273
return_ = return_tmp + value_gamma * next_value * (1 - done)

0 commit comments

Comments
 (0)