Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
445c105a
提交
445c105a
authored
3月 15, 2012
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #545 from delallea/minor
Minor stuff
上级
bd34bddf
b7bcca16
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
40 行增加
和
35 行删除
+40
-35
NEWS.txt
NEWS.txt
+8
-8
cmodule.py
theano/gof/cmodule.py
+2
-1
test_opt.py
theano/sandbox/cuda/tests/test_opt.py
+28
-24
test_opt.py
theano/sparse/tests/test_opt.py
+2
-2
没有找到文件。
NEWS.txt
浏览文件 @
445c105a
...
...
@@ -29,13 +29,13 @@ New Features
(Frederic B.)
* debugprint does not print anymore the "|" symbol in a column after the last input. (Frederic B.)
* If you use Enthought Python Distribution (EPD) now we use its blas
implementation by default (
Tested Linux,
Windows)
implementation by default (
tested on Linux and
Windows)
(Frederic B., Simon McGregor)
Sparse Sandbox graduate
* Remove0 op: it remove
store element
with value 0. (Frederic B.)
* Remove0 op: it remove
s stored elements
with value 0. (Frederic B.)
Sparse Sandbox Addition
(N
ot reviewed/documented/tested, but used by some people)
Sparse Sandbox Addition
s (n
ot reviewed/documented/tested, but used by some people)
* They are all in the theano.sparse.sandbox.sp2 module
* Op class: Cast, Poisson, Multinomial, EliminateZeros, Sum, Binomial
* Op class: SamplingDot, SamplingDotCsr (inserted automatically)
...
...
@@ -52,13 +52,13 @@ Crash Fix
empty string (Frederic B.)
* When importing theano on a computer without GPU with the Theano
flags 'device' or 'init_gpu_device' set to gpu* (Frederic B., reported by Luo Heng)
* Optimization print
useless error when scipy i
s not available. (Frederic B.)
* G
pu conv crash/slowdown on newer hardware?
(James B.)
* Better error handling in
gpu
conv (Frederic B.)
* GPU optimization that move
element-wise op to the gpu. It happen
in
* Optimization print
ed a useless error when scipy wa
s not available. (Frederic B.)
* G
PU conv crash/slowdown on newer hardware
(James B.)
* Better error handling in
GPU
conv (Frederic B.)
* GPU optimization that move
s element-wise Ops to the GPU. Crash happened
in
a particular execution order of this optimization and the
element-wise fusion optimization when upcasting some inputs to
float32 (to compute them on the
gpu
).
float32 (to compute them on the
GPU
).
(Frederic B., reported by Sander Dieleman)
=============
...
...
theano/gof/cmodule.py
浏览文件 @
445c105a
...
...
@@ -35,7 +35,8 @@ def local_bitwidth():
By "architecture", we mean the size of memory pointers (size_t in C),
*not* the size of long int, as it can be different.
"""
# Platform.architecture is not reliable on OS X with universal binaries
# Note that according to Python documentation, `platform.architecture()` is
# not reliable on OS X with universal binaries.
maxsize
=
sys
.
maxsize
return
len
(
'
%
x'
%
maxsize
)
*
4
...
...
theano/sandbox/cuda/tests/test_opt.py
浏览文件 @
445c105a
...
...
@@ -166,35 +166,38 @@ def test_print_op():
assert
topo
[
3
]
.
op
==
cuda
.
host_from_gpu
f
(
numpy
.
random
.
random
((
5
,
5
))
.
astype
(
'float32'
))
def
test_huge_elemwise_fusion
():
""" Test the the GpuElemwise fusion work correctly
We check that we fuse one node with part of its input
in case their is too many inputs and that would make it bust the 256
bytes limits.
"""
shape
=
(
2
,
3
,
4
,
5
,
6
)
ttype
=
tensor
.
tensor
(
dtype
=
'float32'
,
broadcastable
=
(
False
,)
*
len
(
shape
))
shape
=
(
2
,
3
,
4
,
5
,
6
)
ttype
=
tensor
.
tensor
(
dtype
=
'float32'
,
broadcastable
=
(
False
,)
*
len
(
shape
))
vars
=
[
tensor
.
tanh
(
ttype
)
for
x
in
range
(
7
)]
f
=
pfunc
(
vars
,
[
vars
[
0
]
-
vars
[
1
]
-
vars
[
2
]
-
vars
[
3
]
-
vars
[
4
]
-
vars
[
5
]
-
vars
[
6
]],
mode
=
mode_with_gpu
)
f
=
pfunc
(
vars
,
[
vars
[
0
]
-
vars
[
1
]
-
vars
[
2
]
-
vars
[
3
]
-
vars
[
4
]
-
vars
[
5
]
-
vars
[
6
]],
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
env
.
toposort
()
#theano.printing.debugprint(f)
#for i, node in enumerate(topo):
# print >> sys.stdout, i, node
assert
len
(
topo
)
==
10
assert
sum
([
isinstance
(
node
.
op
,
cuda
.
GpuElemwise
)
for
node
in
topo
])
==
2
assert
isinstance
(
topo
[
7
]
.
op
.
scalar_op
,
theano
.
scalar
.
basic
.
Sub
)
assert
isinstance
(
topo
[
8
]
.
op
.
scalar_op
,
theano
.
scalar
.
basic
.
Composite
)
assert
len
(
topo
)
==
10
assert
sum
([
isinstance
(
node
.
op
,
cuda
.
GpuElemwise
)
for
node
in
topo
])
==
2
assert
isinstance
(
topo
[
7
]
.
op
.
scalar_op
,
theano
.
scalar
.
basic
.
Sub
)
assert
isinstance
(
topo
[
8
]
.
op
.
scalar_op
,
theano
.
scalar
.
basic
.
Composite
)
#let debugmode catch errors
gen
=
lambda
:
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
)
f
(
gen
(),
gen
(),
gen
(),
gen
(),
gen
(),
gen
(),
gen
())
gen
=
lambda
:
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
)
f
(
gen
(),
gen
(),
gen
(),
gen
(),
gen
(),
gen
(),
gen
())
# Test the case where we can't put the computation on the gpu! their is too
many
# dimensions to the input to have 2 inputs to the op!
# Test the case where we can't put the computation on the gpu! their is too
#
many
dimensions to the input to have 2 inputs to the op!
shape
=
(
1
,
2
,
3
,
4
,
5
,
6
,
7
,
2
,
2
,
3
,
2
,
1
,
2
,
2
,
2
,)
ttype
=
tensor
.
tensor
(
dtype
=
'float32'
,
broadcastable
=
(
False
,)
*
len
(
shape
))
shape
=
(
1
,
2
,
3
,
4
,
5
,
6
,
7
,
2
,
2
,
3
,
2
,
1
,
2
,
2
,
2
,)
ttype
=
tensor
.
tensor
(
dtype
=
'float32'
,
broadcastable
=
(
False
,)
*
len
(
shape
))
vars
=
[
tensor
.
tanh
(
ttype
)
for
x
in
range
(
7
)]
f
=
pfunc
(
vars
,
[
vars
[
0
]
-
vars
[
1
]
-
vars
[
2
]
-
vars
[
3
]
-
vars
[
4
]
-
vars
[
5
]
-
vars
[
6
]],
mode
=
mode_with_gpu
)
f
=
pfunc
(
vars
,
[
vars
[
0
]
-
vars
[
1
]
-
vars
[
2
]
-
vars
[
3
]
-
vars
[
4
]
-
vars
[
5
]
-
vars
[
6
]],
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
env
.
toposort
()
#theano.printing.debugprint(f)
assert
len
(
topo
)
==
1
...
...
@@ -243,8 +246,7 @@ def test_huge_elemwise_fusion():
def
test_local_gpu_elemwise_0
():
"""
Test the test_local_gpu_elemwise_0 when there is dtype upcastable
to float32
Test local_gpu_elemwise_0 when there is a dtype upcastable to float32
"""
a
=
tensor
.
bmatrix
()
b
=
tensor
.
fmatrix
()
...
...
@@ -254,7 +256,7 @@ def test_local_gpu_elemwise_0():
b_v
=
(
numpy
.
random
.
rand
(
4
,
5
)
*
10
)
.
astype
(
"float32"
)
c_v
=
(
numpy
.
random
.
rand
(
4
,
5
)
*
10
)
.
astype
(
"float32"
)
# Due to o
rder of optimization, this the
composite is created when all
# Due to o
ptimization order, this
composite is created when all
# the op are on the gpu.
f
=
theano
.
function
([
a
,
b
,
c
],
[
a
+
b
+
c
],
mode
=
mode_with_gpu
)
#theano.printing.debugprint(f)
...
...
@@ -263,7 +265,7 @@ def test_local_gpu_elemwise_0():
assert
sum
(
isinstance
(
node
.
op
,
tensor
.
Elemwise
)
for
node
in
topo
)
==
1
f
(
a_v
,
b_v
,
c_v
)
# No
t
test with the composite already on the cpu before we move it
# No
w
test with the composite already on the cpu before we move it
# to the gpu
a_s
=
theano
.
scalar
.
int8
()
b_s
=
theano
.
scalar
.
float32
()
...
...
@@ -280,18 +282,20 @@ def test_local_gpu_elemwise_0():
def
test_elemwise_fusion
():
""" Test the the GpuElemwise fusion work correctly"""
shape
=
(
3
,
4
)
a
=
cuda
.
shared_constructor
(
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
),
'a'
)
shape
=
(
3
,
4
)
a
=
cuda
.
shared_constructor
(
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
),
'a'
)
b
=
tensor
.
fmatrix
()
c
=
tensor
.
fmatrix
()
f
=
pfunc
([
b
,
c
],
[
a
+
b
+
c
],
mode
=
mode_with_gpu
)
f
=
pfunc
([
b
,
c
],
[
a
+
b
+
c
],
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
env
.
toposort
()
for
i
,
node
in
enumerate
(
topo
):
print
>>
sys
.
stdout
,
i
,
node
assert
len
(
topo
)
==
4
assert
isinstance
(
topo
[
2
]
.
op
.
scalar_op
,
theano
.
scalar
.
basic
.
Composite
)
assert
len
(
topo
)
==
4
assert
isinstance
(
topo
[
2
]
.
op
.
scalar_op
,
theano
.
scalar
.
basic
.
Composite
)
#let debugmode catch errors
f
(
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
),
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
))
f
(
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
),
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
))
class
test_local_gpu_tensordot
(
unittest
.
TestCase
):
...
...
theano/sparse/tests/test_opt.py
浏览文件 @
445c105a
...
...
@@ -10,9 +10,9 @@ from theano import config, tensor
from
theano.sparse
import
(
enable_sparse
,
CSM
,
CSMProperties
,
csm_properties
,
CSC
,
CSR
)
from
theano.sparse.tests.test_basic
import
random_lil
#from theano.gof.python25 import all, any, product
from
theano.gof.python25
import
any
if
enable_sparse
==
Fal
se
:
if
not
enable_spar
se
:
raise
SkipTest
(
'Optional package sparse disabled'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论