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

@@ -4,13 +4,13 @@
In [1]:
```
```py
import theano
from theano import tensor as T
```
```
```py
Using gpu device 1: Tesla C2075 (CNMeM is disabled)
```
@@ -19,7 +19,7 @@ Using gpu device 1: Tesla C2075 (CNMeM is disabled)
In [2]:
```
```py
# 两个整形三维张量
a, b = T.itensor3("a"), T.itensor3("b")
@@ -30,7 +30,7 @@ a, b = T.itensor3("a"), T.itensor3("b")
In [3]:
```
```py
print theano.pp(a + 3) # T.add(a, 3) -> itensor3
print theano.pp(3 - a) # T.sub(3, a)
print theano.pp(a * 3.5) # T.mul(a, 3.5) -> ftensor3 or dtensor3 (depending on casting)
@@ -41,7 +41,7 @@ print theano.pp(b % a) # T.mod(b, a)
```
```
```py
(a + TensorConstant{3})
(TensorConstant{3} - a)
(a * TensorConstant{3.5})
@@ -56,7 +56,7 @@ mod(b, a)
In [4]:
```
```py
print theano.pp(a & b) # T.and_(a,b) bitwise and (alias T.bitwise_and)
print theano.pp(a ^ 1) # T.xor(a,1) bitwise xor (alias T.bitwise_xor)
print theano.pp(a | b) # T.or_(a,b) bitwise or (alias T.bitwise_or)
@@ -64,7 +64,7 @@ print theano.pp(~a) # T.invert(a) bitwise invert (alias T.bitwise_not
```
```
```py
and_(a, b)
xor(a, TensorConstant{1})
or_(a, b)
@@ -84,7 +84,7 @@ invert(a)
In [5]:
```
```py
x = T.matrix()
x_as_int = T.cast(x, 'int32')
@@ -94,13 +94,13 @@ x_as_int = T.cast(x, 'int32')
In [6]:
```
```py
print x_as_int is x
print T.cast(x, theano.config.floatX) is x
```
```
```py
False
True
@@ -128,14 +128,14 @@ True
In [7]:
```
```py
x, y = T.dmatrices('x','y')
print theano.pp(T.le(x, y))
```
```
```py
le(x, y)
```
@@ -159,7 +159,7 @@ le(x, y)
In [8]:
```
```py
a, b = T.matrices("a", "b")
print theano.pp(T.maximum(a, b)) # max(a, b)
@@ -192,7 +192,7 @@ print theano.pp(T.psi(a)) # digamma(a)
```
```
```py
maximum(a, b)
minimum(a, b)
(-a)
@@ -240,7 +240,7 @@ $$ \operatorname{erf}(x) = \frac{2}{\sqrt\pi} \int_0^x e^{-t^2} dt $$$$ \begin{a
In [9]:
```
```py
import numpy as np
a = np.random.random((2,3,4))
@@ -272,7 +272,7 @@ print c.shape
```
```
```py
(2, 3, 4) (5, 6, 4, 3)
(2, 5, 6)