Skip to content

Commit

Permalink
code review, fixing a small mypy issue
Browse files Browse the repository at this point in the history
  • Loading branch information
blefaudeux committed Nov 4, 2021
1 parent 8018f69 commit 11f9d38
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions xformers/components/attention/nystrom.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ def forward(
)
key_padding_mask = bool_mask_to_additive(key_padding_mask)

assert key_padding_mask is not None # mypy is drunk

if key_padding_mask.ndim == 2:
key_padding_mask = reshape_key_padding_mask(
key_padding_mask, batched_dim
Expand Down
2 changes: 1 addition & 1 deletion xformers/components/attention/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def iterative_pinv(softmax_mat: torch.Tensor, n_iter=6, pinverse_original_init=F

def bool_mask_to_additive(
mask: torch.Tensor, dtype: Optional[torch.dtype] = torch.float32
):
) -> torch.Tensor:
assert (
mask.dtype == torch.bool
), "This util is meant to convert in between bool masks and additive ones"
Expand Down

0 comments on commit 11f9d38

Please sign in to comment.