Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4b81dbd1
提交
4b81dbd1
authored
5月 11, 2015
作者:
Melanie Ducoffe
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
done with the current change
上级
27de245b
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
22 行增加
和
12 行删除
+22
-12
opt.py
theano/sandbox/cuda/opt.py
+1
-2
test_basic_ops.py
theano/sandbox/cuda/tests/test_basic_ops.py
+11
-0
test_opt.py
theano/sandbox/cuda/tests/test_opt.py
+1
-0
basic.py
theano/tensor/basic.py
+1
-2
blas.py
theano/tensor/blas.py
+1
-1
test_blas.py
theano/tensor/tests/test_blas.py
+7
-7
没有找到文件。
theano/sandbox/cuda/opt.py
浏览文件 @
4b81dbd1
...
@@ -2275,11 +2275,10 @@ def gpuScanOptimization(node):
...
@@ -2275,11 +2275,10 @@ def gpuScanOptimization(node):
return
outputs
return
outputs
return
False
return
False
# en attente de tests et de correction
@register_opt
()
@register_opt
()
@local_optimizer
([
tensor
.
AllocEmpty
,
gpu_from_host
])
@local_optimizer
([
tensor
.
AllocEmpty
,
gpu_from_host
])
def
local_gpu_allocempty
(
node
):
def
local_gpu_allocempty
(
node
):
#print 'kikou'
if
(
isinstance
(
node
.
op
,
tensor
.
AllocEmpty
)
and
if
(
isinstance
(
node
.
op
,
tensor
.
AllocEmpty
)
and
node
.
op
.
dtype
==
"float32"
):
node
.
op
.
dtype
==
"float32"
):
return
[
host_from_gpu
(
GpuAllocEmpty
()(
*
node
.
inputs
))]
return
[
host_from_gpu
(
GpuAllocEmpty
()(
*
node
.
inputs
))]
...
...
theano/sandbox/cuda/tests/test_basic_ops.py
浏览文件 @
4b81dbd1
...
@@ -380,6 +380,17 @@ def test_alloc_empty():
...
@@ -380,6 +380,17 @@ def test_alloc_empty():
assert
out
.
shape
==
(
2
,
3
)
assert
out
.
shape
==
(
2
,
3
)
assert
out
.
dtype
==
'float32'
assert
out
.
dtype
==
'float32'
# Test that we merge them.
f
=
theano
.
function
([],
[
cuda
.
basic_ops
.
gpu_alloc_empty
(
2
,
3
),
cuda
.
basic_ops
.
gpu_alloc_empty
(
2
,
3
)])
out
=
f
()
assert
out
[
0
]
.
shape
==
(
2
,
3
)
assert
out
[
0
]
.
dtype
==
'float32'
assert
out
[
1
]
.
shape
==
(
2
,
3
)
assert
out
[
1
]
.
dtype
==
'float32'
assert
len
([
node
for
node
in
f
.
maker
.
fgraph
.
apply_nodes
if
isinstance
(
node
.
op
,
cuda
.
basic_ops
.
GpuAllocEmpty
)])
==
1
def
test_elemwise_empty
():
def
test_elemwise_empty
():
# test with 0 element
# test with 0 element
...
...
theano/sandbox/cuda/tests/test_opt.py
浏览文件 @
4b81dbd1
...
@@ -153,6 +153,7 @@ def test_gpualloc():
...
@@ -153,6 +153,7 @@ def test_gpualloc():
l
=
f
.
maker
.
fgraph
.
toposort
()
l
=
f
.
maker
.
fgraph
.
toposort
()
assert
numpy
.
any
([
isinstance
(
x
.
op
,
cuda
.
GpuAlloc
)
for
x
in
l
])
assert
numpy
.
any
([
isinstance
(
x
.
op
,
cuda
.
GpuAlloc
)
for
x
in
l
])
def
test_gpuallocempty
():
def
test_gpuallocempty
():
...
...
theano/tensor/basic.py
浏览文件 @
4b81dbd1
...
@@ -5550,8 +5550,7 @@ class AllocEmpty(gof.Op):
...
@@ -5550,8 +5550,7 @@ class AllocEmpty(gof.Op):
return
[
node
.
inputs
]
return
[
node
.
inputs
]
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
None
return
(
3
,)
return
(
2
,)
def
do_constant_folding
(
self
,
node
):
def
do_constant_folding
(
self
,
node
):
return
False
return
False
theano/tensor/blas.py
浏览文件 @
4b81dbd1
...
@@ -2043,7 +2043,7 @@ def local_dot22_to_dot22scalar(node):
...
@@ -2043,7 +2043,7 @@ def local_dot22_to_dot22scalar(node):
assert
not
a
.
type
.
ndim
assert
not
a
.
type
.
ndim
z
=
T
.
AllocEmpty
(
d
.
owner
.
inputs
[
0
]
.
dtype
)(
d
.
owner
.
inputs
[
0
]
.
shape
[
0
],
z
=
T
.
AllocEmpty
(
d
.
owner
.
inputs
[
0
]
.
dtype
)(
d
.
owner
.
inputs
[
0
]
.
shape
[
0
],
d
.
owner
.
inputs
[
1
]
.
shape
[
1
])
d
.
owner
.
inputs
[
1
]
.
shape
[
1
])
zero
=
T
.
as_tensor_variable
(
numpy
.
asarray
(
0
,
dtype
=
a
.
dtype
))
zero
=
T
.
as_tensor_variable
(
numpy
.
asarray
(
0
,
dtype
=
a
.
dtype
))
dot
=
gemm
(
z
,
a
,
d
.
owner
.
inputs
[
0
],
d
.
owner
.
inputs
[
1
],
zero
)
dot
=
gemm
(
z
,
a
,
d
.
owner
.
inputs
[
0
],
d
.
owner
.
inputs
[
1
],
zero
)
...
...
theano/tensor/tests/test_blas.py
浏览文件 @
4b81dbd1
...
@@ -875,7 +875,7 @@ def test_dot22scalar():
...
@@ -875,7 +875,7 @@ def test_dot22scalar():
cst
=
theano
.
tensor
.
basic
.
constant
(
.
2
,
dtype
=
dtype4
)
cst
=
theano
.
tensor
.
basic
.
constant
(
.
2
,
dtype
=
dtype4
)
cst2
=
theano
.
tensor
.
basic
.
constant
(
.
1
,
dtype
=
dtype4
)
cst2
=
theano
.
tensor
.
basic
.
constant
(
.
1
,
dtype
=
dtype4
)
def
check_dot22scalar
(
func
,
len_topo_scalar
=-
1
):
def
check_dot22scalar
_gemm
(
func
,
len_topo_scalar
=-
1
):
topo
=
func
.
maker
.
fgraph
.
toposort
()
topo
=
func
.
maker
.
fgraph
.
toposort
()
ops
=
[
x
.
op
for
x
in
topo
]
ops
=
[
x
.
op
for
x
in
topo
]
classes
=
[
type
(
x
.
op
)
for
x
in
topo
]
classes
=
[
type
(
x
.
op
)
for
x
in
topo
]
...
@@ -920,7 +920,7 @@ def test_dot22scalar():
...
@@ -920,7 +920,7 @@ def test_dot22scalar():
f
=
theano
.
function
([
a
,
b
],
cst
*
T
.
dot
(
a
,
b
),
f
=
theano
.
function
([
a
,
b
],
cst
*
T
.
dot
(
a
,
b
),
mode
=
mode_blas_opt
)
mode
=
mode_blas_opt
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
check_dot22scalar
(
f
,
1
)
check_dot22scalar
_gemm
(
f
,
1
)
f
(
av
,
bv
)
f
(
av
,
bv
)
...
@@ -929,7 +929,7 @@ def test_dot22scalar():
...
@@ -929,7 +929,7 @@ def test_dot22scalar():
cst
*
c
*
T
.
dot
(
a
,
b
),
cst
*
c
*
T
.
dot
(
a
,
b
),
mode
=
mode_blas_opt
)
mode
=
mode_blas_opt
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
check_dot22scalar
(
f
,
5
)
check_dot22scalar
_gemm
(
f
,
5
)
#print (av.dtype, bv.dtype, cv.dtype)
#print (av.dtype, bv.dtype, cv.dtype)
f
(
av
,
bv
,
cv
)
f
(
av
,
bv
,
cv
)
...
@@ -938,7 +938,7 @@ def test_dot22scalar():
...
@@ -938,7 +938,7 @@ def test_dot22scalar():
c
*
cst
*
T
.
dot
(
a
,
b
),
c
*
cst
*
T
.
dot
(
a
,
b
),
mode
=
mode_blas_opt
)
mode
=
mode_blas_opt
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
check_dot22scalar
(
f
,
5
)
check_dot22scalar
_gemm
(
f
,
5
)
f
(
av
,
bv
,
cv
)
f
(
av
,
bv
,
cv
)
# Here, canonicalize also seems needed
# Here, canonicalize also seems needed
...
@@ -948,7 +948,7 @@ def test_dot22scalar():
...
@@ -948,7 +948,7 @@ def test_dot22scalar():
cst2
*
c
*
cst
*
T
.
dot
(
a
,
b
),
cst2
*
c
*
cst
*
T
.
dot
(
a
,
b
),
mode
=
m2
)
mode
=
m2
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
check_dot22scalar
(
f
,
5
)
check_dot22scalar
_gemm
(
f
,
5
)
f
(
av
,
bv
,
cv
)
f
(
av
,
bv
,
cv
)
if
dtype1
==
dtype2
==
dtype3
:
if
dtype1
==
dtype2
==
dtype3
:
...
@@ -956,7 +956,7 @@ def test_dot22scalar():
...
@@ -956,7 +956,7 @@ def test_dot22scalar():
c
*
cst
*
a
*
T
.
dot
(
a
,
b
),
c
*
cst
*
a
*
T
.
dot
(
a
,
b
),
mode
=
m2
)
mode
=
m2
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
check_dot22scalar
(
f
,
5
)
check_dot22scalar
_gemm
(
f
,
5
)
f
(
sv
,
sv
,
sv
)
f
(
sv
,
sv
,
sv
)
f
=
theano
.
function
([
a
,
b
,
c
],
f
=
theano
.
function
([
a
,
b
,
c
],
...
@@ -979,7 +979,7 @@ def test_dot22scalar():
...
@@ -979,7 +979,7 @@ def test_dot22scalar():
c
*
a
*
cst
*
T
.
dot
(
a
,
b
),
c
*
a
*
cst
*
T
.
dot
(
a
,
b
),
mode
=
m2
)
mode
=
m2
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
check_dot22scalar
(
f
,
5
)
check_dot22scalar
_gemm
(
f
,
5
)
f
(
sv
,
sv
,
sv
)
f
(
sv
,
sv
,
sv
)
cmp
((
3
,
4
),
(
4
,
5
),
(
3
,
5
))
cmp
((
3
,
4
),
(
4
,
5
),
(
3
,
5
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论