Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4ed23539
提交
4ed23539
authored
9月 06, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code cleanup.
上级
a7d2157d
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
3 行增加
和
14 行删除
+3
-14
blas.py
theano/tensor/blas.py
+3
-14
没有找到文件。
theano/tensor/blas.py
浏览文件 @
4ed23539
...
@@ -1906,8 +1906,9 @@ def local_dot22_to_dot22scalar(node):
...
@@ -1906,8 +1906,9 @@ def local_dot22_to_dot22scalar(node):
d
=
node
.
inputs
[
dot22_idx
]
d
=
node
.
inputs
[
dot22_idx
]
i_scalar
=
[
_as_scalar
(
x
,
dtype
=
d
.
dtype
)
for
x
in
node
.
inputs
]
i_scalar
=
[
_as_scalar
(
x
,
dtype
=
d
.
dtype
)
for
x
in
node
.
inputs
]
if
not
any
(
i_scalar
):
if
not
any
(
i_scalar
):
# Check witch input of node is a mul with scalar inputs.
# Check if we can reorder the graph as this mul have a mul in inputs.
# We could reuse this scalar value.
# We support only 1 additional level of mul.
# The canonizer should have merged those mul together.
i_mul
=
[
x
.
owner
and
x
.
owner
.
op
==
T
.
mul
and
i_mul
=
[
x
.
owner
and
x
.
owner
.
op
==
T
.
mul
and
any
([
_as_scalar
(
x_i
,
dtype
=
d
.
dtype
)
any
([
_as_scalar
(
x_i
,
dtype
=
d
.
dtype
)
for
x_i
in
x
.
owner
.
inputs
])
for
x_i
in
x
.
owner
.
inputs
])
...
@@ -1918,14 +1919,9 @@ def local_dot22_to_dot22scalar(node):
...
@@ -1918,14 +1919,9 @@ def local_dot22_to_dot22scalar(node):
#by the associativity of the graph.
#by the associativity of the graph.
return
False
return
False
#maybe we can reorder the graph as this mul have a mul in input.
#The canonizer should have merged those mul together.
#We support only 1 additional level of mul.
mul_idx
=
i_mul
.
index
(
True
)
# The first one should always work
mul_idx
=
i_mul
.
index
(
True
)
# The first one should always work
m
=
node
.
inputs
[
mul_idx
]
m
=
node
.
inputs
[
mul_idx
]
if
any
([
_as_scalar
(
x
,
dtype
=
d
.
dtype
)
for
x
in
m
.
owner
.
inputs
]):
# This should be always True
scalar_idx
=
-
1
scalar_idx
=
-
1
for
i
,
x
in
enumerate
(
m
.
owner
.
inputs
):
for
i
,
x
in
enumerate
(
m
.
owner
.
inputs
):
if
_as_scalar
(
x
,
dtype
=
d
.
dtype
)
and
(
theano
.
scalar
.
upcast
(
if
_as_scalar
(
x
,
dtype
=
d
.
dtype
)
and
(
theano
.
scalar
.
upcast
(
...
@@ -1957,13 +1953,6 @@ def local_dot22_to_dot22scalar(node):
...
@@ -1957,13 +1953,6 @@ def local_dot22_to_dot22scalar(node):
if
i
!=
scalar_idx
]
if
i
!=
scalar_idx
]
return
[
T
.
mul
(
dot
,
*
(
other_factors
+
other_m_inputs
))]
return
[
T
.
mul
(
dot
,
*
(
other_factors
+
other_m_inputs
))]
elif
m
.
owner
and
m
.
owner
.
op
==
T
.
mul
:
_logger
.
info
(
'Not optimizing dot22 with inputs
%
s
%
s
%
s
%
s. '
'we need to check in a recursive way in the mul if we can '
'reorder the graph. The canonizer should have done this.'
,
d
,
m
,
d
.
type
,
m
.
type
)
else
:
return
False
scalar_idx
=
-
1
scalar_idx
=
-
1
for
i
,
x
in
enumerate
(
node
.
inputs
):
for
i
,
x
in
enumerate
(
node
.
inputs
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论