Skip to content

Commit 1258c2c

Browse files
committedApr 20, 2024
Set/get command for output gradient via UART.
1 parent ba2c208 commit 1258c2c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
 

‎main.go

+14
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,20 @@ func main() {
227227
}
228228
break
229229

230+
case N2CMU_SET_OUTPUT_GRAD:
231+
for i := 0; i < int(network.OutputCount); i++ {
232+
network.OutputGrad[i] = uart.ReadFloat32()
233+
}
234+
235+
uart.WriteOk()
236+
break
237+
238+
case N2CMU_GET_OUTPUT_GRAD:
239+
for i := 0; i < int(network.OutputCount); i++ {
240+
uart.WriteFloat32(network.OutputGrad[i])
241+
}
242+
break
243+
230244
case N2CMU_SET_EPOCH_COUNT:
231245
epoch = uart.ReadUint16()
232246
break

0 commit comments

Comments
 (0)