8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 916e897 commit f3ac95bCopy full SHA for f3ac95b
torch/_tensor_docs.py
@@ -3185,6 +3185,15 @@ def callable(a, b) -> number
3185
Args:
3186
mask (BoolTensor): the boolean mask
3187
value (float): the value to fill in with
3188
+
3189
+Example:
3190
+ >>> self = torch.tensor([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
3191
+ >>> mask = torch.tensor([[0, 1, 0, 1, 0], [1, 0, 1, 0, 1]], dtype=torch.bool)
3192
+ >>> self.masked_fill_(mask, -1)
3193
+ >>> self
3194
+ tensor([[ 1, -1, 3, -1, 5],
3195
+ [-1, 7, -1, 9, -1]])
3196
3197
""",
3198
)
3199
@@ -6587,6 +6596,14 @@ def callable(a, b) -> number
6587
6596
masked_fill(mask, value) -> Tensor
6588
6597
6589
6598
Out-of-place version of :meth:`torch.Tensor.masked_fill_`
6599
6600
6601
6602
6603
+ >>> self.masked_fill(mask, -1)
6604
6605
6606
6590
6607
6591
6608
6592
6609
0 commit comments