We won't cover the code for testing in extensive detail as we've already covered how to get our images out of our output, but note that y is now also 784 columns wide:
arrayOutput := m.predVal.Data().([]float64)
yOutput := tensor.New(tensor.WithShape(bs, 784), tensor.WithBacking(arrayOutput))
for j := 0; j < yOutput.Shape()[0]; j++ {
rowT, _ := yOutput.Slice(sli{j, j + 1})
row := rowT.Data().([]float64)
img := visualizeRow(row)
f, _ := os.OpenFile(fmt.Sprintf("images/%d - %d output.jpg", b, j), os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
jpeg.Encode(f, img, &jpeg.Options{jpeg.DefaultQuality})
f.Close()
}
Now, here's the fun part; getting results out of our autoencoder:
You'll notice that the results are noticeably less well defined than the input images. However, it also removes some of the noise in the images!