Equation (1) from DoReFa Net - XNOR-Bitcount equivalent for bitwise dot product
Hello, I'm hoping you could help me understand Equation (1) from the DoReFa-Net paper. You say that
the following equivalence computes the dot product of two bit vectors x and y: Σixiyi = bitcount(xnor(xi, yi)), xi, yi ∈ {0, 1} ∀ i
If we evaluate with two bit-vectors, a := {1, 1, 0} and b := {0, 1, 0} this equivalence does not seem to hold.
a := 1 1 0 b := 0 1 0 let c := xnor(a, b) == 0 1 1 bitcount(c) = 2 bit-wise dot product of (a, b) == 1 * 0 + 1 * 1 + 0 * 0 = 1 2 != 1
What am I misunderstanding? Thank you.
In the latest version of paper released in July: http://arxiv.org/abs/1606.06160, we have corrected the equation to bitcount(and(xi, yi)).
Hello, in Eq (2), it says that when xi, yi ∈ {-1, 1}, we can use xnor.
Σixiyi = N - 2*bitcount(xnor(xi, yi)), xi, yi ∈ {-1, 1} ∀ i
Should it be xor instead of xnor? For instance, x := -1 -1 -1 and y := 1 1 1, the dot product is -3 and N - 2*bitcount(xnor(x, y)) is 3 - 2*0 = 3. Thus, the equivalence is not hold. Is there any misunderstanding? Thanks!
Yes it should be xor. Sorry for the confusion!