Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c2ccdc09
提交
c2ccdc09
authored
5月 30, 2021
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
5月 30, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Perform missing aet.nnet.sigmoid to aet.sigmoid replacements
上级
4265d4fb
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
20 行增加
和
20 行删除
+20
-20
index.ipynb
doc/library/d3viz/index.ipynb
+2
-2
index.rst
doc/library/d3viz/index.rst
+2
-2
scan.rst
doc/library/scan.rst
+8
-8
basic.rst
doc/library/tensor/nnet/basic.rst
+5
-5
models.py
tests/d3viz/models.py
+3
-3
没有找到文件。
doc/library/d3viz/index.ipynb
浏览文件 @
c2ccdc09
...
@@ -100,7 +100,7 @@
...
@@ -100,7 +100,7 @@
"x = aet.dmatrix('x')\n",
"x = aet.dmatrix('x')\n",
"wh = th.shared(rng.normal(0, 1, (nfeatures, nhiddens)), borrow=True)\n",
"wh = th.shared(rng.normal(0, 1, (nfeatures, nhiddens)), borrow=True)\n",
"bh = th.shared(np.zeros(nhiddens), borrow=True)\n",
"bh = th.shared(np.zeros(nhiddens), borrow=True)\n",
"h = aet.
nnet.
sigmoid(aet.dot(x, wh) + bh)\n",
"h = aet.sigmoid(aet.dot(x, wh) + bh)\n",
"\n",
"\n",
"wy = th.shared(rng.normal(0, 1, (nhiddens, noutputs)))\n",
"wy = th.shared(rng.normal(0, 1, (nhiddens, noutputs)))\n",
"by = th.shared(np.zeros(noutputs), borrow=True)\n",
"by = th.shared(np.zeros(noutputs), borrow=True)\n",
...
@@ -390,7 +390,7 @@
...
@@ -390,7 +390,7 @@
"outputs": [],
"outputs": [],
"source": [
"source": [
"x, y, z = aet.scalars('xyz')\n",
"x, y, z = aet.scalars('xyz')\n",
"e = aet.
nnet.
sigmoid((x + y + z)**2)\n",
"e = aet.sigmoid((x + y + z)**2)\n",
"op = th.compile.builders.OpFromGraph([x, y, z], [e])\n",
"op = th.compile.builders.OpFromGraph([x, y, z], [e])\n",
"\n",
"\n",
"e2 = op(x, y, z) + op(z, y, x)\n",
"e2 = op(x, y, z) + op(z, y, x)\n",
...
...
doc/library/d3viz/index.rst
浏览文件 @
c2ccdc09
...
@@ -63,7 +63,7 @@ hidden layer and a softmax output layer.
...
@@ -63,7 +63,7 @@ hidden layer and a softmax output layer.
x = aet.dmatrix('x')
x = aet.dmatrix('x')
wh = th.shared(rng.normal(0, 1, (nfeatures, nhiddens)), borrow=True)
wh = th.shared(rng.normal(0, 1, (nfeatures, nhiddens)), borrow=True)
bh = th.shared(np.zeros(nhiddens), borrow=True)
bh = th.shared(np.zeros(nhiddens), borrow=True)
h = aet.
nnet.
sigmoid(aet.dot(x, wh) + bh)
h = aet.sigmoid(aet.dot(x, wh) + bh)
wy = th.shared(rng.normal(0, 1, (nhiddens, noutputs)))
wy = th.shared(rng.normal(0, 1, (nhiddens, noutputs)))
by = th.shared(np.zeros(noutputs), borrow=True)
by = th.shared(np.zeros(noutputs), borrow=True)
...
@@ -211,7 +211,7 @@ node defines a nested graph, which will be visualized accordingly by ``d3viz``.
...
@@ -211,7 +211,7 @@ node defines a nested graph, which will be visualized accordingly by ``d3viz``.
.. code:: python
.. code:: python
x, y, z = aet.scalars('xyz')
x, y, z = aet.scalars('xyz')
e = aet.
nnet.
sigmoid((x + y + z)**2)
e = aet.sigmoid((x + y + z)**2)
op = th.compile.builders.OpFromGraph([x, y, z], [e])
op = th.compile.builders.OpFromGraph([x, y, z], [e])
e2 = op(x, y, z) + op(z, y, x)
e2 = op(x, y, z) + op(z, y, x)
...
...
doc/library/scan.rst
浏览文件 @
c2ccdc09
...
@@ -276,9 +276,9 @@ the following:
...
@@ -276,9 +276,9 @@ the following:
trng = aesara.tensor.random.utils.RandomStream(1234)
trng = aesara.tensor.random.utils.RandomStream(1234)
def OneStep(vsample) :
def OneStep(vsample) :
hmean = aet.
nnet.
sigmoid(aesara.dot(vsample, W) + bhid)
hmean = aet.sigmoid(aesara.dot(vsample, W) + bhid)
hsample = trng.binomial(size=hmean.shape, n=1, p=hmean)
hsample = trng.binomial(size=hmean.shape, n=1, p=hmean)
vmean = aet.
nnet.
sigmoid(aesara.dot(hsample, W.T) + bvis)
vmean = aet.sigmoid(aesara.dot(hsample, W.T) + bvis)
return trng.binomial(size=vsample.shape, n=1, p=vmean,
return trng.binomial(size=vsample.shape, n=1, p=vmean,
dtype=aesara.config.floatX)
dtype=aesara.config.floatX)
...
@@ -358,9 +358,9 @@ updated:
...
@@ -358,9 +358,9 @@ updated:
# OneStep, with explicit use of the shared variables (W, bvis, bhid)
# OneStep, with explicit use of the shared variables (W, bvis, bhid)
def OneStep(vsample, W, bvis, bhid):
def OneStep(vsample, W, bvis, bhid):
hmean = aet.
nnet.
sigmoid(aesara.dot(vsample, W) + bhid)
hmean = aet.sigmoid(aesara.dot(vsample, W) + bhid)
hsample = trng.binomial(size=hmean.shape, n=1, p=hmean)
hsample = trng.binomial(size=hmean.shape, n=1, p=hmean)
vmean = aet.
nnet.
sigmoid(aesara.dot(hsample, W.T) + bvis)
vmean = aet.sigmoid(aesara.dot(hsample, W.T) + bvis)
return trng.binomial(size=vsample.shape, n=1, p=vmean,
return trng.binomial(size=vsample.shape, n=1, p=vmean,
dtype=aesara.config.floatX)
dtype=aesara.config.floatX)
...
@@ -394,9 +394,9 @@ Using the original Gibbs sampling example, with ``strict=True`` added to the
...
@@ -394,9 +394,9 @@ Using the original Gibbs sampling example, with ``strict=True`` added to the
# Same OneStep as in original example.
# Same OneStep as in original example.
def OneStep(vsample) :
def OneStep(vsample) :
hmean = aet.
nnet.
sigmoid(aesara.dot(vsample, W) + bhid)
hmean = aet.sigmoid(aesara.dot(vsample, W) + bhid)
hsample = trng.binomial(size=hmean.shape, n=1, p=hmean)
hsample = trng.binomial(size=hmean.shape, n=1, p=hmean)
vmean = aet.
nnet.
sigmoid(aesara.dot(hsample, W.T) + bvis)
vmean = aet.sigmoid(aesara.dot(hsample, W.T) + bvis)
return trng.binomial(size=vsample.shape, n=1, p=vmean,
return trng.binomial(size=vsample.shape, n=1, p=vmean,
dtype=aesara.config.floatX)
dtype=aesara.config.floatX)
...
@@ -423,9 +423,9 @@ variables passed explicitly to ``OneStep`` and to scan:
...
@@ -423,9 +423,9 @@ variables passed explicitly to ``OneStep`` and to scan:
# OneStep, with explicit use of the shared variables (W, bvis, bhid)
# OneStep, with explicit use of the shared variables (W, bvis, bhid)
def OneStep(vsample, W, bvis, bhid) :
def OneStep(vsample, W, bvis, bhid) :
hmean = aet.
nnet.
sigmoid(aesara.dot(vsample, W) + bhid)
hmean = aet.sigmoid(aesara.dot(vsample, W) + bhid)
hsample = trng.binomial(size=hmean.shape, n=1, p=hmean)
hsample = trng.binomial(size=hmean.shape, n=1, p=hmean)
vmean = aet.
nnet.
sigmoid(aesara.dot(hsample, W.T) + bvis)
vmean = aet.sigmoid(aesara.dot(hsample, W.T) + bvis)
return trng.binomial(size=vsample.shape, n=1, p=vmean,
return trng.binomial(size=vsample.shape, n=1, p=vmean,
dtype=aesara.config.floatX)
dtype=aesara.config.floatX)
...
...
doc/library/tensor/nnet/basic.rst
浏览文件 @
c2ccdc09
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
x, y, b = aet.dvectors('x', 'y', 'b')
x, y, b = aet.dvectors('x', 'y', 'b')
W = aet.dmatrix('W')
W = aet.dmatrix('W')
y = aet.
nnet.
sigmoid(aet.dot(W, x) + b)
y = aet.sigmoid(aet.dot(W, x) + b)
.. note:: The underlying code will return an exact 0 or 1 if an
.. note:: The underlying code will return an exact 0 or 1 if an
element of x is too small or too big.
element of x is too small or too big.
...
@@ -174,8 +174,8 @@
...
@@ -174,8 +174,8 @@
x, y, b, c = aet.dvectors('x', 'y', 'b', 'c')
x, y, b, c = aet.dvectors('x', 'y', 'b', 'c')
W = aet.dmatrix('W')
W = aet.dmatrix('W')
V = aet.dmatrix('V')
V = aet.dmatrix('V')
h = aet.
nnet.
sigmoid(aet.dot(W, x) + b)
h = aet.sigmoid(aet.dot(W, x) + b)
x_recons = aet.
nnet.
sigmoid(aet.dot(V, h) + c)
x_recons = aet.sigmoid(aet.dot(V, h) + c)
recon_cost = aet.nnet.binary_crossentropy(x_recons, x).mean()
recon_cost = aet.nnet.binary_crossentropy(x_recons, x).mean()
.. function:: sigmoid_binary_crossentropy(output,target)
.. function:: sigmoid_binary_crossentropy(output,target)
...
@@ -203,11 +203,11 @@
...
@@ -203,11 +203,11 @@
x, y, b, c = aet.dvectors('x', 'y', 'b', 'c')
x, y, b, c = aet.dvectors('x', 'y', 'b', 'c')
W = aet.dmatrix('W')
W = aet.dmatrix('W')
V = aet.dmatrix('V')
V = aet.dmatrix('V')
h = aet.
nnet.
sigmoid(aet.dot(W, x) + b)
h = aet.sigmoid(aet.dot(W, x) + b)
x_precons = aet.dot(V, h) + c
x_precons = aet.dot(V, h) + c
# final reconstructions are given by sigmoid(x_precons), but we leave
# final reconstructions are given by sigmoid(x_precons), but we leave
# them unnormalized as sigmoid_binary_crossentropy applies sigmoid
# them unnormalized as sigmoid_binary_crossentropy applies sigmoid
recon_cost = aet.
nnet.
sigmoid_binary_crossentropy(x_precons, x).mean()
recon_cost = aet.sigmoid_binary_crossentropy(x_precons, x).mean()
.. function:: categorical_crossentropy(coding_dist,true_dist)
.. function:: categorical_crossentropy(coding_dist,true_dist)
...
...
tests/d3viz/models.py
浏览文件 @
c2ccdc09
...
@@ -20,7 +20,7 @@ class Mlp:
...
@@ -20,7 +20,7 @@ class Mlp:
x
=
dmatrix
(
"x"
)
x
=
dmatrix
(
"x"
)
wh
=
shared
(
self
.
rng
.
normal
(
0
,
1
,
(
nfeatures
,
nhiddens
)),
borrow
=
True
)
wh
=
shared
(
self
.
rng
.
normal
(
0
,
1
,
(
nfeatures
,
nhiddens
)),
borrow
=
True
)
bh
=
shared
(
np
.
zeros
(
nhiddens
),
borrow
=
True
)
bh
=
shared
(
np
.
zeros
(
nhiddens
),
borrow
=
True
)
h
=
aet
.
nnet
.
sigmoid
(
aet
.
dot
(
x
,
wh
)
+
bh
)
h
=
aet
.
sigmoid
(
aet
.
dot
(
x
,
wh
)
+
bh
)
wy
=
shared
(
self
.
rng
.
normal
(
0
,
1
,
(
nhiddens
,
noutputs
)))
wy
=
shared
(
self
.
rng
.
normal
(
0
,
1
,
(
nhiddens
,
noutputs
)))
by
=
shared
(
np
.
zeros
(
noutputs
),
borrow
=
True
)
by
=
shared
(
np
.
zeros
(
noutputs
),
borrow
=
True
)
...
@@ -46,7 +46,7 @@ class OfgNested:
...
@@ -46,7 +46,7 @@ class OfgNested:
class
Ofg
:
class
Ofg
:
def
__init__
(
self
):
def
__init__
(
self
):
x
,
y
,
z
=
scalars
(
"xyz"
)
x
,
y
,
z
=
scalars
(
"xyz"
)
e
=
aet
.
nnet
.
sigmoid
((
x
+
y
+
z
)
**
2
)
e
=
aet
.
sigmoid
((
x
+
y
+
z
)
**
2
)
op
=
OpFromGraph
([
x
,
y
,
z
],
[
e
])
op
=
OpFromGraph
([
x
,
y
,
z
],
[
e
])
e2
=
op
(
x
,
y
,
z
)
+
op
(
z
,
y
,
x
)
e2
=
op
(
x
,
y
,
z
)
+
op
(
z
,
y
,
x
)
...
@@ -57,7 +57,7 @@ class Ofg:
...
@@ -57,7 +57,7 @@ class Ofg:
class
OfgSimple
:
class
OfgSimple
:
def
__init__
(
self
):
def
__init__
(
self
):
x
,
y
,
z
=
scalars
(
"xyz"
)
x
,
y
,
z
=
scalars
(
"xyz"
)
e
=
aet
.
nnet
.
sigmoid
((
x
+
y
+
z
)
**
2
)
e
=
aet
.
sigmoid
((
x
+
y
+
z
)
**
2
)
op
=
OpFromGraph
([
x
,
y
,
z
],
[
e
])
op
=
OpFromGraph
([
x
,
y
,
z
],
[
e
])
e2
=
op
(
x
,
y
,
z
)
e2
=
op
(
x
,
y
,
z
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论