Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ed819309
提交
ed819309
authored
4月 02, 2012
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use setitem syntax for assigning on gpu array
The += syntax is not implemented for dims > 5. Also actually use a tensor of wrong size in "wrong_size" mode.
上级
fb585866
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
8 行增加
和
6 行删除
+8
-6
debugmode.py
theano/compile/debugmode.py
+8
-6
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
ed819309
...
@@ -1004,11 +1004,12 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
...
@@ -1004,11 +1004,12 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
from
theano.sandbox.cuda
import
CudaNdarray
from
theano.sandbox.cuda
import
CudaNdarray
from
theano.sandbox.cuda
import
dimshuffle
as
cuda_dimshuffle
from
theano.sandbox.cuda
import
dimshuffle
as
cuda_dimshuffle
# TODO: Sparse
, Scalar
# TODO: Sparse
? Scalar does not really make sense.
# reuse_output: use a copy of the same storage returned the first time
# reuse_output: use a copy of the same storage returned the first time
# TODO: optimization warning if the storage in reuse_outputs
# TODO: optimization warning if the storage in reuse_outputs
# is not reused
# is not reused
# TODO: skip all this for outputs that actually worked inplace
if
'previous'
in
prealloc_modes
or
'ALL'
in
prealloc_modes
:
if
'previous'
in
prealloc_modes
or
'ALL'
in
prealloc_modes
:
reuse_outputs
=
{}
reuse_outputs
=
{}
for
r
in
node
.
outputs
:
for
r
in
node
.
outputs
:
...
@@ -1032,7 +1033,7 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
...
@@ -1032,7 +1033,7 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
new_buf
=
r
.
type
.
value_zeros
(
r_vals
[
r
]
.
shape
)
new_buf
=
r
.
type
.
value_zeros
(
r_vals
[
r
]
.
shape
)
# CudaNdarray don't have flags field
# CudaNdarray don't have flags field
# assert new_buf.flags["C_CONTIGUOUS"]
# assert new_buf.flags["C_CONTIGUOUS"]
new_buf
+
=
numpy
.
asarray
(
def_val
)
.
astype
(
r
.
type
.
dtype
)
new_buf
[
...
]
=
numpy
.
asarray
(
def_val
)
.
astype
(
r
.
type
.
dtype
)
c_cont_outputs
[
r
]
=
new_buf
c_cont_outputs
[
r
]
=
new_buf
...
@@ -1050,7 +1051,7 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
...
@@ -1050,7 +1051,7 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
shape
=
r_vals
[
r
]
.
shape
,
shape
=
r_vals
[
r
]
.
shape
,
dtype
=
r_vals
[
r
]
.
dtype
,
dtype
=
r_vals
[
r
]
.
dtype
,
order
=
'F'
)
order
=
'F'
)
new_buf
+
=
def_val
new_buf
[
...
]
=
def_val
if
isinstance
(
r
.
type
,
CudaNdarrayType
):
if
isinstance
(
r
.
type
,
CudaNdarrayType
):
# When the CudaNdarray is built, the underlying memory
# When the CudaNdarray is built, the underlying memory
# is c-contiguous, so we transpose it before and after.
# is c-contiguous, so we transpose it before and after.
...
@@ -1096,6 +1097,7 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
...
@@ -1096,6 +1097,7 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
else
:
else
:
buf_shape
.
append
(
s
*
2
)
buf_shape
.
append
(
s
*
2
)
new_buf
=
r
.
type
.
value_zeros
(
buf_shape
)
new_buf
=
r
.
type
.
value_zeros
(
buf_shape
)
new_buf
[
...
]
=
numpy
.
asarray
(
def_val
)
.
astype
(
r
.
type
.
dtype
)
init_strided
[
r
]
=
new_buf
init_strided
[
r
]
=
new_buf
step_signs_list
=
[]
step_signs_list
=
[]
...
@@ -1125,7 +1127,6 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
...
@@ -1125,7 +1127,6 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
assert
r_buf
.
shape
==
r_vals
[
r
]
.
shape
assert
r_buf
.
shape
==
r_vals
[
r
]
.
shape
r_buf
[
...
]
=
numpy
.
asarray
(
def_val
)
.
astype
(
r_buf
.
dtype
)
r_buf
[
...
]
=
numpy
.
asarray
(
def_val
)
.
astype
(
r_buf
.
dtype
)
strided
[
r
]
=
r_buf
strided
[
r
]
=
r_buf
yield
(
name
,
strided
)
yield
(
name
,
strided
)
...
@@ -1151,8 +1152,9 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
...
@@ -1151,8 +1152,9 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
out_shape
=
[
max
((
s
+
sd
),
0
)
out_shape
=
[
max
((
s
+
sd
),
0
)
for
s
,
sd
in
zip
(
r_vals
[
r
]
.
shape
,
for
s
,
sd
in
zip
(
r_vals
[
r
]
.
shape
,
r_shape_diff
)]
r_shape_diff
)]
new_buf
=
r
.
type
.
value_zeros
(
r_vals
[
r
]
.
shape
)
new_buf
=
r
.
type
.
value_zeros
(
out_shape
)
new_buf
+=
numpy
.
asarray
(
def_val
)
.
astype
(
r
.
type
.
dtype
)
new_buf
[
...
]
=
numpy
.
asarray
(
def_val
)
.
astype
(
r
.
type
.
dtype
)
wrong_size
[
r
]
=
new_buf
wrong_size
[
r
]
=
new_buf
yield
(
name
,
wrong_size
)
yield
(
name
,
wrong_size
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论