Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e205110f
提交
e205110f
authored
9月 05, 2012
作者:
Ian Goodfellow
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added "node" argument to ops that already had a connection pattern
上级
f08fe14e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
9 行增加
和
2 行删除
+9
-2
basic.py
theano/tensor/basic.py
+6
-1
test_gradient.py
theano/tests/test_gradient.py
+3
-1
没有找到文件。
theano/tensor/basic.py
浏览文件 @
e205110f
...
@@ -2097,7 +2097,7 @@ class Shape(Op):
...
@@ -2097,7 +2097,7 @@ class Shape(Op):
def
infer_shape
(
self
,
node
,
in_shapes
):
def
infer_shape
(
self
,
node
,
in_shapes
):
return
[[
len
(
in_shapes
[
0
])]]
return
[[
len
(
in_shapes
[
0
])]]
def
connection_pattern
(
self
):
def
connection_pattern
(
self
,
node
):
# the grad returns the gradient with respect to the
# the grad returns the gradient with respect to the
# elements of a tensor variable
# elements of a tensor variable
# the elements of the tensor variable do not participate
# the elements of the tensor variable do not participate
...
@@ -2193,6 +2193,9 @@ class SpecifyShape(Op):
...
@@ -2193,6 +2193,9 @@ class SpecifyShape(Op):
assert
len
(
new_shape
)
==
len
(
xshape
)
assert
len
(
new_shape
)
==
len
(
xshape
)
return
[
new_shape
]
return
[
new_shape
]
def
connection_pattern
(
self
,
node
):
return
[[
True
],[
False
]]
def
grad
(
self
,
inp
,
grads
):
def
grad
(
self
,
inp
,
grads
):
x
,
s
=
inp
x
,
s
=
inp
gz
,
=
grads
gz
,
=
grads
...
@@ -3886,6 +3889,7 @@ class Subtensor(Op):
...
@@ -3886,6 +3889,7 @@ class Subtensor(Op):
else
:
else
:
return
scal
.
as_scalar
(
a
)
return
scal
.
as_scalar
(
a
)
def
make_node
(
self
,
x
,
*
inputs
):
def
make_node
(
self
,
x
,
*
inputs
):
x
=
as_tensor_variable
(
x
)
x
=
as_tensor_variable
(
x
)
inputs
=
tuple
(
self
.
my_as_scalar
(
a
)
for
a
in
inputs
)
inputs
=
tuple
(
self
.
my_as_scalar
(
a
)
for
a
in
inputs
)
...
@@ -6461,6 +6465,7 @@ class Dot(Op):
...
@@ -6461,6 +6465,7 @@ class Dot(Op):
raise
raise
def
grad
(
self
,
inp
,
grads
):
def
grad
(
self
,
inp
,
grads
):
x
,
y
=
inp
x
,
y
=
inp
gz
,
=
grads
gz
,
=
grads
if
gz
.
type
.
ndim
==
0
:
if
gz
.
type
.
ndim
==
0
:
...
...
theano/tests/test_gradient.py
浏览文件 @
e205110f
...
@@ -329,7 +329,7 @@ def test_disconnected_nan():
...
@@ -329,7 +329,7 @@ def test_disconnected_nan():
return
theano
.
Apply
(
self
,
inputs
=
[
x
],
return
theano
.
Apply
(
self
,
inputs
=
[
x
],
outputs
=
[
x
.
type
(),
theano
.
tensor
.
scalar
()
])
outputs
=
[
x
.
type
(),
theano
.
tensor
.
scalar
()
])
def
connection_pattern
(
self
):
def
connection_pattern
(
self
,
node
):
return
[[
True
,
False
]]
return
[[
True
,
False
]]
def
grad
(
self
,
inputs
,
output_grads
):
def
grad
(
self
,
inputs
,
output_grads
):
...
@@ -360,5 +360,7 @@ def test_disconnected_nan():
...
@@ -360,5 +360,7 @@ def test_disconnected_nan():
# connection_pattern functionality worked correctly
# connection_pattern functionality worked correctly
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论