Skip to content
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

Count flops by a range #198

Open
Angiemaster opened this issue Feb 17, 2023 · 0 comments
Open

Count flops by a range #198

Angiemaster opened this issue Feb 17, 2023 · 0 comments

Comments

@Angiemaster
Copy link

Angiemaster commented Feb 17, 2023

Hi,
I tried this code, it works, but may I know how can I get flops if I just wanna some specific ranges/blocks? thank you

    for m in model.modules():
        if len(list(m.children())) > 0: # skip for non-leaf module
            continue
        # print layer-wise information here.
        print(str(m),  m.total_ops, m.total_params)
        total_ops += m.total_ops
        total_params += m.total_params

Originally posted by @Lyken17 in #3 (comment)

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

No branches or pull requests

1 participant