2011

Dependencies:   mbed FastPWM

Revision:
178:1074553d2f6f
Parent:
177:8e9cf31d63f4
Child:
179:d5377766d7ea
diff -r 8e9cf31d63f4 -r 1074553d2f6f main.cpp
--- a/main.cpp	Tue Nov 24 13:04:54 2020 +0000
+++ b/main.cpp	Wed Nov 25 06:19:12 2020 +0000
@@ -1,4 +1,4 @@
-//201124_5
+//201125_1
 #include "mbed.h"
 #include "FastPWM.h"
 #include "INIT_HW.h"
@@ -394,9 +394,9 @@
 
     for (int index2 = 0; index2 < num_hidden_unit1; index2++) {
         for (int index1 = 0; index1 < num_input_RL; index1++) {
-            output1[index2] = output1[index2] + ha1[index1][index2] * arr[index1];
+            output1[index2] = output1[index2] + ha1_temp[index1][index2] * arr[index1];
         }
-        output1[index2] = output1[index2] + ba1[index2];
+        output1[index2] = output1[index2] + ba1_temp[index2];
         hx_a_sum[index2] = output1[index2];
         if (output1[index2] < 0) {
             output1[index2] = 0;
@@ -404,9 +404,9 @@
     }
     for (int index2 = 0; index2 < num_hidden_unit2; index2++) {
         for (int index1 = 0; index1 < num_hidden_unit1; index1++) {
-            output2[index2] = output2[index2] + ha2[index1][index2] * output1[index1];
+            output2[index2] = output2[index2] + ha2_temp[index1][index2] * output1[index1];
         }
-        output2[index2] = output2[index2] + ba2[index2];
+        output2[index2] = output2[index2] + ba2_temp[index2];
         hxh_a_sum[index2] = output2[index2];
         if (output2[index2] < 0) {
             output2[index2] = 0;
@@ -414,14 +414,13 @@
     }
     for (int index2 = 0; index2 < 2; index2++) {
         for (int index1 = 0; index1 < num_hidden_unit2; index1++) {
-            output[index2] = output[index2] + ha3[index1][index2] * output2[index1];
+            output[index2] = output[index2] + ha3_temp[index1][index2] * output2[index1];
         }
+        hxhh_a_sum[index2] = output[index2] + ba3_temp[index2];
     }
-    hxhh_a_sum[0] = output[0] + ba3[0];
-    hxhh_a_sum[1] = output[1] + ba3[1];
-
-    mean_before_SP = output[0] + ba3[0];    //SP = softplus
-    deviation_before_SP = output[1] + ba3[1];
+
+    mean_before_SP = output[0] + ba3_temp[0];    //SP = softplus
+    deviation_before_SP = output[1] + ba3_temp[1];
     //Softplus
     mean = log(1.0f+exp(mean_before_SP));
     deviation = log(1.0f+exp(deviation_before_SP));
@@ -2589,8 +2588,7 @@
                         Update_Case = 1;
                         Update_Done_Flag = 0;
                         logging1 = virt_pos;
-                        //virt_pos = 10.0f;
-
+                        
                         if(batch >= num_batch) {
                             batch = 0;
                             RL_timer = 0;