matrix product between real-valued synaptic weight matrix $W^{[k]}$ and the real-valued activations of the previous layer of neurons $a^{[k-1]}$:

$$a^{[k]}_i = f \left( \sum_{j}{W^{[k]}_{ij} \cdot a^{[k-1]}_j} \right).    
\label{eq:activation}$$

[In a BNN, excluding the first layer,]{} neuron activation values as well as synaptic weights assume binary values, meaning $+1$ and $-1$. The products between weights and neuron activation values in Eq. (\[eq:activation\]) then simply become [ logic XNOR operation.]{} The sum in Eq. (\[eq:activation\]) is replaced by the $\operatorname*{popcount}$ operation, the basic function that counts the number of ones in a data vector. The resulting value is then converted to a binary value by comparing it to a trained threshold value $\mu^{[k]}_i$. Eq. (\[eq:activation\]) therefore becomes:

$$a^{[k]}_i = \operatorname{sign}\left( \operatorname*{popcount}_j \left( \operatorname{XNOR}\left( W^{[k]}_{ij}, a^{[k-1]}_j \right) \right) -  \mu^{[k]}_i  \right),    
\label{eq:activation_binarized}$$

where $\operatorname{sign}$ is the sign function.

Ordinarily, in binarized neural network, the first layer input $X$ is not binarized. The implementation of operations for computing the first layer activations $a^{[1]}$ is therefore more complex than the basic $\operatorname{XNOR}$ and $\operatorname*{popcount}$ operations:

$$a^{[1]}_i = \operatorname{sign}\left( \sum_{j}{W^{[1]}_{ij} \cdot X_j}  - \mu^{[1]}_i  \right).    
\label{eq:activation_layer1}$$

Additionally, the thresholding operation is not performed on the last layer of the neural network. Instead, for the last layer, 