aboutsummaryrefslogtreecommitdiff
path: root/include/cnn1986.c
diff options
context:
space:
mode:
Diffstat (limited to 'include/cnn1986.c')
-rw-r--r--include/cnn1986.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/include/cnn1986.c b/include/cnn1986.c
index dc0e116..c2ef98d 100644
--- a/include/cnn1986.c
+++ b/include/cnn1986.c
@@ -12,7 +12,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with Takwrap. If not, see <https://www.gnu.org/licenses/>.
+ along with ct. If not, see <https://www.gnu.org/licenses/>.
*/
#include "cnn1986.h"
@@ -33,18 +33,18 @@ float cnn1986_evaluate_black_win(void) {
* Convolution layer *
* ------------------ */
// for each kernel
- for (uint8_t kern = 0; kern < KERN_NUM; kern++) {
+ for (int kern = 0; kern < KERN_NUM; kern++) {
// the stride is 1, march across the board
- for (uint8_t bx = 0; bx < KERN_OSIZE; bx++) {
- for (uint8_t by = 0; by < KERN_OSIZE; by++) {
+ for (int bx = 0; bx < KERN_OSIZE; bx++) {
+ for (int by = 0; by < KERN_OSIZE; by++) {
flattened[kern+KERN_NUM*(bx+by*KERN_OSIZE)] =
conv2d_biases[kern];
// Compute the convolution for this position
- for (uint8_t ky = 0; ky < KERN_SIZE; ky++) {
- for (uint8_t kx = 0; kx < KERN_SIZE; kx++) {
- for (uint8_t c = 0; c < KERN_CHAN; c++) {
+ for (int ky = 0; ky < KERN_SIZE; ky++) {
+ for (int kx = 0; kx < KERN_SIZE; kx++) {
+ for (int c = 0; c < KERN_CHAN; c++) {
// Where we are on the board
- const uint8_t loc = kx+bx+(ky+by)*5;
+ const int loc = kx+bx+(ky+by)*6;
// Look up what's on the board at this location, and
// multiply it. For c=0 we have to do some extra work
float lookup = 0;
@@ -76,9 +76,9 @@ float cnn1986_evaluate_black_win(void) {
/* ------------------ *
* First dense layer *
* ------------------ */
- for (uint8_t d1 = 0; d1 < DENSE1_NUM; d1++) {
+ for (int d1 = 0; d1 < DENSE1_NUM; d1++) {
dense1[d1] = dense1_biases[d1];
- for (uint8_t fl = 0; fl < CONV_NUM+2; fl++) {
+ for (int fl = 0; fl < CONV_NUM+2; fl++) {
dense1[d1] += flattened[fl]*dense1_weights[d1][fl];
}
RELU(dense1[d1]);
@@ -86,9 +86,9 @@ float cnn1986_evaluate_black_win(void) {
/* ------------------- *
* Second dense layer *
* ------------------- */
- for (uint8_t d2 = 0; d2 < DENSE2_NUM; d2++) {
+ for (int d2 = 0; d2 < DENSE2_NUM; d2++) {
dense2[d2] = dense2_biases[d2];
- for (uint8_t d1 = 0; d1 < DENSE1_NUM; d1++) {
+ for (int d1 = 0; d1 < DENSE1_NUM; d1++) {
dense2[d2] += dense1[d1]*dense2_weights[d2][d1];
}
RELU(dense2[d2]);
@@ -97,7 +97,7 @@ float cnn1986_evaluate_black_win(void) {
* Output layer *
* ------------- */
float output = output_bias;
- for (uint8_t d2 = 0; d2 < DENSE2_NUM; d2++) {
+ for (int d2 = 0; d2 < DENSE2_NUM; d2++) {
output += dense2[d2]*output_weights[d2];
}
// 2*(clamped Pade approximant of logistic function) - 1