Giter Club home page Giter Club logo

Comments (3)

zhuangh avatar zhuangh commented on May 13, 2024

@Duchstf

Maybe I have not fully understand the question. Regarding "operations" between layers, you can put

and make the tensors to be quantized.

Let me know if I answered the wrong question.

Thanks!

from qkeras.

Duchstf avatar Duchstf commented on May 13, 2024

Hi,

what I meant is that, for example, you have two quantized parameters: x and y. However, when you multiply them together x*y the result will still be a float32 and not be quantized anymore.

Would it happen here? and what should I do to prevent it from happening?

Duc.

from qkeras.

zhuangh avatar zhuangh commented on May 13, 2024

Let's assume the mac (multiplication-and-addition) has enough bits to hold x*y (mult=x*y, mac += mult). Then, use that datatype to implement mac in hardware.

FYI, we have been working on tool inside qkeras to derive mac datatype automatically. For example, when x is quantized_bits(bits=4, integer=1, keep_negative=0), y is quantized_bits(bits=2, integer=1, keep_negative=0), mult could be quantized_bits(bits=6, integer=2, keep_negative=0), and set mac type correspondingly. There are different types of quantizers and operations, so we need to map them accordingly. This will make hardware datatype setup easy. So stay tune.

To simulate the numerical behavior, I suggest you apply QActivation layer or SomeLayer(..., activation=quantizer) to ensure the model accuracy.

Hope it makes sense. Feel free to keep discussions in this thread!

from qkeras.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.