August 2019
Intermediate to advanced
242 pages
5h 45m
English
Of course, we've mostly covered how to build simple equations; however, what happens if your equation is a little bit more complicated, for example, like the following:
z = Wx + b
We can also very easily do this by changing our code a bit to add the following line:
b := G.NewScalar(g, tensor.Float64, G.WithName("b"), G.WithValue(3.0))
Then, we can change our definition for z slightly, as shown here:
a, err := G.Mul(mat, vec)if err != nil { log.Fatal(err)}z, err := G.Add(a, b)if err != nil { log.Fatal(err)}
As you can see, we've created a multiplication operator node, and then created an addition operator node on top of that.
Alternatively, you can also just do it in a single line, as follows:
z, err := G.Add(G.Must(G.Mul(mat, ...Read now
Unlock full access