(self, B, H, L, index, scores, device="cpu")
| 36 | |
| 37 | class ProbMask(): |
| 38 | def __init__(self, B, H, L, index, scores, device="cpu"): |
| 39 | _mask = torch.ones(L, scores.shape[-1], dtype=torch.bool).to(device).triu(1) |
| 40 | _mask_ex = _mask[None, None, :].expand(B, H, L, scores.shape[-1]) |
| 41 | indicator = _mask_ex[torch.arange(B)[:, None, None], |
| 42 | torch.arange(H)[None, :, None], |
| 43 | index, :].to(device) |
| 44 | self._mask = indicator.view(scores.shape).to(device) |
| 45 | |
| 46 | @property |
| 47 | def mask(self): |
nothing calls this directly
no outgoing calls
no test coverage detected