Research Article
A Lightweight Binarized Convolutional Neural Network Model for Small Memory and Low-Cost Mobile Devices
Algorithm 1
Rules for calculating the gradient of a single layer in CBCNN.
| Input: x, x | | Output: y, y | (1) | Begin | (2) | Case 1: Forward propagation | (3) | if x ≤ 0 | (4) | y = −1, y = 0 | (5) | end if | (6) | else | (7) | y = 1, y = 0 | (8) | end else | (9) | Case 2: Backward propagation | (10) | if x ≤ −1 | (11) | y = −1, y = 0 | (12) | end if | (13) | if −1 < x < 1 | (14) | y = x, y = x | (15) | end if | (16) | else | (17) | y = 1, y = 0 | (18) | end else | (19) | end |
|