Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
703d535a
提交
703d535a
authored
1月 23, 2013
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1173 from nouiz/fix_crash_roll
Fix crash tensor.roll(Var, iscalar) reported by Jeremiah Lowin.
上级
a696539d
52be4733
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
12 行增加
和
8 行删除
+12
-8
install.txt
doc/install.txt
+2
-0
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+2
-1
basic.py
theano/tensor/basic.py
+2
-2
test_basic.py
theano/tensor/tests/test_basic.py
+6
-5
没有找到文件。
doc/install.txt
浏览文件 @
703d535a
...
@@ -105,6 +105,8 @@ Brian Vandenberg emailed `installation instructions on Gentoo
...
@@ -105,6 +105,8 @@ Brian Vandenberg emailed `installation instructions on Gentoo
<http://groups.google.com/d/msg/theano-dev/-8WCMn2FMR0/bJPasoZXaqoJ>`_,
<http://groups.google.com/d/msg/theano-dev/-8WCMn2FMR0/bJPasoZXaqoJ>`_,
focusing on how to install the appropriate dependencies.
focusing on how to install the appropriate dependencies.
Nicolas Pinto provide `ebuild scripts <https://github.com/npinto/sekyfsr-gentoo-overlay/tree/master/sci-libs/Theano>`_.
Alternative installation on Mandriva 2010.2
Alternative installation on Mandriva 2010.2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
theano/sandbox/cuda/basic_ops.py
浏览文件 @
703d535a
...
@@ -89,6 +89,7 @@ class HostFromGpu(GpuOp):
...
@@ -89,6 +89,7 @@ class HostFromGpu(GpuOp):
out
=
outputs
[
0
]
out
=
outputs
[
0
]
fail
=
sub
[
'fail'
]
fail
=
sub
[
'fail'
]
return
"""
return
"""
Py_XDECREF(
%(out)
s);
%(out)
s = (PyArrayObject *) CudaNdarray_CreateArrayObj(
%(inp)
s);
%(out)
s = (PyArrayObject *) CudaNdarray_CreateArrayObj(
%(inp)
s);
if(!
%(out)
s){
if(!
%(out)
s){
%(fail)
s;
%(fail)
s;
...
@@ -96,7 +97,7 @@ class HostFromGpu(GpuOp):
...
@@ -96,7 +97,7 @@ class HostFromGpu(GpuOp):
"""
%
locals
()
"""
%
locals
()
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
1
,)
return
(
2
,)
host_from_gpu
=
HostFromGpu
()
host_from_gpu
=
HostFromGpu
()
...
...
theano/tensor/basic.py
浏览文件 @
703d535a
...
@@ -5632,8 +5632,8 @@ def roll(x, shift, axis=None):
...
@@ -5632,8 +5632,8 @@ def roll(x, shift, axis=None):
end_list
=
([
allslice
]
*
axis
+
[
end_slice
]
+
end_list
=
([
allslice
]
*
axis
+
[
end_slice
]
+
[
allslice
]
*
(
x
.
ndim
-
axis
-
1
))
[
allslice
]
*
(
x
.
ndim
-
axis
-
1
))
return
join
(
axis
,
return
join
(
axis
,
Subtensor
(
front_list
)(
x
),
x
.
__getitem__
(
tuple
(
front_list
)
),
Subtensor
(
end_list
)(
x
))
x
.
__getitem__
(
tuple
(
end_list
)
))
@constructor
@constructor
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
703d535a
...
@@ -3625,16 +3625,17 @@ class T_Join_and_Split(unittest.TestCase):
...
@@ -3625,16 +3625,17 @@ class T_Join_and_Split(unittest.TestCase):
def
test_roll
(
self
):
def
test_roll
(
self
):
for
get_shift
in
[
lambda
a
:
a
,
lambda
x
:
theano
.
shared
(
x
)]:
# Test simple 1D example
# Test simple 1D example
a
=
self
.
shared
(
numpy
.
array
([
1
,
2
,
3
,
4
,
5
,
6
],
dtype
=
self
.
floatX
))
a
=
self
.
shared
(
numpy
.
array
([
1
,
2
,
3
,
4
,
5
,
6
],
dtype
=
self
.
floatX
))
b
=
roll
(
a
,
2
)
b
=
roll
(
a
,
get_shift
(
2
)
)
want
=
numpy
.
array
([
5
,
6
,
1
,
2
,
3
,
4
])
want
=
numpy
.
array
([
5
,
6
,
1
,
2
,
3
,
4
])
out
=
theano
.
function
([],
b
)()
out
=
theano
.
function
([],
b
)()
assert
(
out
==
want
)
.
all
()
assert
(
out
==
want
)
.
all
()
# Test simple 1D example with explicit 0 axis
# Test simple 1D example with explicit 0 axis
b
=
roll
(
a
,
-
1
,
0
)
b
=
roll
(
a
,
get_shift
(
-
1
)
,
0
)
want
=
numpy
.
array
([
2
,
3
,
4
,
5
,
6
,
1
])
want
=
numpy
.
array
([
2
,
3
,
4
,
5
,
6
,
1
])
out
=
theano
.
function
([],
b
)()
out
=
theano
.
function
([],
b
)()
...
@@ -3642,7 +3643,7 @@ class T_Join_and_Split(unittest.TestCase):
...
@@ -3642,7 +3643,7 @@ class T_Join_and_Split(unittest.TestCase):
# Test 2D example - ensure that behavior matches numpy.roll behavior
# Test 2D example - ensure that behavior matches numpy.roll behavior
a
=
self
.
shared
(
numpy
.
arange
(
21
)
.
reshape
((
3
,
7
))
.
astype
(
self
.
floatX
))
a
=
self
.
shared
(
numpy
.
arange
(
21
)
.
reshape
((
3
,
7
))
.
astype
(
self
.
floatX
))
b
=
roll
(
a
,
-
2
,
1
)
b
=
roll
(
a
,
get_shift
(
-
2
)
,
1
)
want
=
numpy
.
roll
(
a
.
get_value
(
borrow
=
True
),
-
2
,
1
)
want
=
numpy
.
roll
(
a
.
get_value
(
borrow
=
True
),
-
2
,
1
)
out
=
theano
.
function
([],
b
)()
out
=
theano
.
function
([],
b
)()
...
@@ -3651,14 +3652,14 @@ class T_Join_and_Split(unittest.TestCase):
...
@@ -3651,14 +3652,14 @@ class T_Join_and_Split(unittest.TestCase):
# Test rolling on axis 0
# Test rolling on axis 0
want
=
numpy
.
roll
(
a
.
get_value
(
borrow
=
True
),
-
2
,
0
)
want
=
numpy
.
roll
(
a
.
get_value
(
borrow
=
True
),
-
2
,
0
)
b
=
roll
(
a
,
-
2
,
0
)
b
=
roll
(
a
,
get_shift
(
-
2
)
,
0
)
out
=
theano
.
function
([],
b
)()
out
=
theano
.
function
([],
b
)()
assert
(
out
==
want
)
.
all
()
assert
(
out
==
want
)
.
all
()
# Test rolling on default axis with ndim > 1
# Test rolling on default axis with ndim > 1
want
=
numpy
.
roll
(
a
.
get_value
(
borrow
=
True
),
2
)
want
=
numpy
.
roll
(
a
.
get_value
(
borrow
=
True
),
2
)
b
=
roll
(
a
,
2
)
b
=
roll
(
a
,
get_shift
(
2
)
)
out
=
theano
.
function
([],
b
)()
out
=
theano
.
function
([],
b
)()
assert
(
out
==
want
)
.
all
()
assert
(
out
==
want
)
.
all
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论