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

the converted weights #3

Open
KangolHsu opened this issue Nov 15, 2017 · 3 comments
Open

the converted weights #3

KangolHsu opened this issue Nov 15, 2017 · 3 comments

Comments

@KangolHsu
Copy link

I use your scrip convert my float model to power of 2
but i get weights like this
conv1_weight:

0.068853, -0.041312, -0.020656, -0.096395, -0.123936, 0.068853, 0.061968, 0.068853, 0.013771, 0.048197, -0.113608, 0.048197, 0.068853, 0.058525, -0.051640, 0.041312, 0.034427, 0.041312, -0.068853, -0.055083, 0.068853, 0.034427, -0.013771, 0.068853, 0.068853, -0.103280, -0.041312, -0.082624, 0.024099, 0.020656, -0.068853, 0.006885, 0.082624, 0.010328, -0.027541, -0.068853, -0.034427, -0.103280, 0.027541, -0.082624, -0.030984, 0.041312, 0.013771, 0.068853, -0.061968, -0.082624, 0.110165, -0.006885, 0.068853, 0.103280, 0.055083, -0.096395, 0.068853, 0.061968, 0.013771, 0.117050, 0.096395, -0.061968, -0.103280, 0.020656, -0.013771, -0.103280, 0.034427, -0.003443, 0.082624, 0.096395, 0.006885, -0.082624, 0.082624, -0.048197, -0.096395, -0.068853, -0.017213, 0.034427, 0.137706, 0.020656, 0.041312, 0.034427, 0.137706, 0.048197, -0.082624, 0.034427, -0.082624, -0.137706, 0.082624, 0.137706, 0.165248, -0.103280, -0.061968, -0.096395, -0.020656, 0.223773, 0.165248, 0.068853, 0.013771, 0.020656, 0.113608, 0.000000, -0.034427, -0.096395, 0.000000, -0.068853, 0.061968, 0.110165, 0.055083, -0.082624, -0.137706, -0.275413, -0.275413, 0.048197, -0.048197, 0.165248, -0.165248, -0.234101, 0.030984, 0.192789, 0.234101, 0.017213, 0.006885, -0.068853, -0.123936, -0.013771, 0.165248, 0.027541, 0.137706, 0.082624, -0.096395, -0.113608, 0.030984, 0.034427, 0.000000, 0.082624, -0.123936, -0.165248, -0.051640, 0.082624, 0.165248, -0.123936, -0.234101, -0.103280, 0.103280, 0.247872, 0.103280, 0.058525, -0.055083, -0.137706, 0.082624, -0.068853, 0.000000, 0.006885, 0.000000, -0.137706, -0.006885, -0.082624, 0.000000, 0.013771, -0.017213, -0.068853, -0.055083, 0.000000, -0.027541, 0.020656, 0.082624, -0.068853, 0.068853, 0.017213, 0.103280, 0.103280, -0.082624, -0.051640, -0.082624, 0.123936, 0.048197, 0.041312, 0.096395, 0.041312, -0.165248, -0.055083,

some of them are the same,but it was not power of 2
i use my own caffe version。what wrong with me?
thanks

@KangolHsu
Copy link
Author

maybe the value saved is ‘wT*wMax’
the value of wT is combination of power of 2
wMax is the max value in weights。
am i right?

@gudovskiy
Copy link
Owner

@KangolHsu yes, I presume that the weights are normalized using some constant that is wMax to increase bit-width efficiency. It is possible to make it power of two as well at the expense of potentially 1 bit increase in bit-width.

@KangolHsu
Copy link
Author

KangolHsu commented Nov 16, 2017

I set
N = 1
B = 8
but the result of wT is in the range of 2^-2 to 2^-15
i am confused.why that happen?
one more question,how to save the index of each codebook entry?and could you give me some clues?

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