Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ff835e51
提交
ff835e51
authored
9月 06, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix compilation crash reported in gh-1518 for gpujoin.
上级
a351e3db
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
30 行增加
和
12 行删除
+30
-12
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+10
-10
test_basic.py
theano/tensor/tests/test_basic.py
+20
-2
没有找到文件。
theano/sandbox/cuda/basic_ops.py
浏览文件 @
ff835e51
...
...
@@ -5,7 +5,7 @@ import sys
import
numpy
import
theano
from
theano
import
Type
,
Apply
from
theano
import
gof
,
Type
,
Apply
from
theano
import
tensor
,
scalar
,
config
from
theano.compat.six
import
StringIO
from
theano.scalar
import
Scalar
...
...
@@ -2960,7 +2960,6 @@ class GpuJoin(tensor.Join, GpuOp):
str
=
"""
const int axis = PyInt_AsLong((PyObject*)
%(axis)
s);
const int nd =
%(nd)
s;
int shape_
%(input_1)
s[nd];
int shape_out[nd];
int width_sum = 0;
int errorcode;
...
...
@@ -2973,11 +2972,6 @@ class GpuJoin(tensor.Join, GpuOp):
start = NULL;
stop = NULL;
for(int i = 0; i<nd; i+=1)
{
shape_
%(input_1)
s[i] = CudaNdarray_HOST_DIMS(
%(input_1)
s)[i];
shape_out[i] = shape_
%(input_1)
s[i];
}
"""
%
locals
()
# getting the shapes of all the involved tensors (input[1:])
...
...
@@ -2986,7 +2980,7 @@ class GpuJoin(tensor.Join, GpuOp):
# shape_%(cdna)s[nd] is initialized before, to prevent following
# error: jump to label __label_9 crosses initialization of
# shape_%(cdna)s[nd]
for
i
,
cdna
in
enumerate
(
inputs
[
2
:]
):
for
i
,
cdna
in
enumerate
(
gof
.
utils
.
uniq
(
inputs
[
1
:])
):
str
+=
"""
int shape_
%(cdna)
s[nd];
"""
%
locals
()
...
...
@@ -2998,8 +2992,14 @@ class GpuJoin(tensor.Join, GpuOp):
if(full_slice == NULL){
%(fail)
s;
}
for(int i = 0; i<nd; i+=1)
{
shape_
%(input_1)
s[i] = CudaNdarray_HOST_DIMS(
%(input_1)
s)[i];
shape_out[i] = shape_
%(input_1)
s[i];
}
"""
%
locals
()
for
i
,
cdna
in
enumerate
(
inputs
[
2
:]
):
for
i
,
cdna
in
enumerate
(
gof
.
utils
.
uniq
(
inputs
[
2
:])
):
str
+=
"""
for(int i = 0; i<nd; i+=1)
{
...
...
@@ -3090,7 +3090,7 @@ class GpuJoin(tensor.Join, GpuOp):
return
str
def
c_code_cache_version
(
self
):
return
(
4
,)
return
(
5
,)
gpu_join
=
GpuJoin
()
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
ff835e51
...
...
@@ -3294,11 +3294,29 @@ class T_Join_and_Split(unittest.TestCase):
"""
Regression test for a crash that used to happen when rebroadcasting.
"""
x
=
tensor
.
TensorType
(
floatX
,
[
False
,
False
,
True
])()
u
=
tensor
.
TensorType
(
floatX
,
[
False
,
False
,
True
])()
x
=
tensor
.
TensorType
(
self
.
floatX
,
[
False
,
False
,
True
])()
u
=
tensor
.
TensorType
(
self
.
floatX
,
[
False
,
False
,
True
])()
# This line used to crash.
z
=
tensor
.
concatenate
([
x
,
-
u
],
axis
=
2
)
def
test_concatenate_same
(
self
):
"""
Test that we can concatenate the same tensor multiple time.
In the past it was broken on the GPU.
"""
rng
=
numpy
.
random
.
RandomState
(
seed
=
utt
.
fetch_seed
())
T_shared
=
self
.
shared
(
rng
.
rand
(
3
,
4
)
.
astype
(
self
.
floatX
))
Tout
=
tensor
.
concatenate
([
T_shared
,
T_shared
])
f
=
function
([],
Tout
,
mode
=
self
.
mode
)
out
=
f
()
if
theano
.
config
.
mode
!=
'FAST_COMPILE'
:
assert
[
True
for
node
in
f
.
maker
.
fgraph
.
toposort
()
if
isinstance
(
node
.
op
,
self
.
join_op
)]
assert
numpy
.
allclose
(
out
,
numpy
.
concatenate
([
T_shared
.
get_value
(),
T_shared
.
get_value
()]))
class
test_comparison
(
unittest
.
TestCase
):
"""Test <, >, <=, >=, == and !=
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论