Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5992e548
提交
5992e548
authored
11月 01, 2011
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #178 from nouiz/important_fix2
Finish the fix to the change to ShapeFeature.
上级
599bdad6
f629d018
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
22 行增加
和
4 行删除
+22
-4
elemwise.py
theano/sandbox/cuda/elemwise.py
+4
-1
opt.py
theano/sandbox/cuda/opt.py
+9
-2
opt.py
theano/tensor/opt.py
+9
-1
没有找到文件。
theano/sandbox/cuda/elemwise.py
浏览文件 @
5992e548
...
...
@@ -815,10 +815,13 @@ nd_collapse_[i]=0;
"""
kernels
=
""
.
join
(
[
self
.
c_src_kernel
(
node
,
nodename
,
x
)
for
x
in
xrange
(
1
,
nd
+
1
)]
+
[
self
.
c_src_kernel_Ccontiguous
(
node
,
nodename
)]
,
+
[
self
.
c_src_kernel_Ccontiguous
(
node
,
nodename
)]
+
[
self
.
c_src_callkernel
(
node
,
nodename
)])
return
defines
+
kernels
def
c_support_code
(
self
):
raise
gof
.
utils
.
MethodNotDefined
()
def
c_code
(
self
,
node
,
nodename
,
inputs
,
outputs
,
sub
):
d
=
dict
(
sub
)
nd
=
node
.
outputs
[
0
]
.
type
.
ndim
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
5992e548
...
...
@@ -77,7 +77,7 @@ class InputToGpuOptimizer(Optimizer):
if
new_input
.
type
==
input
.
type
:
env
.
replace_validate
(
input
,
new_input
,
"InputToGpuOptimizer"
)
except
Exception
,
e
:
except
TypeError
,
e
:
#as we currently only support float32, this can fail.
#Using try except make that we won't need
pass
...
...
@@ -243,7 +243,12 @@ def local_gpu_dot_to_dot22(node):
A more suitable solution would be to use the right cublas call
"""
# In case the got do input upcast, we much check that we can
# make it run on the gpu.
if
node
.
op
==
gpu_from_host
:
if
node
.
outputs
[
0
]
.
type
.
dtype
!=
'float32'
:
return
False
host_input
=
node
.
inputs
[
0
]
if
host_input
.
owner
and
host_input
.
owner
.
op
==
tensor
.
basic
.
dot
:
x
,
y
=
host_input
.
owner
.
inputs
...
...
@@ -264,6 +269,8 @@ def local_gpu_dot_to_dot22(node):
return
[
GpuReshape
(
1
)(
gpu_dot22
(
gpu_x
,
gpu_y
),
shape_out
)]
if
node
.
op
==
tensor
.
basic
.
dot
:
if
node
.
outputs
[
0
]
.
type
.
dtype
!=
'float32'
:
return
False
if
numpy
.
any
([(
i
.
owner
and
i
.
owner
.
op
==
host_from_gpu
)
for
i
in
node
.
inputs
]):
x
,
y
=
node
.
inputs
if
_is_real_vector
(
x
)
and
_is_real_matrix
(
y
):
...
...
@@ -1267,7 +1274,7 @@ def gpu_scan_make_inplace(node):
n_outs
=
len
(
ls
)
for
idx
in
xrange
(
n_outs
):
if
ls
[
idx
]
in
ls
[:
idx
]:
ls
[
idx
]
=
deep_copy_op
(
ls
[
idx
])
ls
[
idx
]
=
compile
.
function_module
.
deep_copy_op
(
ls
[
idx
])
inputs
=
ls_begin
+
ls
+
ls_end
...
...
theano/tensor/opt.py
浏览文件 @
5992e548
...
...
@@ -922,9 +922,17 @@ class ShapeFeature(object):
self
.
set_shape
(
r
,
s
)
def
on_change_input
(
self
,
env
,
node
,
i
,
r
,
new_r
):
if
new_r
not
in
self
.
shape_of
:
# It happen that the env didn't called on_import for some
# new_r. This happen when new_r don't have an
# owner(i.e. it is a constant or an input of the graph)
# update_shape suppose that r and new_r are in shape_of.
self
.
init_r
(
new_r
)
# This tells us that r and new_r must have the same shape
# if we didn't know that the shapes are related, now we do.
self
.
update_shape
(
new_r
,
r
)
# We should give priority to new_r, so we put it last.
self
.
update_shape
(
r
,
new_r
)
# change_input happens in two cases:
# 1) we are trying to get rid of r, or
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论