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

Calculation about the FLOP of full-connected layer. #2

Closed
dawson-chen opened this issue Apr 16, 2020 · 2 comments
Closed

Calculation about the FLOP of full-connected layer. #2

dawson-chen opened this issue Apr 16, 2020 · 2 comments

Comments

@dawson-chen
Copy link

First, thanks for you work, it's very useful for inference BERT-like modes. Hope your paper get published soon.
And something i'm confused about is the FLOP of dense layer, which is in the section 4.1.
As far as i know, the FLOPs of fully connect layer with bias = 2 * I * O

I=input neuron numbers, O=output neuron numbers.

For the Fully-connect layer 128 ->128, FLOPs = 2 * 128 * 128 = 32,768
And in the Table 1, the answer is 4.2M, which is much higher than i got.
Can you release your method to calculate the answer ?

@autoliuweijie
Copy link
Owner

First, thanks for you work, it's very useful for inference BERT-like modes. Hope your paper get published soon.
And something i'm confused about is the FLOP of dense layer, which is in the section 4.1.
As far as i know, the FLOPs of fully connect layer with bias = 2 * I * O

I=input neuron numbers, O=output neuron numbers.

For the Fully-connect layer 128 ->128, FLOPs = 2 * 128 * 128 = 32,768
And in the Table 1, the answer is 4.2M, which is much higher than i got.
Can you release your method to calculate the answer ?

In BERT, if the input sentence contains 128 words, the FLOPs should be 2 * 128 * 128 * 128 = 4194304.

@dawson-chen
Copy link
Author

Now i got it, thank you.

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

2 participants