Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d0d006f4
提交
d0d006f4
authored
2月 13, 2016
作者:
sentient07
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added _props_dict() to all the GPU ops in cuda/opt.py
上级
9e2eb687
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
18 行增加
和
18 行删除
+18
-18
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+4
-0
opt.py
theano/sandbox/cuda/opt.py
+11
-18
elemwise.py
theano/tensor/elemwise.py
+3
-0
没有找到文件。
theano/sandbox/cuda/basic_ops.py
浏览文件 @
d0d006f4
...
...
@@ -185,6 +185,8 @@ class GpuElemwise(GpuOp):
"""
__props__
=
(
"scalar_op"
,
)
nin
=
property
(
lambda
self
:
self
.
scalar_op
.
nin
)
nout
=
property
(
lambda
self
:
self
.
scalar_op
.
nout
)
...
...
@@ -568,6 +570,8 @@ class GpuCAReduce(GpuOp):
"""
__props__
=
(
"reduce_mask"
,
"scalar_op"
,
)
def
__init__
(
self
,
reduce_mask
,
scalar_op
,
pre_scalar_op
=
None
):
self
.
reduce_mask
=
tuple
(
reduce_mask
)
self
.
scalar_op
=
scalar_op
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
d0d006f4
...
...
@@ -288,7 +288,7 @@ def local_gpu_elemwise_0(node):
new_op
=
GpuElemwise
(
erfcx_gpu
)
else
:
try
:
new_op
=
GpuElemwise
(
node
.
op
.
scalar_op
)
new_op
=
GpuElemwise
(
**
node
.
op
.
_props_dict
()
)
except
SupportCodeError
:
# This happens when scalar_op requires support code
return
False
...
...
@@ -398,16 +398,14 @@ def local_gpu_dimshuffle_0(node):
input
,
=
node
.
inputs
if
input
.
owner
and
isinstance
(
input
.
owner
.
op
,
HostFromGpu
):
# move the add to a GpuAdd
new_op
=
GpuDimShuffle
(
node
.
op
.
input_broadcastable
,
node
.
op
.
new_order
)
new_op
=
GpuDimShuffle
(
**
node
.
op
.
_props_dict
())
return
[
host_from_gpu
(
new_op
(
as_cuda_ndarray_variable
(
input
)))]
if
isinstance
(
node
.
op
,
GpuFromHost
):
host_input
=
node
.
inputs
[
0
]
if
host_input
.
owner
and
isinstance
(
host_input
.
owner
.
op
,
tensor
.
DimShuffle
):
dimshuffle_node
=
host_input
.
owner
new_op
=
GpuDimShuffle
(
dimshuffle_node
.
op
.
input_broadcastable
,
dimshuffle_node
.
op
.
new_order
)
new_op
=
GpuDimShuffle
(
**
dimshuffle_node
.
op
.
_props_dict
())
return
[
new_op
(
as_cuda_ndarray_variable
(
dimshuffle_node
.
inputs
[
0
]))]
return
False
...
...
@@ -995,9 +993,8 @@ def local_gpu_reshape(node):
host_input
=
node
.
inputs
[
0
]
if
host_input
.
owner
and
\
isinstance
(
host_input
.
owner
.
op
,
tensor
.
Reshape
):
rshp
=
host_input
.
owner
.
op
x
,
shp
=
host_input
.
owner
.
inputs
gpu_reshape
=
GpuReshape
(
rshp
.
ndim
)(
as_cuda_ndarray_variable
(
x
),
gpu_reshape
=
GpuReshape
(
**
host_input
.
owner
.
op
.
_props_dict
()
)(
as_cuda_ndarray_variable
(
x
),
shp
)
if
gpu_reshape
.
broadcastable
!=
node
.
outputs
[
0
]
.
broadcastable
:
# this can happen as we always return False for all broadcast
...
...
@@ -1011,7 +1008,7 @@ def local_gpu_reshape(node):
x
,
shp
=
node
.
inputs
if
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
HostFromGpu
):
gpu_x
,
=
x
.
owner
.
inputs
gpu_reshape
=
GpuReshape
(
node
.
op
.
ndim
)(
gpu_x
,
shp
)
gpu_reshape
=
GpuReshape
(
**
node
.
op
.
_props_dict
()
)(
gpu_x
,
shp
)
if
gpu_reshape
.
broadcastable
!=
node
.
outputs
[
0
]
.
broadcastable
:
# this can happen as we always return False for all broadcast
# dim in GpuReshape but not for Reshape
...
...
@@ -1082,7 +1079,7 @@ def local_gpu_subtensor(node):
gpu_x
,
=
x
.
owner
.
inputs
coords
=
node
.
inputs
[
1
:]
return
[
host_from_gpu
(
GpuSubtensor
(
node
.
op
.
idx_list
)(
gpu_x
,
*
coords
))]
**
node
.
op
.
_props_dict
()
)(
gpu_x
,
*
coords
))]
return
False
...
...
@@ -1171,11 +1168,9 @@ def local_gpu_advanced_incsubtensor1(node):
active_device_no
=
theano
.
sandbox
.
cuda
.
active_device_number
()
compute_capability
=
device_properties
(
active_device_no
)[
'major'
]
if
(
compute_capability
<
2
or
y
.
ndim
!=
2
or
x
.
ndim
!=
2
):
gpu_op
=
GpuAdvancedIncSubtensor1
(
set_instead_of_inc
=
set_instead_of_inc
)
gpu_op
=
GpuAdvancedIncSubtensor1
(
**
node
.
op
.
_props_dict
())
else
:
gpu_op
=
GpuAdvancedIncSubtensor1_dev20
(
set_instead_of_inc
=
set_instead_of_inc
)
gpu_op
=
GpuAdvancedIncSubtensor1_dev20
(
**
node
.
op
.
_props_dict
())
return
[
host_from_gpu
(
gpu_op
(
gpu_x
,
gpu_y
,
*
coords
))]
return
False
...
...
@@ -1229,9 +1224,7 @@ def local_gpu_incsubtensor(node):
y
=
tensor
.
cast
(
y
,
'float32'
)
gpu_y
=
as_cuda_ndarray_variable
(
y
)
if
go_gpu
:
ret
=
GpuIncSubtensor
(
node
.
op
.
idx_list
,
inplace
=
node
.
op
.
inplace
,
set_instead_of_inc
=
node
.
op
.
set_instead_of_inc
)(
ret
=
GpuIncSubtensor
(
**
node
.
op
.
_props_dict
())(
gpu_x
,
gpu_y
,
*
coords
)
val
=
getattr
(
node
.
outputs
[
0
]
.
tag
,
'nan_guard_mode_check'
,
True
)
...
...
@@ -1597,7 +1590,7 @@ def local_conv_gemm(node):
# need to flip the kernel for valid convolution
kern
=
kern
[:,
:,
::
-
1
,
::
-
1
]
# By default use GpuCorrMM
rval
=
GpuCorrMM
(
border_mode
,
subsample
)(
rval
=
GpuCorrMM
(
**
node
.
op
.
_props_dict
()
)(
gpu_contiguous
(
img
),
gpu_contiguous
(
kern
))
# call GpuCorrMM_gradWeights if good
...
...
@@ -1928,7 +1921,7 @@ def local_gpu_downsample_factor_max(node):
if
(
pad
)
!=
(
0
,
0
)
or
node
.
op
.
mode
!=
'max'
or
stride
!=
ws
:
return
if
(
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
HostFromGpu
)):
gpu_ds
=
GpuDownsampleFactorMax
(
ws
,
node
.
op
.
ignore_border
)
gpu_ds
=
GpuDownsampleFactorMax
(
**
node
.
op
.
_props_dict
()
)
return
[
host_from_gpu
(
gpu_ds
(
x
.
owner
.
inputs
[
0
]))]
...
...
theano/tensor/elemwise.py
浏览文件 @
d0d006f4
...
...
@@ -134,6 +134,7 @@ class DimShuffle(Op):
_f16_ok
=
True
check_input
=
False
__props__
=
(
"input_broadcastable"
,
"new_order"
)
def
__init__
(
self
,
input_broadcastable
,
new_order
,
inplace
=
False
):
input_broadcastable
=
tuple
(
input_broadcastable
)
...
...
@@ -503,6 +504,8 @@ second dimension
"""
__props__
=
(
"scalar_op"
,)
def
__init__
(
self
,
scalar_op
,
inplace_pattern
=
None
,
name
=
None
,
nfunc_spec
=
None
,
openmp
=
None
):
if
inplace_pattern
is
None
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论