Skip to content

Commit

Permalink
classmethod -> staticmethod where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
gsarti committed Jan 16, 2023
1 parent f6f0a64 commit f40f63b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions inseq/attr/feat/ops/basic_attention.py
Expand Up @@ -47,17 +47,17 @@ class BaseAttentionAttribution(Attribution):
"single": lambda x, dim, idx: x.select(dim, idx),
}

@classmethod
def has_convergence_delta(cls) -> bool:
@staticmethod
def has_convergence_delta() -> bool:
return False

@classmethod
def _num_attention_heads(cls, attention: FullLayerAttentionTensor) -> int:
@staticmethod
def _num_attention_heads(attention: FullLayerAttentionTensor) -> int:
"""Returns the number of heads contained in the attention tensor."""
return attention.size(1)

@classmethod
def _num_layers(cls, attention: FullAttentionOutput) -> int:
@staticmethod
def _num_layers(attention: FullAttentionOutput) -> int:
"""Returns the number of layers contained in the attention tensor."""
return len(attention)

Expand Down

0 comments on commit f40f63b

Please sign in to comment.