Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8a736df5
提交
8a736df5
authored
2月 11, 2016
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4033 from nouiz/py3_repr
Fix CudaNdarray repr in python 3 and a crash.
上级
931dfec1
20609f04
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
31 行增加
和
4 行删除
+31
-4
debugmode.py
theano/compile/debugmode.py
+1
-0
blas.py
theano/sandbox/cuda/blas.py
+5
-0
cuda_ndarray.cu
theano/sandbox/cuda/cuda_ndarray.cu
+6
-0
opt.py
theano/sandbox/cuda/opt.py
+5
-4
test_opt.py
theano/sandbox/cuda/tests/test_opt.py
+14
-0
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
8a736df5
...
@@ -2050,6 +2050,7 @@ class _Linker(gof.link.LocalLinker):
...
@@ -2050,6 +2050,7 @@ class _Linker(gof.link.LocalLinker):
# shouldn't have put it into the list in
# shouldn't have put it into the list in
# the first place
# the first place
thunk_py
=
None
thunk_py
=
None
thunks_py
[
i
]
=
None
except
Exception
as
e
:
except
Exception
as
e
:
# I think that only 1 optimization can
# I think that only 1 optimization can
# insert a given apply node. If that is not True,
# insert a given apply node. If that is not True,
...
...
theano/sandbox/cuda/blas.py
浏览文件 @
8a736df5
...
@@ -1143,6 +1143,8 @@ class GpuCorrMM_gradWeights(BaseGpuCorrMM):
...
@@ -1143,6 +1143,8 @@ class GpuCorrMM_gradWeights(BaseGpuCorrMM):
raise
ValueError
(
'shape must be given if subsample != (1, 1)'
raise
ValueError
(
'shape must be given if subsample != (1, 1)'
' or border_mode == "half"'
)
' or border_mode == "half"'
)
height_width
=
[
shape
[
0
],
shape
[
1
]]
height_width
=
[
shape
[
0
],
shape
[
1
]]
assert
shape
[
0
]
.
ndim
==
0
assert
shape
[
1
]
.
ndim
==
0
else
:
else
:
height_width
=
[]
height_width
=
[]
...
@@ -1201,6 +1203,9 @@ class GpuCorrMM_gradInputs(BaseGpuCorrMM):
...
@@ -1201,6 +1203,9 @@ class GpuCorrMM_gradInputs(BaseGpuCorrMM):
if
self
.
subsample
!=
(
1
,
1
)
and
shape
is
None
:
if
self
.
subsample
!=
(
1
,
1
)
and
shape
is
None
:
raise
ValueError
(
'shape must be given if subsample != (1, 1)'
)
raise
ValueError
(
'shape must be given if subsample != (1, 1)'
)
height_width
=
[
shape
[
0
],
shape
[
1
]]
if
self
.
subsample
!=
(
1
,
1
)
else
[]
height_width
=
[
shape
[
0
],
shape
[
1
]]
if
self
.
subsample
!=
(
1
,
1
)
else
[]
if
height_width
:
assert
shape
[
0
]
.
ndim
==
0
assert
shape
[
1
]
.
ndim
==
0
broadcastable
=
[
topgrad
.
type
.
broadcastable
[
0
],
kern
.
type
.
broadcastable
[
1
],
broadcastable
=
[
topgrad
.
type
.
broadcastable
[
0
],
kern
.
type
.
broadcastable
[
1
],
False
,
False
]
False
,
False
]
...
...
theano/sandbox/cuda/cuda_ndarray.cu
浏览文件 @
8a736df5
...
@@ -3066,6 +3066,12 @@ PyObject *CudaNdarray_repr(PyObject *self)
...
@@ -3066,6 +3066,12 @@ PyObject *CudaNdarray_repr(PyObject *self)
")"
);
")"
);
Py_DECREF
(
str
);
Py_DECREF
(
str
);
Py_DECREF
(
np_object
);
Py_DECREF
(
np_object
);
#if PY_MAJOR_VERSION >= 3
// In Python 3 PyString_FromFormat return a Bytes object
PyObject
*
out2
=
PyObject_Str
(
out
);
Py_DECREF
(
out
);
return
out2
;
#endif
return
out
;
return
out
;
}
}
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
8a736df5
...
@@ -2767,10 +2767,11 @@ def local_abstractconv_gemm(node):
...
@@ -2767,10 +2767,11 @@ def local_abstractconv_gemm(node):
# GpuConv does not always store information on the batchsize and
# GpuConv does not always store information on the batchsize and
# channels, though, so we only use what information we have.)
# channels, though, so we only use what information we have.)
if
((
subsample
==
(
1
,
1
))
and
if
((
subsample
==
(
1
,
1
))
and
(
node
.
op
.
imshp
is
not
None
)
and
(
node
.
op
.
imshp
is
not
None
)
and
(
None
not
in
node
.
op
.
imshp
[
-
2
:])
and
(
None
not
in
node
.
op
.
imshp
[
-
2
:])
and
(
node
.
op
.
kshp
is
not
None
)
and
(
node
.
op
.
kshp
is
not
None
)
and
(
None
not
in
node
.
op
.
kshp
)):
(
None
not
in
node
.
op
.
kshp
)
and
border_mode
!=
"half"
):
# we know the kernel and output size
# we know the kernel and output size
prod1
=
node
.
op
.
kshp
[
0
]
*
node
.
op
.
kshp
[
1
]
prod1
=
node
.
op
.
kshp
[
0
]
*
node
.
op
.
kshp
[
1
]
prod2
=
((
node
.
op
.
imshp
[
-
2
]
-
node
.
op
.
kshp
[
0
]
+
1
)
*
prod2
=
((
node
.
op
.
imshp
[
-
2
]
-
node
.
op
.
kshp
[
0
]
+
1
)
*
...
...
theano/sandbox/cuda/tests/test_opt.py
浏览文件 @
8a736df5
...
@@ -859,6 +859,20 @@ class Test_GpuReshape(test_opt.Test_Reshape):
...
@@ -859,6 +859,20 @@ class Test_GpuReshape(test_opt.Test_Reshape):
self
.
op
=
basic_ops
.
GpuReshape
self
.
op
=
basic_ops
.
GpuReshape
def
test_local_abstractconv_gemm
():
""" We test it here as this is the optimization only that we test.
This test gh-4036"""
image
=
tensor
.
ftensor4
()
W
=
tensor
.
ftensor4
()
conv
=
tensor
.
nnet
.
conv2d
(
image
,
W
,
input_shape
=
(
1
,
32
,
32
,
32
),
filter_shape
=
(
32
,
32
,
3
,
3
),
border_mode
=
'half'
)
f
=
theano
.
function
([
image
,
W
],
[
conv
],
mode
=
mode_with_gpu
)
f
(
numpy
.
random
.
rand
(
1
,
32
,
32
,
32
)
.
astype
(
'float32'
),
numpy
.
random
.
rand
(
32
,
32
,
3
,
3
)
.
astype
(
'float32'
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test_gpualloc
()
test_gpualloc
()
test_opt_gpujoin_onlyajoin
()
test_opt_gpujoin_onlyajoin
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论