August 2019
Intermediate to advanced
242 pages
5h 45m
English
Alternatively, you may also want to inspect the predictions coming out, in order to get a better understanding of what's happening in your model. In that case, you may wish to extract your results into a .csv file, which you can do with the following code:
arrayOutput := m.predVal.Data().([]float64)yOutput := tensor.New(tensor.WithShape(bs, 10), tensor.WithBacking(arrayOutput))file, err := os.OpenFile(fmt.Sprintf("%d.csv", b), os.O_CREATE|os.O_WRONLY, 0777)if err = xVal.(*tensor.Dense).Reshape(bs, 784); err != nil { log.Fatal("Unable to create csv", err)}defer file.Close()var matrixToWrite [][]stringfor j := 0; j < yOutput.Shape()[0]; j++ { rowT, _ := yOutput.Slice(sli{j, j + 1}) row := rowT.Data().([]float64) var rowToWrite ...Read now
Unlock full access