In [1]:

    import numpy as np
    from IPython.display import SVG

In [2]:

    %load_ext autoreload
    %autoreload 2

In [3]:

    import theano as th
    import theano.tensor as tht
    import theano.printing as thp
    import theano.d3printing as d3p

    Couldn't import dot_parser, loading of dot files will not be possible.

# Example 1¶

In [4]:

    x, y, z = tht.scalars('xyz')
    e = x + y * z
    o = th.OpFromGraph([x, y, z], [e])
    e2 = o(x, y, z) + o(z, y, y)
    f = th.function([x, y, z], [e2])

In [5]:

    d3p.d3print(f, 'example1/index.html')

Open

In [6]:

    topo = f.maker.fgraph.toposort()

# Example 2¶

In [7]:

    x, y, z = tht.scalars('xyz')
    e = x * y
    o = th.OpFromGraph([x, y], [e])
    e2 = o(x, y) + z
    o2 = th.OpFromGraph([x, y, z], [e2])
    e3 = o2(x, y, z) + z
    f = th.function([x, y, z], [e3])

In [8]:

    d3p.d3print(f, 'example2/index.html')

Open