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

Request to include FLOP count for Graph Convolutions #71

Open
pranavgundewar opened this issue Jun 15, 2021 · 3 comments
Open

Request to include FLOP count for Graph Convolutions #71

pranavgundewar opened this issue Jun 15, 2021 · 3 comments
Labels
question Further information is requested

Comments

@pranavgundewar
Copy link

No description provided.

@sovrasov
Copy link
Owner

There is no standard module in torch.nn representing graph convolutions, while ptflops can account pytorch's modules only.
You can also write a custom hook for your GCN implementation and pass it to ptflops.

@sovrasov sovrasov added the question Further information is requested label Jun 24, 2021
@pranavgundewar
Copy link
Author

@sovrasov Can you share some examples of writing a custom hook for GCN implementation?

Thank you!

@sovrasov
Copy link
Owner

Hi! Here is a brief example:

class MyModule(nn.Module):
    def forward(self, x):
        return x
def my_module_flops_counter_hook(module, input, output):
    module.__flops__ += 0

model = MyModule()
macs, params = get_model_complexity_info(net, (3, 224, 224), as_strings=True,
                                           print_per_layer_stat=True,
                                           verbose=True,
                                           custom_modules_hooks={MyModule: my_module_flops_counter_hook})

Instead of MyModule you could substitute your GCN implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants