cpldcpu / bitnetmcu Goto Github PK
View Code? Open in Web Editor NEWNeural Networks with low bit weights on low end 32 bit microcontrollers such as the CH32V003 RISC-V Microcontroller and others
License: GNU General Public License v3.0
Neural Networks with low bit weights on low end 32 bit microcontrollers such as the CH32V003 RISC-V Microcontroller and others
License: GNU General Public License v3.0
for (uint32_t j = 0; j < 8; j++) {
int32_t in=*activations_idx++;
int32_t tmpsum = (weightChunk & 0x80000000) ? -in : in;
sum += tmpsum; // sign*in*1
if (weightChunk & 0x40000000) sum += tmpsum<<3; // sign*in*8
if (weightChunk & 0x20000000) sum += tmpsum<<2; // sign*in*4
if (weightChunk & 0x10000000) sum += tmpsum<<1; // sign*in*2
weightChunk <<= 4;
}
I'm having some concerns about the line of code 'sum += tmpsum;'.
Is it redundant, perhaps?
If the weight element is in SDDD format, then the sum of three shifts should be sufficient. Here's the relevant code section:
int32_t tmpsum = (weightChunk & 0x80000000) ? -in : in;
if (weightChunk & 0x10000000) sum += tmpsum; // sign*in*1
if (weightChunk & 0x20000000) sum += tmpsum<<1; // sign*in*2
if (weightChunk & 0x40000000) sum += tmpsum<<2; // sign*in*3
weightChunk <<= 4;
upd: It appears that I overlooked the fact that the value 0 is not used...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.