Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
641c47b8
提交
641c47b8
authored
8月 21, 2009
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
差异文件
merge
上级
cc5593fe
d3f74a76
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
24 行删除
+14
-24
test_function.py
theano/compile/tests/test_function.py
+1
-1
basic.py
theano/tensor/basic.py
+13
-23
没有找到文件。
theano/compile/tests/test_function.py
浏览文件 @
641c47b8
...
@@ -279,7 +279,7 @@ class T_function(unittest.TestCase):
...
@@ -279,7 +279,7 @@ class T_function(unittest.TestCase):
a
=
T
.
dmatrix
()
a
=
T
.
dmatrix
()
f
=
function
([
a
],
Out
(
a
,
borrow
=
False
))
f
=
function
([
a
],
Out
(
a
,
borrow
=
False
))
o
=
N
.
ones
((
3
,
3
))
o
=
N
.
ones
((
3
,
3
))
assert
o
is
not
f
(
o
)
assert
o
is
f
(
o
)
#borrow does not imply copy.
class
T_picklefunction
(
unittest
.
TestCase
):
class
T_picklefunction
(
unittest
.
TestCase
):
...
...
theano/tensor/basic.py
浏览文件 @
641c47b8
...
@@ -1627,19 +1627,20 @@ class Subtensor(Op):
...
@@ -1627,19 +1627,20 @@ class Subtensor(Op):
# for entry in self.idx_list)
# for entry in self.idx_list)
return
hash
(
idx_list
)
return
hash
(
idx_list
)
@staticmethod
def
str_from_slice
(
entry
):
msg
=
[]
for
x
in
[
entry
.
start
,
entry
.
stop
,
entry
.
step
]:
if
x
is
None
:
msg
.
append
(
""
)
else
:
msg
.
append
(
str
(
x
))
return
":"
.
join
(
msg
)
def
__str__
(
self
):
def
__str__
(
self
):
indices
=
[]
indices
=
[]
for
entry
in
self
.
idx_list
:
for
entry
in
self
.
idx_list
:
if
isinstance
(
entry
,
slice
):
if
isinstance
(
entry
,
slice
):
msg
=
[]
indices
.
append
(
self
.
str_from_slice
(
entry
))
for
x
in
[
entry
.
start
,
entry
.
stop
,
entry
.
step
]:
if
x
is
None
:
msg
+=
""
else
:
msg
+=
[
str
(
x
)]
indices
.
append
(
":"
.
join
(
msg
))
#backport
#indices.append(":".join("" if x is None else str(x) for x in [entry.start, entry.stop, entry.step]))
else
:
else
:
indices
.
append
(
str
(
entry
))
indices
.
append
(
str
(
entry
))
return
"
%
s{
%
s}"
%
(
self
.
__class__
.
__name__
,
", "
.
join
(
indices
))
return
"
%
s{
%
s}"
%
(
self
.
__class__
.
__name__
,
", "
.
join
(
indices
))
...
@@ -1731,24 +1732,13 @@ class SetSubtensor(Op):
...
@@ -1731,24 +1732,13 @@ class SetSubtensor(Op):
indices
=
[]
indices
=
[]
for
entry
in
self
.
idx_list
:
for
entry
in
self
.
idx_list
:
if
isinstance
(
entry
,
slice
):
if
isinstance
(
entry
,
slice
):
msg
=
[]
indices
.
append
(
Subtensor
.
str_from_slice
(
entry
))
for
x
in
[
entry
.
start
,
entry
.
stop
,
entry
.
step
]:
if
x
is
None
:
msg
+=
""
else
:
msg
+=
[
str
(
x
)]
indices
.
append
(
":"
.
join
(
msg
))
#backport
#indices.append(":".join("" if x is None else str(x) for x in [entry.start, entry.stop, entry.step]))
else
:
else
:
indices
.
append
(
str
(
entry
))
indices
.
append
(
str
(
entry
))
if
self
.
inplace
:
if
self
.
inplace
:
msg
=
'Inplace'
msg
=
'Inplace'
else
:
else
:
msg
=
''
msg
=
''
#backport
#return "%s%s{%s}" % ('Inplace' if self.inplace else '',
return
"
%
s
%
s{
%
s}"
%
(
msg
,
return
"
%
s
%
s{
%
s}"
%
(
msg
,
self
.
__class__
.
__name__
,
", "
.
join
(
indices
))
self
.
__class__
.
__name__
,
", "
.
join
(
indices
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论