Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b90976ee
提交
b90976ee
authored
7月 23, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix flake8 format of gpuarray/subtensor.py
上级
c0342e58
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
13 行删除
+10
-13
subtensor.py
theano/sandbox/gpuarray/subtensor.py
+10
-13
没有找到文件。
theano/sandbox/gpuarray/subtensor.py
浏览文件 @
b90976ee
...
@@ -4,7 +4,7 @@ import numpy
...
@@ -4,7 +4,7 @@ import numpy
import
os
import
os
import
theano
import
theano
from
theano
import
tensor
,
gof
,
Op
,
config
from
theano
import
tensor
,
gof
,
config
from
six.moves
import
StringIO
from
six.moves
import
StringIO
from
theano.tensor.subtensor
import
IncSubtensor
,
Subtensor
,
get_idx_list
from
theano.tensor.subtensor
import
IncSubtensor
,
Subtensor
,
get_idx_list
import
theano.tensor.inplace
import
theano.tensor.inplace
...
@@ -243,16 +243,16 @@ class GpuIncSubtensor(GpuKernelBase, IncSubtensor):
...
@@ -243,16 +243,16 @@ class GpuIncSubtensor(GpuKernelBase, IncSubtensor):
if
sub_x
.
shape
:
if
sub_x
.
shape
:
# we've sliced out an N-D tensor with N > 0
# we've sliced out an N-D tensor with N > 0
if
not
self
.
set_instead_of_inc
:
if
not
self
.
set_instead_of_inc
:
#sub_x += y
#
sub_x += y
pygpu
.
elemwise
.
ielemwise2
(
sub_x
,
'+'
,
y
,
broadcast
=
False
)
pygpu
.
elemwise
.
ielemwise2
(
sub_x
,
'+'
,
y
,
broadcast
=
False
)
else
:
else
:
#sub_x += -sub_x + y
#
sub_x += -sub_x + y
x
.
__setitem__
(
cdata
,
y
)
x
.
__setitem__
(
cdata
,
y
)
else
:
else
:
# scalar case
# scalar case
if
not
self
.
set_instead_of_inc
:
if
not
self
.
set_instead_of_inc
:
#x.__setitem__(cdata, sub_x + y)
#
x.__setitem__(cdata, sub_x + y)
tmp
=
pygpu
.
elemwise
.
elemwise2
(
sub_x
,
'+'
,
y
,
sub_x
,
tmp
=
pygpu
.
elemwise
.
elemwise2
(
sub_x
,
'+'
,
y
,
sub_x
,
broadcast
=
False
)
broadcast
=
False
)
x
.
__setitem__
(
cdata
,
tmp
)
x
.
__setitem__
(
cdata
,
tmp
)
else
:
else
:
...
@@ -261,9 +261,6 @@ class GpuIncSubtensor(GpuKernelBase, IncSubtensor):
...
@@ -261,9 +261,6 @@ class GpuIncSubtensor(GpuKernelBase, IncSubtensor):
def
__setstate__
(
self
,
d
):
def
__setstate__
(
self
,
d
):
self
.
__dict__
.
update
(
d
)
self
.
__dict__
.
update
(
d
)
owner
=
getattr
(
self
.
__dict__
,
"owner"
,
None
)
if
owner
:
op
.
create_iadd_node
(
owner
)
def
__getstate__
(
self
):
def
__getstate__
(
self
):
d
=
copy
.
copy
(
self
.
__dict__
)
d
=
copy
.
copy
(
self
.
__dict__
)
...
@@ -558,7 +555,7 @@ class GpuAdvancedIncSubtensor1(HideC, tensor.AdvancedIncSubtensor1):
...
@@ -558,7 +555,7 @@ class GpuAdvancedIncSubtensor1(HideC, tensor.AdvancedIncSubtensor1):
reshaped_y
=
y
.
reshape
(
y
.
shape
[
1
:])
reshaped_y
=
y
.
reshape
(
y
.
shape
[
1
:])
else
:
else
:
nb_dims_to_add
=
(
x
.
ndim
-
1
)
-
y
.
ndim
nb_dims_to_add
=
(
x
.
ndim
-
1
)
-
y
.
ndim
reshaped_y
=
y
.
reshape
((
1
,)
*
nb_dims_to_add
+
y
.
shape
)
reshaped_y
=
y
.
reshape
((
1
,)
*
nb_dims_to_add
+
y
.
shape
)
if
self
.
set_instead_of_inc
:
if
self
.
set_instead_of_inc
:
for
i
in
idx
:
for
i
in
idx
:
...
@@ -633,9 +630,9 @@ class GpuAdvancedIncSubtensor1_dev20(GpuKernelBase, GpuAdvancedIncSubtensor1):
...
@@ -633,9 +630,9 @@ class GpuAdvancedIncSubtensor1_dev20(GpuKernelBase, GpuAdvancedIncSubtensor1):
device_properties
=
theano
.
sandbox
.
cuda
.
device_properties
device_properties
=
theano
.
sandbox
.
cuda
.
device_properties
compute_capability
=
device_properties
(
active_device_no
)[
'major'
]
compute_capability
=
device_properties
(
active_device_no
)[
'major'
]
if
((
self
.
set_instead_of_inc
)
or
if
((
self
.
set_instead_of_inc
)
or
(
node
.
inputs
[
0
]
.
ndim
!=
node
.
inputs
[
1
]
.
ndim
)
or
(
node
.
inputs
[
0
]
.
ndim
!=
node
.
inputs
[
1
]
.
ndim
)
or
(
node
.
inputs
[
0
]
.
ndim
!=
2
)
or
(
node
.
inputs
[
0
]
.
ndim
!=
2
)
or
(
compute_capability
<
2
)):
(
compute_capability
<
2
)):
raise
NotImplementedError
(
"This case does not have C code yet."
)
raise
NotImplementedError
(
"This case does not have C code yet."
)
x
=
inputs
[
0
]
x
=
inputs
[
0
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论