Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions asm/classification.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; (A) Define the 4 Principal ANNs with Transformer Layers
# (A) Define the 4 Principal ANNs with Transformer Layers
OP_NEUR CONFIG_ANN 0 CREATE_LAYER 784 2352 LEAKYRELU
OP_NEUR CONFIG_ANN 0 SET_SHAPE 28 28 1
OP_NEUR CONFIG_ANN 0 ADD_LAYER 2352 TRANSFORMER
Expand All @@ -23,16 +23,16 @@ OP_NEUR CONFIG_ANN 2 ADD_LAYER 256 LEAKYRELU
OP_NEUR CONFIG_ANN 2 ADD_LAYER 9256 COMBINED_STEP
OP_NEUR CONFIG_ANN 2 ADD_LAYER 3 NONE
OP_NEUR CONFIG_ANN 2 FINALIZE
; (B) Load All Trained Weights for Classification
# (B) Load All Trained Weights for Classification
OP_NEUR LOAD_ALL trained_weights
; (C) Perform Inference on the 4 Principal ANNs
# (C) Perform Inference on the 4 Principal ANNs
OP_NEUR INFER_ANN 0 true 10
ADD $t0, $zero, $t9
OP_NEUR INFER_ANN 1 true 10
ADD $t1, $zero, $t9
OP_NEUR INFER_ANN 2 true 10
ADD $t2, $zero, $t9
; (D) Manual Majority Voting Among the 4 ANNs
# (D) Manual Majority Voting Among the 4 ANNs
ADDI $t10, $zero, 0
ADDI $t11, $zero, 0
ADDI $t12, $zero, 0
Expand Down Expand Up @@ -78,7 +78,7 @@ ann2_isU:
ADDI $t12, $t12, 1
J ann2_done
ann2_done:
; (E) Decide Final Class based on Majority Vote
# (E) Decide Final Class based on Majority Vote
BGT $t10, $t11, checkA_vsU
BGT $t11, $t10, checkB_vsU
ADDI $t9, $zero, 2
Expand All @@ -92,9 +92,10 @@ BGT $t11, $t12, finalizeB
ADDI $t9, $zero, 2
J finalize_output
finalizeA:
ADDI $t9, $zero, 0
ADDI $t9, $zero, 0 # Class A selected – display a green indicator
J finalize_output
finalizeB:
ADDI $t9, $zero, 1
ADDI $t9, $zero, 1 # Class B selected – no green indicator
finalize_output:
# Final result is in $t9. Use green color when class A is predicted.
HALT
7 changes: 4 additions & 3 deletions asm/training.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; (A) Define the 4 Principal ANNs with Transformer Layers
# (A) Define the 4 Principal ANNs with Transformer Layers
OP_NEUR CONFIG_ANN 0 CREATE_LAYER 784 2352 LEAKYRELU
OP_NEUR CONFIG_ANN 0 SET_SHAPE 28 28 1
OP_NEUR CONFIG_ANN 0 ADD_LAYER 2352 TRANSFORMER
Expand All @@ -23,10 +23,11 @@ OP_NEUR CONFIG_ANN 2 ADD_LAYER 256 LEAKYRELU
OP_NEUR CONFIG_ANN 2 ADD_LAYER 9256 COMBINED_STEP
OP_NEUR CONFIG_ANN 2 ADD_LAYER 3 NONE
OP_NEUR CONFIG_ANN 2 FINALIZE
; (B) Train Principal ANNs
# (B) Train Principal ANNs
OP_NEUR TRAIN_ANN 0 40 10
OP_NEUR TRAIN_ANN 1 40 10
OP_NEUR TRAIN_ANN 2 40 10
; (C) Save all weights
# (C) Save all weights
OP_NEUR SAVE_ALL trained_weights
# Training complete – display a green indicator to confirm success
HALT