Skip to content

Commit

Permalink
Fully functional inference command via UART.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Apr 19, 2024
1 parent 83d9ad5 commit 8930749
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ func main() {
uart.WriteOk()
break

case N2CMU_NET_INFER:
input := make([]float32, network.InputCount)
for j := 0; j < int(network.InputCount); j++ {
input[j] = uart.ReadFloat32()
}

output := network.Infer(input)
for i := 0; i < int(network.OutputCount); i++ {
uart.WriteFloat32(output[i])
}

uart.WriteOk()
break

case N2CMU_SET_INPUT_COUNT:
network.InputCount = uart.ReadUint8()
network.InitMatrix()
Expand Down

0 comments on commit 8930749

Please sign in to comment.