Visualizing the graph

In many cases, it is also very useful to visualize the graph; you can easily do this by adding io or ioutil to your imports and the following line to your code:

ioutil.WriteFile("simple_graph.dot", []byte(g.ToDot()), 0644)

This will produce a DOT file; you can open this in GraphViz, or, more conveniently, convert it to an SVG. You can view it in most modern browsers by installing GraphViz and entering the following in the command line:

dot -Tsvg simple_graph.dot -O

This will produce simple_graph.dot.svg; you can open this in your browser to see a rendering of the graph, as follows:

You can see, in our graph, that we have two inputs, W and x, and this then gets fed into our operator, being a matrix multiplication with a vector giving us the result as well—another vector.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.28.108