Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
57c18f12
提交
57c18f12
authored
7月 09, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pep8
上级
60e0121a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
11 行删除
+12
-11
opt.py
theano/sandbox/gpuarray/opt.py
+12
-11
没有找到文件。
theano/sandbox/gpuarray/opt.py
浏览文件 @
57c18f12
...
@@ -316,6 +316,7 @@ def local_gpuajoin_1(node):
...
@@ -316,6 +316,7 @@ def local_gpuajoin_1(node):
len
(
node
.
inputs
)
==
2
):
len
(
node
.
inputs
)
==
2
):
return
[
node
.
inputs
[
1
]]
return
[
node
.
inputs
[
1
]]
@register_opt
()
@register_opt
()
@op_lifter
([
tensor
.
Split
])
@op_lifter
([
tensor
.
Split
])
def
local_gpua_split
(
node
):
def
local_gpua_split
(
node
):
...
@@ -334,7 +335,7 @@ def local_gpua_incsubtensor(node):
...
@@ -334,7 +335,7 @@ def local_gpua_incsubtensor(node):
return
GpuIncSubtensor
(
node
.
op
.
idx_list
,
node
.
op
.
inplace
,
return
GpuIncSubtensor
(
node
.
op
.
idx_list
,
node
.
op
.
inplace
,
node
.
op
.
set_instead_of_inc
,
node
.
op
.
set_instead_of_inc
,
node
.
op
.
destroyhandler_tolerate_aliased
)
node
.
op
.
destroyhandler_tolerate_aliased
)
@register_opt
()
@register_opt
()
@op_lifter
([
tensor
.
AdvancedIncSubtensor1
])
@op_lifter
([
tensor
.
AdvancedIncSubtensor1
])
...
@@ -371,8 +372,8 @@ def local_gpua_careduce(node):
...
@@ -371,8 +372,8 @@ def local_gpua_careduce(node):
dtype
=
getattr
(
node
.
op
,
'dtype'
,
None
),
dtype
=
getattr
(
node
.
op
,
'dtype'
,
None
),
acc_dtype
=
getattr
(
node
.
op
,
'acc_dtype'
,
None
))
acc_dtype
=
getattr
(
node
.
op
,
'acc_dtype'
,
None
))
gvar
=
greduce
(
x
)
gvar
=
greduce
(
x
)
#We need to have the make node called, otherwise the mask can
#
We need to have the make node called, otherwise the mask can
#be None
#
be None
if
gvar
.
owner
.
op
.
supports_c_code
([
gpu_from_host
(
x
)]):
if
gvar
.
owner
.
op
.
supports_c_code
([
gpu_from_host
(
x
)]):
return
greduce
return
greduce
else
:
else
:
...
@@ -415,8 +416,8 @@ def local_gpua_careduce(node):
...
@@ -415,8 +416,8 @@ def local_gpua_careduce(node):
reshaped_x
=
x
.
reshape
(
tensor
.
stack
(
*
new_in_shp
))
reshaped_x
=
x
.
reshape
(
tensor
.
stack
(
*
new_in_shp
))
gpu_reshaped_x
=
gpu_from_host
(
reshaped_x
)
gpu_reshaped_x
=
gpu_from_host
(
reshaped_x
)
gvar
=
greduce
(
gpu_reshaped_x
)
gvar
=
greduce
(
gpu_reshaped_x
)
#We need to have the make node called, otherwise the mask can
#
We need to have the make node called, otherwise the mask can
#be None
#
be None
reshaped_gpu_inputs
=
[
gpu_reshaped_x
]
reshaped_gpu_inputs
=
[
gpu_reshaped_x
]
if
new_greduce
.
supports_c_code
(
reshaped_gpu_inputs
):
if
new_greduce
.
supports_c_code
(
reshaped_gpu_inputs
):
reduce_reshaped_x
=
host_from_gpu
(
reduce_reshaped_x
=
host_from_gpu
(
...
@@ -497,8 +498,8 @@ def local_gpu_conv(node):
...
@@ -497,8 +498,8 @@ def local_gpu_conv(node):
if
op
.
kshp_logical
is
not
None
and
op
.
kshp_logical
!=
op
.
kshp
:
if
op
.
kshp_logical
is
not
None
and
op
.
kshp_logical
!=
op
.
kshp
:
return
None
return
None
#print op.kshp, op.imshp[1:3]
#
print op.kshp, op.imshp[1:3]
#print op.kshp_logical, logical_img_hw
#
print op.kshp_logical, logical_img_hw
ret
=
GpuConv
(
border_mode
=
op
.
out_mode
,
ret
=
GpuConv
(
border_mode
=
op
.
out_mode
,
subsample
=
(
op
.
dx
,
op
.
dy
),
subsample
=
(
op
.
dx
,
op
.
dy
),
logical_img_hw
=
logical_img_hw
,
logical_img_hw
=
logical_img_hw
,
...
@@ -508,12 +509,12 @@ def local_gpu_conv(node):
...
@@ -508,12 +509,12 @@ def local_gpu_conv(node):
version
=
op
.
version
,
version
=
op
.
version
,
verbose
=
op
.
verbose
,
verbose
=
op
.
verbose
,
imshp
=
op
.
imshp
,
imshp
=
op
.
imshp
,
)
)
if
op
.
imshp_logical
is
not
None
:
if
op
.
imshp_logical
is
not
None
:
logical_img_hw
=
op
.
imshp_logical
[
1
:
3
]
logical_img_hw
=
op
.
imshp_logical
[
1
:
3
]
if
logical_img_hw
!=
op
.
imshp
[
1
:
3
]:
if
logical_img_hw
!=
op
.
imshp
[
1
:
3
]:
# this case is not implemented
# this case is not implemented
#return None
#
return None
rstride
=
int
(
numpy
.
ceil
(
op
.
imshp_logical
[
1
]
/
rstride
=
int
(
numpy
.
ceil
(
op
.
imshp_logical
[
1
]
/
float
(
op
.
imshp
[
1
])))
float
(
op
.
imshp
[
1
])))
cstride
=
int
(
numpy
.
ceil
(
op
.
imshp_logical
[
2
]
/
cstride
=
int
(
numpy
.
ceil
(
op
.
imshp_logical
[
2
]
/
...
@@ -542,7 +543,7 @@ def local_gpu_conv(node):
...
@@ -542,7 +543,7 @@ def local_gpu_conv(node):
assert
a
.
ndim
==
4
assert
a
.
ndim
==
4
atol
=
None
atol
=
None
if
a
.
shape
[
-
1
]
*
a
.
shape
[
-
2
]
>
100
:
if
a
.
shape
[
-
1
]
*
a
.
shape
[
-
2
]
>
100
:
#For float32 the default atol is 1e-5
#
For float32 the default atol is 1e-5
atol
=
3e-5
atol
=
3e-5
return
GpuArrayType
.
values_eq_approx
(
a
,
b
,
atol
=
atol
)
return
GpuArrayType
.
values_eq_approx
(
a
,
b
,
atol
=
atol
)
...
@@ -557,7 +558,7 @@ def local_gpu_conv(node):
...
@@ -557,7 +558,7 @@ def local_gpu_conv(node):
out
=
tensor
.
patternbroadcast
(
out
=
tensor
.
patternbroadcast
(
host_from_gpu
(
out
),
host_from_gpu
(
out
),
node
.
outputs
[
0
]
.
broadcastable
)
node
.
outputs
[
0
]
.
broadcastable
)
#op_lifter want the output on the GPU.
#
op_lifter want the output on the GPU.
out
=
gpu_from_host
(
out
)
out
=
gpu_from_host
(
out
)
out
.
values_eq_approx
=
values_eq_approx
out
.
values_eq_approx
=
values_eq_approx
return
[
out
]
return
[
out
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论