Skip to content

fix bug in _einsum_flops_compute when using torch.einsum #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Necolizer
Copy link

Thank you for your excellent work!

This issue #40 gives a toy example of multi-head self-attention implemented using torch.einsum. Running that script gets an AttributeError raised in function _einsum_flops_compute(). To fix this, I made minimal modifications to the way of getting input_shapes list:

input_shapes = [o_element.shape for o in operands for o_element in (o if isinstance(o, list) else [o])]

If o is a list, we just collect the shapes of all its elements (o_elements), otherwise we get the shape of o.

fix the AttributeError raised in function _einsum_flops_compute() when using torch.einsum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant