Comments (4)
I apologizie for my late response. It is my pleasure that you find the work interesting!
Please give me till the weekend to respond to you.
from deepshift.
I am copying and pasting below the function that implements round_to_fixed
.
The point is that the upper and lower limits of the result of the function are not [-1, +1]. In fact they are approximately [-2^15, 2^15].
Fixed point representation is similar to the decimal value system we were studying at elementary school: we have whole number bits and fraction bits. Since we are using 32-bit representation, I have a llocated here by default 16 (out of the 32-bits) for the whole number and the remaining 16-bits for the fraction.
I think this article may help to explain Fixed Point format: https://www.electronicdesign.com/technologies/embedded-revolution/article/21805517/whats-the-difference-between-fixedpoint-floatingpoint-and-numerical-formats
Please don't hesitate to tell me if this is not clear.
def round_to_fixed(input, fraction=16, integer=16):
assert integer >= 1, integer
if integer == 1:
return torch.sign(input) - 1
delta = math.pow(2.0, -(fraction))
bound = math.pow(2.0, integer-1)
min_val = - bound
max_val = bound - 1
rounded = torch.floor(input / delta) * delta
clipped_value = torch.clamp(rounded, min_val, max_val)
return clipped_value
from deepshift.
Thanks for your kind explanation. So the input parameters to this function, i.e., fraction and integer, denote the number of bits allocated for fraction and integer part respectively, and therefore leads to a 32bit fixed-point representation. Now I understand how this function worked.
Thanks again for your reply.
from deepshift.
@msxiaojin : you are correct. I see that the names of the arguments, fraction
and integer
, are misleading.
I will change them to fraction_bits
and integer_bits
to avoid confusion.
from deepshift.
Related Issues (18)
- shift_kernel & shift_cuda_kernel compiled but can not import HOT 8
- Wonder the performance under the CPU with mixed assembly HOT 1
- We used shift type of PS to train resnet-18 from source but it did not converge. HOT 5
- Round to Fixed to Deal with Unsigned Tensors
- Avoid having to provide `--shift-depth 1000`
- Loading Weights from `weights.pth` Not Working
- About trained model HOT 10
- Does this code only implement the forward propagation shift operation? HOT 7
- CPU kernel acceleration HOT 19
- Error When Shifting Twice HOT 7
- The Number of Shifted Bits HOT 3
- round_to_fixed unsigned tensors HOT 5
- test mAP HOT 4
- Why is the precision of deepshift higher than that of multiplication in some experiments? HOT 2
- A bug in shift.cu caused me to fail to compile deepshift-gpu HOT 1
- Advantages compared to int8 HOT 3
- does wx+b or wx not need to be quantified? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepshift.