Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9a9e873b
提交
9a9e873b
authored
7月 04, 2016
作者:
sentient07
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Generalized filter dialation parameter and reverted a change
上级
6701568f
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
8 行增加
和
22 行删除
+8
-22
basic_ops.py
theano/gpuarray/basic_ops.py
+1
-16
dnn.py
theano/gpuarray/dnn.py
+2
-2
extra_ops.py
theano/gpuarray/extra_ops.py
+1
-1
opt.py
theano/gpuarray/opt.py
+2
-3
test_abstractconv.py
theano/gpuarray/tests/test_abstractconv.py
+2
-0
没有找到文件。
theano/gpuarray/basic_ops.py
浏览文件 @
9a9e873b
...
@@ -973,22 +973,7 @@ def empty_like(var):
...
@@ -973,22 +973,7 @@ def empty_like(var):
return
GpuAllocEmpty
(
var
.
type
.
dtype
,
var
.
type
.
context_name
)(
*
var
.
shape
)
return
GpuAllocEmpty
(
var
.
type
.
dtype
,
var
.
type
.
context_name
)(
*
var
.
shape
)
def
gpu_alloc_empty
(
ctx
,
**
kwargs
):
def
gpu_alloc_empty
(
ctx
,
dtype
):
'''
This is the cache method of GpuAllocEmpty class.
This takes the parameters of context name and props_dict
and retrieves the dtype key from the dictionary
Parameters
----------
ctx : String
The context name.
kwargs : Dict
The props_dict of the Op
'''
dtype
=
kwargs
.
get
(
'dtype'
)
key
=
(
dtype
,
ctx
)
key
=
(
dtype
,
ctx
)
if
key
not
in
gpu_alloc_empty
.
cache
:
if
key
not
in
gpu_alloc_empty
.
cache
:
gpu_alloc_empty
.
cache
[
key
]
=
GpuAllocEmpty
(
dtype
,
ctx
)
gpu_alloc_empty
.
cache
[
key
]
=
GpuAllocEmpty
(
dtype
,
ctx
)
...
...
theano/gpuarray/dnn.py
浏览文件 @
9a9e873b
...
@@ -956,8 +956,8 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1),
...
@@ -956,8 +956,8 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1),
shape2
=
shape_i
(
img
,
2
,
fgraph
)
+
shape_i
(
kerns
,
2
,
fgraph
)
-
1
shape2
=
shape_i
(
img
,
2
,
fgraph
)
+
shape_i
(
kerns
,
2
,
fgraph
)
-
1
shape3
=
shape_i
(
img
,
3
,
fgraph
)
+
shape_i
(
kerns
,
3
,
fgraph
)
-
1
shape3
=
shape_i
(
img
,
3
,
fgraph
)
+
shape_i
(
kerns
,
3
,
fgraph
)
-
1
out
=
gpu_alloc_empty
(
ctx_name
,
dtype
=
img
.
dtype
)(
shape_i
(
img
,
0
,
fgraph
),
out
=
gpu_alloc_empty
(
ctx_name
,
dtype
=
img
.
dtype
)(
shape_i
(
img
,
0
,
fgraph
),
shape_i
(
kerns
,
1
,
fgraph
),
shape_i
(
kerns
,
1
,
fgraph
),
shape2
,
shape3
)
shape2
,
shape3
)
desc
=
GpuDnnConvDesc
(
border_mode
=
'valid'
,
subsample
=
(
1
,
1
),
desc
=
GpuDnnConvDesc
(
border_mode
=
'valid'
,
subsample
=
(
1
,
1
),
conv_mode
=
conv_mode
,
precision
=
precision
)(
kerns
.
shape
)
conv_mode
=
conv_mode
,
precision
=
precision
)(
kerns
.
shape
)
return
gpu_dnn_conv_gradI
()(
kerns
,
img
,
out
,
desc
)
return
gpu_dnn_conv_gradI
()(
kerns
,
img
,
out
,
desc
)
...
...
theano/gpuarray/extra_ops.py
浏览文件 @
9a9e873b
...
@@ -2,7 +2,6 @@ from __future__ import absolute_import, print_function, division
...
@@ -2,7 +2,6 @@ from __future__ import absolute_import, print_function, division
import
os
import
os
from
theano
import
Apply
,
Op
from
theano
import
Apply
,
Op
from
theano.tensor.extra_ops
import
CumsumOp
from
theano.tensor.extra_ops
import
CumsumOp
from
.type
import
GpuArrayType
from
.basic_ops
import
infer_context_name
from
.basic_ops
import
infer_context_name
try
:
try
:
from
pygpu
import
gpuarray
from
pygpu
import
gpuarray
...
@@ -42,6 +41,7 @@ class GpuCumsum(GpuKernelBase, Op):
...
@@ -42,6 +41,7 @@ class GpuCumsum(GpuKernelBase, Op):
assert
x
.
type
.
dtype
==
'float32'
,
"Only float32 supported for GpuCumSum"
assert
x
.
type
.
dtype
==
'float32'
,
"Only float32 supported for GpuCumSum"
context_name
=
infer_context_name
(
x
)
context_name
=
infer_context_name
(
x
)
x
=
as_gpuarray_variable
(
x
,
context_name
)
x
=
as_gpuarray_variable
(
x
,
context_name
)
if
x
.
ndim
>
GpuCumsum
.
SUPPORTED_NDIMS
:
if
x
.
ndim
>
GpuCumsum
.
SUPPORTED_NDIMS
:
...
...
theano/gpuarray/opt.py
浏览文件 @
9a9e873b
...
@@ -591,8 +591,7 @@ def local_gpuaalloc(op, context_name, inputs, outputs):
...
@@ -591,8 +591,7 @@ def local_gpuaalloc(op, context_name, inputs, outputs):
def
local_gpuaallocempty
(
op
,
context_name
,
inputs
,
outputs
):
def
local_gpuaallocempty
(
op
,
context_name
,
inputs
,
outputs
):
# We use _props_dict() to make sure that the GPU op know all the
# We use _props_dict() to make sure that the GPU op know all the
# CPU op props.
# CPU op props.
dtype
=
op
.
_props_dict
()
.
get
(
'dtype'
)
return
gpu_alloc_empty
(
context_name
,
**
op
.
_props_dict
())(
*
inputs
)
return
gpu_alloc_empty
(
context_name
,
dtype
=
dtype
)(
*
inputs
)
@register_opt
()
@register_opt
()
...
@@ -960,7 +959,7 @@ def local_gpua_incsubtensor(op, context_name, inputs, outputs):
...
@@ -960,7 +959,7 @@ def local_gpua_incsubtensor(op, context_name, inputs, outputs):
op
.
set_instead_of_inc
,
op
.
set_instead_of_inc
,
op
.
destroyhandler_tolerate_aliased
)
op
.
destroyhandler_tolerate_aliased
)
ret
=
op
(
*
inputs
)
ret
=
op
(
*
inputs
)
val
=
getattr
(
o
p
.
make_node
(
*
inputs
)
.
o
utputs
[
0
]
.
tag
,
'nan_guard_mode_check'
,
True
)
val
=
getattr
(
outputs
[
0
]
.
tag
,
'nan_guard_mode_check'
,
True
)
ret
.
tag
.
nan_guard_mode_check
=
val
ret
.
tag
.
nan_guard_mode_check
=
val
return
ret
return
ret
...
...
theano/gpuarray/tests/test_abstractconv.py
浏览文件 @
9a9e873b
...
@@ -26,9 +26,11 @@ class TestDnnConv2d(test_abstract_conv.BaseTestConv2d):
...
@@ -26,9 +26,11 @@ class TestDnnConv2d(test_abstract_conv.BaseTestConv2d):
if
not
dnn_available
(
test_ctx_name
):
if
not
dnn_available
(
test_ctx_name
):
raise
SkipTest
(
dnn_available
.
msg
)
raise
SkipTest
(
dnn_available
.
msg
)
mode
=
mode_with_gpu
mode
=
mode_with_gpu
if
fd
!=
(
1
,
1
):
if
fd
!=
(
1
,
1
):
raise
SkipTest
(
"Doesn't have CUDNN implementation"
)
raise
SkipTest
(
"Doesn't have CUDNN implementation"
)
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
,
fd
)
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
,
fd
)
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
verify_grad
=
True
,
mode
=
mode
,
verify_grad
=
True
,
mode
=
mode
,
provide_shape
=
provide_shape
,
border_mode
=
b
,
provide_shape
=
provide_shape
,
border_mode
=
b
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论