Skip to content

Commit

Permalink
Update math.py
Browse files Browse the repository at this point in the history
update example code
  • Loading branch information
Li-fAngyU authored Apr 3, 2022
1 parent b029831 commit b018a5d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions python/paddle/tensor/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,9 +1062,8 @@ def nanmean(x, axis=None, keepdim=False, name=None):
# [[[1, nan], [3, 4]],
# [[5, 6], [-nan, 8]]]
# Each example is followed by the corresponding output tensor.
y = np.array([[[1, float('nan')], [3, 4]],
[[5, 6], [float('-nan'), 8]]])
y = paddle.to_tensor(y)
y = paddle.to_tensor([[[1, float('nan')], [3, 4]],
[[5, 6], [float('-nan'), 8]]])
out5 = paddle.nanmean(y, axis=[1, 2])
# [2.66666667, 6.33333333]
out6 = paddle.nanmean(y, axis=[0, 1])
Expand Down

0 comments on commit b018a5d

Please sign in to comment.