Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
65400e78
提交
65400e78
authored
12月 20, 2012
作者:
Jeremiah Lowin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
replace hardcoded T.dot equalities with isinstance checks
上级
67f13b01
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
10 行增加
和
9 行删除
+10
-9
blas.py
theano/tensor/blas.py
+2
-2
opt.py
theano/tensor/opt.py
+2
-1
test_blas.py
theano/tensor/tests/test_blas.py
+6
-6
没有找到文件。
theano/tensor/blas.py
浏览文件 @
65400e78
...
...
@@ -1531,11 +1531,11 @@ class Dot22(GemmRelated):
_dot22
=
Dot22
()
@local_optimizer
([
T
.
dot
])
@local_optimizer
([
T
.
_
dot
])
def
local_dot_to_dot22
(
node
):
# This works for tensor.outer too because basic.outer is a macro that
# produces a dot(dimshuffle,dimshuffle) of form 4 below
if
no
de
.
op
!=
T
.
dot
:
if
no
t
isinstance
(
node
.
op
,
T
.
Dot
)
:
return
x
,
y
=
node
.
inputs
...
...
theano/tensor/opt.py
浏览文件 @
65400e78
...
...
@@ -410,7 +410,8 @@ def local_lift_transpose_through_dot(node):
if
not
(
isinstance
(
node
.
op
,
T
.
DimShuffle
)
and
node
.
op
.
new_order
==
(
1
,
0
)):
return
False
if
not
(
node
.
inputs
[
0
]
.
owner
and
node
.
inputs
[
0
]
.
owner
.
op
==
T
.
dot
):
if
not
(
node
.
inputs
[
0
]
.
owner
and
isinstance
(
node
.
inputs
[
0
]
.
owner
.
op
,
T
.
Dot
)):
return
False
x
,
y
=
node
.
inputs
[
0
]
.
owner
.
inputs
...
...
theano/tensor/tests/test_blas.py
浏览文件 @
65400e78
...
...
@@ -14,7 +14,6 @@ from numpy import (arange, array, common_type, complex64, complex128, float32,
from
numpy.testing
import
assert_array_almost_equal
#from numpy.testing import dec
#from numpy.testing.noseclasses import KnownFailureTest
from
theano.tensor.blas
import
(
_dot22
,
_dot22scalar
,
res_is_a
,
_as_scalar
,
_is_real_matrix
,
_gemm_canonicalize
,
_factor_canonicalized
,
Gemm
,
Gemv
,
...
...
@@ -479,7 +478,7 @@ def just_gemm(i, o, ishapes=[(4, 3), (3, 5), (4, 5), (), ()],
on_unused_input
=
'ignore'
)
nb_gemm
=
0
for
node
in
f
.
maker
.
fgraph
.
apply_nodes
:
if
node
.
op
==
T
.
dot
:
if
isinstance
(
node
.
op
,
T
.
Dot
)
:
raise
Failure
(
'dot not changed to gemm_inplace in graph'
)
if
node
.
op
==
_dot22
:
raise
Failure
(
'_dot22 not changed to gemm_inplace in graph'
)
...
...
@@ -562,7 +561,7 @@ def test_gemm_opt_double_gemm():
f
=
inplace_func
([
Param
(
ii
,
mutable
=
True
)
for
ii
in
i
],
o
,
mode
=
'FAST_RUN'
,
on_unused_input
=
'ignore'
)
for
node
in
f
.
maker
.
fgraph
.
apply_nodes
:
if
node
.
op
==
T
.
dot
:
if
isinstance
(
node
.
op
,
T
.
Dot
)
:
raise
Failure
(
'dot in graph'
)
if
node
.
op
==
_dot22
:
raise
Failure
(
'_dot22 in graph'
)
...
...
@@ -857,7 +856,8 @@ def test_dot22():
if
dtype1
==
dtype2
:
assert
_dot22
in
[
x
.
op
for
x
in
topo
],
(
dtype1
,
dtype2
)
else
:
assert
T
.
dot
in
[
x
.
op
for
x
in
topo
],
(
dtype1
,
dtype2
)
check
=
[
isinstance
(
x
.
op
,
T
.
Dot
)
for
x
in
topo
]
assert
any
(
check
),
(
dtype1
,
dtype2
)
rng
=
numpy
.
random
.
RandomState
(
unittest_tools
.
fetch_seed
())
def
cmp
(
a_shp
,
b_shp
):
...
...
@@ -919,8 +919,8 @@ def test_dot22scalar():
assert
_dot22
in
ops
,
(
dtype1
,
dtype2
,
dtype3
,
dtype4
)
else
:
assert
T
.
dot
in
ops
,
(
dtype1
,
dtype2
,
dtype3
,
dtype4
)
check
=
[
isinstance
(
o
,
T
.
Dot
)
for
o
in
ops
]
assert
any
(
check
),
(
dtype1
,
dtype2
,
dtype3
,
dtype4
)
def
cmp
(
a_shp
,
b_shp
,
c_shp
,
sqr_shp
=
(
5
,
5
)):
av
=
rng
.
uniform
(
size
=
a_shp
)
.
astype
(
dtype1
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论