Git Product home page Git Product logo

Comments (7)

mrazekv avatar mrazekv commented on July 4, 2024

Hi,
it is very easy in C. But you can also try to do it in different tool (the accurate 8-bit multiplier output should be exactly same as tf2/examples/axmul_8x8/mul8u_1JFF.bin

FILE * f = fopen("output.bin", "wb");

for(unsigned int a = 0; a < 256; a++)
    for(unsigned int b = 0; b < 256; b++) {
      uint16_t val = approximate_mult(a, b); // replace by your own function call
      fwrite(&val, sizeof(uint16_t), 1, f);
    }

fclose(f);

from tf-approximate.

mrazekv avatar mrazekv commented on July 4, 2024

I have included this example to the README file.

from tf-approximate.

pilipovicr avatar pilipovicr commented on July 4, 2024

Greetings,

Can we employ approximate multipliers with different bit-widths?

from tf-approximate.

mrazekv avatar mrazekv commented on July 4, 2024

The inputs of convolutional layers are quantized for 8 bits. If you want to simulate lower bit widths, you can simulate it as:

int approximate_mult(int a, int b) {
   return (a & 0xFE) * (b & 0xFE); // for 7-bits
}

from tf-approximate.

pilipovicr avatar pilipovicr commented on July 4, 2024

Is it possible to quantize weights using higher bit-widths. In the code, I saw that you can adjust the the quantization parameter.

from tf-approximate.

FilipVaverka avatar FilipVaverka commented on July 4, 2024

We have tried to keep the interface somewhat open to that possibility. However at the moment this is not supported as multiplication lookup tables would get too large very quickly and wouldn't fit into fast caches of the GPU.

from tf-approximate.

pilipovicr avatar pilipovicr commented on July 4, 2024

Thanks for response and thank you for publishing the code.

from tf-approximate.

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.