본문 바로가기

TIL

[Pytorch] torch.Tensor.masked_fill

https://pytorch.org/docs/stable/generated/torch.Tensor.masked_fill_.html

 

torch.Tensor.masked_fill_ — PyTorch 2.5 documentation

Shortcuts

pytorch.org

공식 document에 따르면 `torch.Tensor.masked_fill_`의 구버전으로, 

`Tensor.masked_fill_(mask, value)`의 형태로 사용 가능하다.

 

`mask`에 해당되는 Tensor의 값을 `value`로 바꿔 return시켜주는 메소드이다.