2020-10-19 21:08:55

This commit is contained in:
wizardforcel
2020-10-19 21:08:55 +08:00
parent 7f63048035
commit ab0caba1f0
140 changed files with 3982 additions and 3982 deletions

View File

@@ -12,7 +12,7 @@
In [1]:
```
```py
import theano
import theano.tensor as T
@@ -22,7 +22,7 @@ z = x + y
```
```
```py
Using gpu device 0: GeForce GTX 850M
```
@@ -42,24 +42,24 @@ Using gpu device 0: GeForce GTX 850M
安装完之后,找到 `pydot.py` 将其中:
```
```py
graph.append( '%s %s {\n' % (self.obj_dict['type'], self.obj_dict['name']) )
```
修改为:
```
```py
graph.append( '%s %s {\n' % (self.obj_dict['type'], quote_if_necessary(self.obj_dict['name'])) )
```
In [2]:
```
```py
theano.printing.pydotprint(z, outfile='apply1.png', var_with_name_simple=True)
```
```
```py
The output file is available at apply1.png
```
@@ -72,14 +72,14 @@ The output file is available at apply1.png
In [3]:
```
```py
z.owner.op.name
```
Out[3]:
```
```py
'Elemwise{add,no_inplace}'
```
@@ -87,13 +87,13 @@ Out[3]:
In [4]:
```
```py
print z.owner.nin
print z.owner.nout
```
```
```py
2
1
@@ -103,14 +103,14 @@ print z.owner.nout
In [5]:
```
```py
z.owner.inputs
```
Out[5]:
```
```py
[x, y]
```
@@ -118,12 +118,12 @@ Out[5]:
In [6]:
```
```py
print theano.printing.pprint(z)
```
```
```py
(x + y)
```
@@ -132,12 +132,12 @@ print theano.printing.pprint(z)
In [7]:
```
```py
theano.printing.debugprint(z)
```
```
```py
Elemwise{add,no_inplace} [@A] ''
|x [@B]
|y [@C]
@@ -148,7 +148,7 @@ Elemwise{add,no_inplace} [@A] ''
In [8]:
```
```py
y = x * 2
```
@@ -157,12 +157,12 @@ y = x * 2
In [9]:
```
```py
theano.printing.debugprint(y)
```
```
```py
Elemwise{mul,no_inplace} [@A] ''
|x [@B]
|DimShuffle{x,x} [@C] ''
@@ -174,14 +174,14 @@ Elemwise{mul,no_inplace} [@A] ''
In [10]:
```
```py
y.owner.inputs[1].owner.op
```
Out[10]:
```
```py
<theano.tensor.elemwise.DimShuffle at 0x1b816390>
```
@@ -189,25 +189,25 @@ Out[10]:
In [11]:
```
```py
y.owner.inputs[1].owner.inputs
```
Out[11]:
```
```py
[TensorConstant{2}]
```
In [12]:
```
```py
theano.printing.pydotprint(y, outfile='apply2.png', var_with_name_simple=True)
```
```
```py
The output file is available at apply2.png
```
@@ -218,7 +218,7 @@ The output file is available at apply2.png
In [13]:
```
```py
a = T.dscalar('a')
b = a + a ** 10
@@ -228,13 +228,13 @@ f = theano.function([a], b)
In [14]:
```
```py
theano.printing.pydotprint(b, outfile='apply_no_opti.png', var_with_name_simple=True)
theano.printing.pydotprint(f, outfile='apply_opti.png', var_with_name_simple=True)
```
```
```py
The output file is available at apply_no_opti.png
The output file is available at apply_opti.png