Skip to content

Commit

Permalink
[CodeStyle][task 15] enable Ruff PLW3301 rule (PaddlePaddle#57400)
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooo-create authored Sep 18, 2023
1 parent b8e129b commit 56f4b88
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ select = [
# "PLR1701",
# "PLR1711", # Confirmation required
"PLR1722",
# "PLW3301", # Confirmation required
"PLW3301", # Confirmation required
]
unfixable = [
"NPY001"
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/distributed/passes/ps_trainer_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def dag_check_up_and_reorder(program, inputs, outputs):
gpups_outputs.extend(outputs)
gpups_w_size.extend([w.shape[1]] * len(inputs))
gpups_min_distributed_idx = min(
min(op_idxs), gpups_min_distributed_idx
*op_idxs, gpups_min_distributed_idx
)
continue

Expand Down
6 changes: 4 additions & 2 deletions python/paddle/tensor/manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,8 +970,10 @@ def _fill_diagonal_tensor_impl(x, y, offset=0, dim1=0, dim2=1, inplace=False):
if i != dim1 and i != dim2:
predshape.append(inshape[i])
diaglen = min(
min(inshape[dim1], inshape[dim1] + offset),
min(inshape[dim2], inshape[dim2] - offset),
inshape[dim1],
inshape[dim1] + offset,
inshape[dim2],
inshape[dim2] - offset,
)
predshape.append(diaglen)
assert tuple(predshape) == tuple(
Expand Down

0 comments on commit 56f4b88

Please sign in to comment.