Problem
The code can't compile in my environment
- Hardware: Macbook Air (M1, 2020)
- OS: macOS 12.6.2
Reason
Probably because macOS doesn't use glibc, and there seemed to be no way to install it in macOS, so #include <ieee754.h> will fail.
Possible Solution
Replace the rand01 function in mnist_util.h with this
double rand01() {
/* Compute next state. */
next();
/* Construct a positive double with the 48 random bits distributed over
its fractional part so the resulting FP number is [0.0,1.0). */
uint64_t mantissa = x << 4;
double temp = 0.0;
for(int i = 1; i <= 52; i++){
if((mantissa >> (52 - i)) & 1){
temp += pow(2, -i);
}
}
/* Please note the lower 4 bits of mantissa1 are always 0. */
return temp;
}
and remove the line
Hopefully, this solves the problem.
I tested it with the command ./exe/mnist_cpu_base --train-data-size 1 --test-data-size 0, and the result numbers are the same as in the demo.
Problem
The code can't compile in my environment
Reason
Probably because macOS doesn't use glibc, and there seemed to be no way to install it in macOS, so
#include <ieee754.h>will fail.Possible Solution
Replace the rand01 function in
mnist_util.hwith thisand remove the line
Hopefully, this solves the problem.
I tested it with the command
./exe/mnist_cpu_base --train-data-size 1 --test-data-size 0, and the result numbers are the same as in the demo.