Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
852114f3
提交
852114f3
authored
7月 23, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pep8
上级
ac850ee6
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
8 行删除
+10
-8
subtensor.py
theano/tensor/subtensor.py
+10
-8
没有找到文件。
theano/tensor/subtensor.py
浏览文件 @
852114f3
...
@@ -1296,7 +1296,7 @@ class IncSubtensor(Op):
...
@@ -1296,7 +1296,7 @@ class IncSubtensor(Op):
**
helper_args
**
helper_args
)
)
#Make a view on the output, as we will write into it.
#
Make a view on the output, as we will write into it.
alloc_zview
=
self
.
make_view_array
(
z
,
view_ndim
)
alloc_zview
=
self
.
make_view_array
(
z
,
view_ndim
)
build_view
=
"""
build_view
=
"""
...
@@ -1545,7 +1545,8 @@ class AdvancedSubtensor1(Op):
...
@@ -1545,7 +1545,8 @@ class AdvancedSubtensor1(Op):
if
not
numpy
.
can_cast
(
i
.
dtype
,
numpy
.
intp
):
if
not
numpy
.
can_cast
(
i
.
dtype
,
numpy
.
intp
):
# Check if there was actually an incorrect conversion
# Check if there was actually an incorrect conversion
if
numpy
.
any
(
i
!=
i_
):
if
numpy
.
any
(
i
!=
i_
):
raise
IndexError
(
'index contains values that are bigger '
raise
IndexError
(
'index contains values that are bigger '
'than the maximum array size on this system.'
,
i
)
'than the maximum array size on this system.'
,
i
)
i
=
i_
i
=
i_
...
@@ -1737,7 +1738,8 @@ class AdvancedIncSubtensor1(Op):
...
@@ -1737,7 +1738,8 @@ class AdvancedIncSubtensor1(Op):
opname
=
'set'
opname
=
'set'
else
:
else
:
opname
=
'increment'
opname
=
'increment'
raise
TypeError
(
'cannot
%
s x subtensor with ndim=
%
s'
raise
TypeError
(
'cannot
%
s x subtensor with ndim=
%
s'
' by y with ndim=
%
s to x subtensor with ndim=
%
s '
%
(
' by y with ndim=
%
s to x subtensor with ndim=
%
s '
%
(
opname
,
x_
.
type
.
ndim
,
y_
.
type
.
ndim
))
opname
,
x_
.
type
.
ndim
,
y_
.
type
.
ndim
))
...
@@ -1842,7 +1844,7 @@ def adv_index_broadcastable_pattern(a, idx):
...
@@ -1842,7 +1844,7 @@ def adv_index_broadcastable_pattern(a, idx):
newidx
=
tuple
(
map
(
replace_slice
,
idx
))
newidx
=
tuple
(
map
(
replace_slice
,
idx
))
#2 - True = 1; 2 - False = 2
#
2 - True = 1; 2 - False = 2
fakeshape
=
[
2
-
bc
for
bc
in
a
.
broadcastable
]
fakeshape
=
[
2
-
bc
for
bc
in
a
.
broadcastable
]
retshape
=
numpy
.
empty
(
fakeshape
)[
newidx
]
.
shape
retshape
=
numpy
.
empty
(
fakeshape
)[
newidx
]
.
shape
return
tuple
([
dim
==
1
for
dim
in
retshape
])
return
tuple
([
dim
==
1
for
dim
in
retshape
])
...
@@ -1907,8 +1909,6 @@ class AdvancedSubtensor(Op):
...
@@ -1907,8 +1909,6 @@ class AdvancedSubtensor(Op):
'are too big (>= 2^32 elements). It is possible that '
'are too big (>= 2^32 elements). It is possible that '
'out[0] (
%
s), with shape
%
s, is not correctly filled.'
'out[0] (
%
s), with shape
%
s, is not correctly filled.'
%
(
out
[
0
],
out
[
0
]
.
shape
))
%
(
out
[
0
],
out
[
0
]
.
shape
))
# return
#raise NotImplementedError()
def
connection_pattern
(
self
,
node
):
def
connection_pattern
(
self
,
node
):
...
@@ -1961,7 +1961,8 @@ class AdvancedIncSubtensor(Op):
...
@@ -1961,7 +1961,8 @@ class AdvancedIncSubtensor(Op):
def
__str__
(
self
):
def
__str__
(
self
):
return
"
%
s{
%
s,
%
s}"
%
(
self
.
__class__
.
__name__
,
return
"
%
s{
%
s,
%
s}"
%
(
self
.
__class__
.
__name__
,
"inplace="
+
str
(
self
.
inplace
),
"inplace="
+
str
(
self
.
inplace
),
" set_instead_of_inc="
+
str
(
self
.
set_instead_of_inc
))
" set_instead_of_inc="
+
str
(
self
.
set_instead_of_inc
))
def
make_node
(
self
,
x
,
y
,
*
inputs
):
def
make_node
(
self
,
x
,
y
,
*
inputs
):
x
=
theano
.
tensor
.
as_tensor_variable
(
x
)
x
=
theano
.
tensor
.
as_tensor_variable
(
x
)
...
@@ -2004,7 +2005,8 @@ class AdvancedIncSubtensor(Op):
...
@@ -2004,7 +2005,8 @@ class AdvancedIncSubtensor(Op):
return
gof
.
Apply
(
op
,
return
gof
.
Apply
(
op
,
(
x
,
y
)
+
inputs
,
(
x
,
y
)
+
inputs
,
[
theano
.
tensor
.
tensor
(
dtype
=
x
.
type
.
dtype
,
[
theano
.
tensor
.
tensor
(
dtype
=
x
.
type
.
dtype
,
broadcastable
=
x
.
type
.
broadcastable
)])
broadcastable
=
x
.
type
.
broadcastable
)])
def
perform
(
self
,
node
,
inputs
,
out_
):
def
perform
(
self
,
node
,
inputs
,
out_
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论