Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
36a01bb6
提交
36a01bb6
authored
3月 21, 2012
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #556 from lamblin/fix_cudandarray_python24
Fix a number of tests for Python 2.4
上级
9c9fe6cc
f7c304cd
全部展开
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
47 行增加
和
10 行删除
+47
-10
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+13
-1
cuda_ndarray.cu
theano/sandbox/cuda/cuda_ndarray.cu
+0
-0
elemwise.py
theano/sandbox/cuda/elemwise.py
+8
-3
opt.py
theano/sandbox/cuda/opt.py
+6
-4
rng_curand.py
theano/sandbox/cuda/rng_curand.py
+1
-1
test_basic_ops.py
theano/sandbox/cuda/tests/test_basic_ops.py
+1
-0
test_blas.py
theano/sandbox/cuda/tests/test_blas.py
+1
-0
test_cuda_ndarray.py
theano/sandbox/cuda/tests/test_cuda_ndarray.py
+1
-0
test_driver.py
theano/sandbox/cuda/tests/test_driver.py
+1
-0
test_nnet.py
theano/sandbox/cuda/tests/test_nnet.py
+1
-0
multinomial.py
theano/sandbox/multinomial.py
+1
-0
test_multinomial.py
theano/sandbox/test_multinomial.py
+1
-0
test_neighbours.py
theano/sandbox/test_neighbours.py
+1
-0
basic.py
theano/tensor/basic.py
+11
-1
没有找到文件。
theano/sandbox/cuda/basic_ops.py
浏览文件 @
36a01bb6
...
@@ -5,6 +5,8 @@ import theano
...
@@ -5,6 +5,8 @@ import theano
from
theano
import
Op
,
Type
,
Apply
,
Variable
,
Constant
from
theano
import
Op
,
Type
,
Apply
,
Variable
,
Constant
from
theano
import
tensor
,
scalar
,
config
from
theano
import
tensor
,
scalar
,
config
from
theano.gof.python25
import
all
,
any
from
theano.sandbox.cuda
import
GpuOp
from
theano.sandbox.cuda
import
GpuOp
from
theano.sandbox.cuda.type
import
CudaNdarrayType
from
theano.sandbox.cuda.type
import
CudaNdarrayType
from
theano.sandbox.cuda
import
filter
as
type_support_filter
from
theano.sandbox.cuda
import
filter
as
type_support_filter
...
@@ -1754,7 +1756,17 @@ class GpuSubtensor(tensor.Subtensor, GpuOp):
...
@@ -1754,7 +1756,17 @@ class GpuSubtensor(tensor.Subtensor, GpuOp):
def
convert
(
entry
):
def
convert
(
entry
):
if
isinstance
(
entry
,
Type
):
if
isinstance
(
entry
,
Type
):
return
indices
.
pop
()
rval
=
indices
.
pop
()
if
sys
.
version_info
<
(
2
,
5
):
# Before Python 2.5, PySlice_GetIndicesEx requires
# Python int to be passed.
rval_
=
int
(
rval
)
if
rval_
!=
rval
:
raise
IndexError
((
"Invalid value for indexing:
%
s. "
"That value may be too big."
)
%
rval
)
return
rval_
return
rval
elif
isinstance
(
entry
,
slice
):
elif
isinstance
(
entry
,
slice
):
return
slice
(
convert
(
entry
.
start
),
return
slice
(
convert
(
entry
.
start
),
convert
(
entry
.
stop
),
convert
(
entry
.
stop
),
...
...
theano/sandbox/cuda/cuda_ndarray.cu
浏览文件 @
36a01bb6
差异被折叠。
点击展开。
theano/sandbox/cuda/elemwise.py
浏览文件 @
36a01bb6
...
@@ -868,11 +868,15 @@ nd_collapse_[i]=0;
...
@@ -868,11 +868,15 @@ nd_collapse_[i]=0;
#check that all inputs have valid dimensions
#check that all inputs have valid dimensions
emitted_inames
=
{}
emitted_inames
=
{}
for
id
,
iname
in
enumerate
(
inputs
):
for
id
,
iname
in
enumerate
(
inputs
):
if
iname
in
emitted_inames
:
if
iname
in
emitted_inames
:
assert
emitted_inames
[
iname
]
is
node
.
inputs
[
id
]
assert
emitted_inames
[
iname
]
is
node
.
inputs
[
id
]
continue
continue
broadcasts
=
', '
.
join
(
map
(
str
,
map
(
int
,
node
.
inputs
[
id
]
.
broadcastable
)))
# with python 2.4 (at least), if a broadcastable pattern is made of
# numpy.bool_ instead of bool, calling int() once is not enough.
broadcasts
=
map
(
int
,
map
(
int
,
node
.
inputs
[
id
]
.
broadcastable
))
broadcasts
=
', '
.
join
(
map
(
str
,
broadcasts
))
nd
=
node
.
inputs
[
id
]
.
ndim
nd
=
node
.
inputs
[
id
]
.
ndim
if
nd
>
0
:
if
nd
>
0
:
print
>>
sio
,
"""
print
>>
sio
,
"""
...
@@ -883,9 +887,10 @@ nd_collapse_[i]=0;
...
@@ -883,9 +887,10 @@ nd_collapse_[i]=0;
int *broadcasts_
%(iname)
s = NULL;
int *broadcasts_
%(iname)
s = NULL;
"""
%
locals
()
"""
%
locals
()
emitted_inames
[
iname
]
=
node
.
inputs
[
id
]
emitted_inames
[
iname
]
=
node
.
inputs
[
id
]
#check that all inputs have valid dimensions
#check that all inputs have valid dimensions
emitted_inames
=
{}
emitted_inames
=
{}
for
id
,
iname
in
enumerate
(
inputs
):
for
id
,
iname
in
enumerate
(
inputs
):
if
iname
in
emitted_inames
:
if
iname
in
emitted_inames
:
continue
continue
print
>>
sio
,
"""
print
>>
sio
,
"""
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
36a01bb6
...
@@ -2,16 +2,18 @@ import logging
...
@@ -2,16 +2,18 @@ import logging
_logger
=
logging
.
getLogger
(
'theano.sandbox.cuda.opt'
)
_logger
=
logging
.
getLogger
(
'theano.sandbox.cuda.opt'
)
import
sys
import
sys
import
theano
import
numpy
import
numpy
from
theano.scan_module
import
scan_utils
,
scan_op
import
theano
from
theano
import
scalar
as
scal
from
theano
import
scalar
as
scal
from
theano
import
tensor
,
compile
,
gof
from
theano
import
tensor
,
compile
,
gof
from
theano.compile
import
optdb
from
theano.gof
import
(
local_optimizer
,
EquilibriumDB
,
SequenceDB
,
ProxyDB
,
from
theano.gof
import
(
local_optimizer
,
EquilibriumDB
,
SequenceDB
,
ProxyDB
,
Optimizer
,
toolbox
,
DestroyHandler
,
Optimizer
,
toolbox
,
DestroyHandler
,
EquilibriumOptimizer
)
EquilibriumOptimizer
)
from
theano.gof.python25
import
all
,
any
from
theano.sandbox.cuda.basic_ops
import
*
from
theano.sandbox.cuda.basic_ops
import
*
from
theano.sandbox.cuda.type
import
CudaNdarrayType
from
theano.sandbox.cuda.type
import
CudaNdarrayType
from
theano.sandbox.cuda.blas
import
(
gpu_dot22
,
gpu_dot22scalar
,
from
theano.sandbox.cuda.blas
import
(
gpu_dot22
,
gpu_dot22scalar
,
...
@@ -27,7 +29,7 @@ from theano.sandbox.cuda.nnet import (
...
@@ -27,7 +29,7 @@ from theano.sandbox.cuda.nnet import (
GpuCrossentropySoftmax1HotWithBiasDx
,
GpuCrossentropySoftmax1HotWithBiasDx
,
GpuSoftmax
,
GpuSoftmaxWithBias
)
GpuSoftmax
,
GpuSoftmaxWithBias
)
from
theano.sandbox.cuda.elemwise
import
SupportCodeError
from
theano.sandbox.cuda.elemwise
import
SupportCodeError
from
theano.
compile
import
optdb
from
theano.
scan_module
import
scan_utils
,
scan_op
from
theano.tensor.blas
import
_is_real_vector
,
_is_real_matrix
from
theano.tensor.blas
import
_is_real_vector
,
_is_real_matrix
#optdb.print_summary() # shows what is currently registered
#optdb.print_summary() # shows what is currently registered
...
...
theano/sandbox/cuda/rng_curand.py
浏览文件 @
36a01bb6
...
@@ -7,9 +7,9 @@ __copyright__ = "(c) 2011, University of Montreal"
...
@@ -7,9 +7,9 @@ __copyright__ = "(c) 2011, University of Montreal"
__license__
=
"3-clause BSD License"
__license__
=
"3-clause BSD License"
__contact__
=
"theano-dev@googlegroups.com"
__contact__
=
"theano-dev@googlegroups.com"
import
sys
import
numpy
import
numpy
import
theano.gof
import
theano.gof
from
theano.gof.python25
import
all
from
theano.sandbox.cuda
import
CudaNdarrayType
,
GpuOp
from
theano.sandbox.cuda
import
CudaNdarrayType
,
GpuOp
from
theano.tensor
import
(
get_vector_length
,
cast
,
opt
)
from
theano.tensor
import
(
get_vector_length
,
cast
,
opt
)
from
theano.compile
import
optdb
from
theano.compile
import
optdb
...
...
theano/sandbox/cuda/tests/test_basic_ops.py
浏览文件 @
36a01bb6
...
@@ -13,6 +13,7 @@ import theano.sandbox.cuda as cuda_ndarray
...
@@ -13,6 +13,7 @@ import theano.sandbox.cuda as cuda_ndarray
if
cuda_ndarray
.
cuda_available
==
False
:
if
cuda_ndarray
.
cuda_available
==
False
:
raise
SkipTest
(
'Optional package cuda disabled'
)
raise
SkipTest
(
'Optional package cuda disabled'
)
from
theano.gof.python25
import
any
import
theano.sandbox.cuda
as
tcn
import
theano.sandbox.cuda
as
tcn
import
theano.sandbox.cuda
as
cuda
import
theano.sandbox.cuda
as
cuda
import
theano.sandbox.cuda.basic_ops
as
B
import
theano.sandbox.cuda.basic_ops
as
B
...
...
theano/sandbox/cuda/tests/test_blas.py
浏览文件 @
36a01bb6
...
@@ -16,6 +16,7 @@ import theano.sandbox.cuda as tcn
...
@@ -16,6 +16,7 @@ import theano.sandbox.cuda as tcn
from
theano.tensor.signal.downsample
import
(
DownsampleFactorMax
,
from
theano.tensor.signal.downsample
import
(
DownsampleFactorMax
,
DownsampleFactorMaxGrad
)
DownsampleFactorMaxGrad
)
from
theano.gof.python25
import
any
import
theano.compile.mode
import
theano.compile.mode
from
theano.tensor.tests.test_blas
import
BaseGemv
,
TestBlasStrides
,
TestGer
from
theano.tensor.tests.test_blas
import
BaseGemv
,
TestBlasStrides
,
TestGer
...
...
theano/sandbox/cuda/tests/test_cuda_ndarray.py
浏览文件 @
36a01bb6
...
@@ -5,6 +5,7 @@ from nose.plugins.skip import SkipTest
...
@@ -5,6 +5,7 @@ from nose.plugins.skip import SkipTest
import
numpy
import
numpy
import
theano
import
theano
from
theano.gof.python25
import
all
import
theano.sandbox.cuda
as
cuda_ndarray
import
theano.sandbox.cuda
as
cuda_ndarray
from
theano.tensor.basic
import
_allclose
from
theano.tensor.basic
import
_allclose
from
theano.tests
import
unittest_tools
as
utt
from
theano.tests
import
unittest_tools
as
utt
...
...
theano/sandbox/cuda/tests/test_driver.py
浏览文件 @
36a01bb6
...
@@ -7,6 +7,7 @@ import theano.sandbox.cuda as cuda_ndarray
...
@@ -7,6 +7,7 @@ import theano.sandbox.cuda as cuda_ndarray
if
cuda_ndarray
.
cuda_available
==
False
:
if
cuda_ndarray
.
cuda_available
==
False
:
raise
SkipTest
(
'Optional package cuda disabled'
)
raise
SkipTest
(
'Optional package cuda disabled'
)
from
theano.gof.python25
import
any
import
theano.sandbox.cuda
as
cuda
import
theano.sandbox.cuda
as
cuda
import
theano.sandbox.cuda.basic_ops
as
B
import
theano.sandbox.cuda.basic_ops
as
B
...
...
theano/sandbox/cuda/tests/test_nnet.py
浏览文件 @
36a01bb6
...
@@ -2,6 +2,7 @@ from nose.plugins.skip import SkipTest
...
@@ -2,6 +2,7 @@ from nose.plugins.skip import SkipTest
import
numpy
import
numpy
import
theano
import
theano
from
theano.gof.python25
import
any
import
theano.tensor
as
T
import
theano.tensor
as
T
import
theano.tests.unittest_tools
as
utt
import
theano.tests.unittest_tools
as
utt
...
...
theano/sandbox/multinomial.py
浏览文件 @
36a01bb6
...
@@ -2,6 +2,7 @@ import theano
...
@@ -2,6 +2,7 @@ import theano
from
theano
import
Op
,
Apply
from
theano
import
Op
,
Apply
import
theano.tensor
as
T
import
theano.tensor
as
T
from
theano.gof
import
local_optimizer
from
theano.gof
import
local_optimizer
from
theano.gof.python25
import
any
from
theano.sandbox.cuda
import
cuda_available
,
GpuOp
from
theano.sandbox.cuda
import
cuda_available
,
GpuOp
if
cuda_available
:
if
cuda_available
:
...
...
theano/sandbox/test_multinomial.py
浏览文件 @
36a01bb6
...
@@ -6,6 +6,7 @@ import theano
...
@@ -6,6 +6,7 @@ import theano
from
theano
import
config
,
function
,
tensor
from
theano
import
config
,
function
,
tensor
import
multinomial
import
multinomial
from
theano.compile.mode
import
get_default_mode
,
predefined_linkers
from
theano.compile.mode
import
get_default_mode
,
predefined_linkers
from
theano.gof.python25
import
any
import
theano.sandbox.cuda
as
cuda
import
theano.sandbox.cuda
as
cuda
def
get_mode
(
gpu
):
def
get_mode
(
gpu
):
...
...
theano/sandbox/test_neighbours.py
浏览文件 @
36a01bb6
...
@@ -7,6 +7,7 @@ from neighbours import (images2neibs, neibs2images,
...
@@ -7,6 +7,7 @@ from neighbours import (images2neibs, neibs2images,
# Skip test if cuda_ndarray is not available.
# Skip test if cuda_ndarray is not available.
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
import
theano.sandbox.cuda
as
cuda
import
theano.sandbox.cuda
as
cuda
from
theano.gof.python25
import
any
from
theano.tests
import
unittest_tools
from
theano.tests
import
unittest_tools
...
...
theano/tensor/basic.py
浏览文件 @
36a01bb6
...
@@ -4126,7 +4126,17 @@ class IncSubtensor(Op):
...
@@ -4126,7 +4126,17 @@ class IncSubtensor(Op):
def
convert
(
entry
):
def
convert
(
entry
):
if
isinstance
(
entry
,
gof
.
Type
):
if
isinstance
(
entry
,
gof
.
Type
):
return
indices
.
pop
()
rval
=
indices
.
pop
()
if
sys
.
version_info
<
(
2
,
5
):
# Before Python 2.5, PySlice_GetIndicesEx requires
# Python int to be passed.
rval_
=
int
(
rval
)
if
rval_
!=
rval
:
raise
IndexError
((
"Invalid value for indexing:
%
s. "
"That value may be too big."
)
%
rval
)
return
rval_
return
rval
elif
isinstance
(
entry
,
slice
):
elif
isinstance
(
entry
,
slice
):
return
slice
(
convert
(
entry
.
start
),
return
slice
(
convert
(
entry
.
start
),
convert
(
entry
.
stop
),
convert
(
entry
.
stop
),
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论