zhijian-liu / torchprofile

A general and accurate MACs / FLOPs profiler for PyTorch models
https://pypi.org/project/torchprofile/
MIT License
560 stars 38 forks source link

No handlers found: "aten::einsum" #17

Open 787629504 opened 2 years ago

787629504 commented 2 years ago

No handlers found: "aten::unfold" No handlers found: "aten::split" No handlers found: "aten::einsum". No handlers found: "aten::permute".

hope to support these ops, thanks!

zhijian-liu commented 2 years ago

Could you please provide an example model that contains aten::permute? Thank you!

787629504 commented 2 years ago

Thank you for your reply!

x = torch.randn(2, 3, 5) x.size() torch.Size([2, 3, 5]) x.permute(2, 0, 1).size() torch.Size([5, 2, 3])

It seems to not require any multiplication and addition operations. I have calculated flops using other calculation codes, thank you!

zhijian-liu commented 2 years ago

Thanks! I was trying to refer to aten::einsum. Do you have an example of that?

787629504 commented 2 years ago

The model in my code is a bit complex:

A = torch.randn(b,n,c,h,w,k) B = torch.randn(b,n,c,h,w,k) C = torch.einsum('bnchwk,bnchwk -> bnchw', A, B) C.shape torch.Size([b,n,c,h,w])

A simple example:

import torch A = torch.randn(3, 4) B = torch.randn(4, 5) C = torch.einsum('ik,kj->ij', A, B) C.shape torch.Size([3, 5])

Thank you!