August 2019
Intermediate to advanced
242 pages
5h 45m
English
As discussed in the first part of the chapter, we optimize for two different sources of loss.
The first loss we optimize for is the actual difference between the input image and the output image; this is ideal for us if the difference is minimal. To do this, we expose the output layer and then calculate the difference to the input. For this example, we are using the sum of the squared errors between the input and output, nothing fancy. In pseudocode, this looks like the following:
valueLoss = sum(squared(input - output))
In Gorgonia, we can implement it as follows:
m.out = l7valueLoss, err := gorgonia.Sum(gorgonia.Must(gorgonia.Square(gorgonia.Must(gorgonia.Sub(y, m.out)))))if err != nil { log.Fatal(err)}
Our other loss ...
Read now
Unlock full access