Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8ddca387
提交
8ddca387
authored
8月 15, 2012
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix DebugMode to accept numpy.memmap.
Mention memmap in the documentation.
上级
456fa6b4
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
12 行增加
和
10 行删除
+12
-10
basic.txt
doc/library/tensor/basic.txt
+2
-1
debugmode.py
theano/compile/debugmode.py
+9
-8
elemwise.py
theano/tensor/elemwise.py
+1
-1
没有找到文件。
doc/library/tensor/basic.txt
浏览文件 @
8ddca387
...
@@ -300,7 +300,8 @@ TensorType and TensorVariable
...
@@ -300,7 +300,8 @@ TensorType and TensorVariable
.. class:: TensorType(Type)
.. class:: TensorType(Type)
The Type class used to mark Variables that stand for `numpy.ndarray`
The Type class used to mark Variables that stand for `numpy.ndarray`
values. Recalling to the tutorial, the purple box in
values (`numpy.memmap`, which is a subclass of `numpy.ndarray`, is also allowed).
Recalling to the tutorial, the purple box in
:ref:`the tutorial's graph-structure figure <tutorial-graphfigure>` is an instance of this class.
:ref:`the tutorial's graph-structure figure <tutorial-graphfigure>` is an instance of this class.
.. attribute:: broadcastable
.. attribute:: broadcastable
...
...
theano/compile/debugmode.py
浏览文件 @
8ddca387
...
@@ -870,17 +870,18 @@ def _lessbroken_deepcopy(a):
...
@@ -870,17 +870,18 @@ def _lessbroken_deepcopy(a):
"""
"""
:param a: any object
:param a: any object
Returns a copy of `a` that shares no internal storage with the original. A deep copy.
Returns a copy of `a` that shares no internal storage with the original.
This function handles numpy arrays specially to avoid some bug I had one time... (possibly
A deep copy.
about copying 0-d arrays?)
This function handles numpy arrays specially, because copy.deepcopy()
called on a 0-d array will return a numpy scalar, not an array.
"""
"""
# this exists because
numpy copies are
broken
# this exists because
copy.deepcopy on numpy arrays is
broken
if
type
(
a
)
i
s
numpy
.
ndarray
:
if
type
(
a
)
i
n
(
numpy
.
ndarray
,
numpy
.
memmap
)
:
rval
=
numpy
.
array
(
a
,
copy
=
True
,
dtype
=
a
.
dtype
)
rval
=
a
.
copy
(
)
else
:
else
:
rval
=
copy
.
deepcopy
(
a
)
rval
=
copy
.
deepcopy
(
a
)
assert
type
(
rval
)
==
type
(
a
)
assert
type
(
rval
)
==
type
(
a
)
,
(
type
(
rval
),
type
(
a
))
if
isinstance
(
rval
,
numpy
.
ndarray
):
if
isinstance
(
rval
,
numpy
.
ndarray
):
assert
rval
.
dtype
==
a
.
dtype
assert
rval
.
dtype
==
a
.
dtype
return
rval
return
rval
...
@@ -1992,7 +1993,7 @@ class _Linker(gof.link.LocalLinker):
...
@@ -1992,7 +1993,7 @@ class _Linker(gof.link.LocalLinker):
if
r
.
owner
is
None
:
if
r
.
owner
is
None
:
assert
r
in
fgraph
.
inputs
assert
r
in
fgraph
.
inputs
#HACK TO LOOK LIKE A REAL DESTRUCTIVE ACTION TOOK PLACE
#HACK TO LOOK LIKE A REAL DESTRUCTIVE ACTION TOOK PLACE
if
type
(
dr_vals
[
r
][
0
])
i
s
numpy
.
ndarray
\
if
type
(
dr_vals
[
r
][
0
])
i
n
(
numpy
.
ndarray
,
numpy
.
memmap
)
\
and
dr_vals
[
r
][
0
]
.
dtype
==
storage_map
[
r
][
0
]
.
dtype
\
and
dr_vals
[
r
][
0
]
.
dtype
==
storage_map
[
r
][
0
]
.
dtype
\
and
dr_vals
[
r
][
0
]
.
shape
==
storage_map
[
r
][
0
]
.
shape
:
and
dr_vals
[
r
][
0
]
.
shape
==
storage_map
[
r
][
0
]
.
shape
:
if
len
(
dr_vals
[
r
][
0
]
.
shape
):
if
len
(
dr_vals
[
r
][
0
]
.
shape
):
...
...
theano/tensor/elemwise.py
浏览文件 @
8ddca387
...
@@ -218,7 +218,7 @@ class DimShuffle(Op):
...
@@ -218,7 +218,7 @@ class DimShuffle(Op):
storage
,
=
out
storage
,
=
out
# drop
# drop
res
=
input
res
=
input
if
type
(
res
)
!=
numpy
.
ndarray
:
if
type
(
res
)
!=
numpy
.
ndarray
and
type
(
res
)
!=
numpy
.
memmap
:
raise
TypeError
(
res
)
raise
TypeError
(
res
)
shape
=
list
(
res
.
shape
)
shape
=
list
(
res
.
shape
)
for
drop
in
reversed
(
self
.
drop
):
for
drop
in
reversed
(
self
.
drop
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论