Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
359d4feb
提交
359d4feb
authored
8月 23, 2016
作者:
sentient07
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup #1
上级
c46741e0
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
14 行增加
和
8 行删除
+14
-8
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+10
-1
blas.py
theano/sandbox/cuda/blas.py
+0
-3
opt.py
theano/sandbox/cuda/opt.py
+4
-4
没有找到文件。
theano/sandbox/cuda/basic_ops.py
浏览文件 @
359d4feb
...
@@ -130,7 +130,6 @@ class GpuFromHost(GpuOp):
...
@@ -130,7 +130,6 @@ class GpuFromHost(GpuOp):
def
__str__
(
self
):
def
__str__
(
self
):
return
'GpuFromHost'
return
'GpuFromHost'
def
make_node
(
self
,
x
):
def
make_node
(
self
,
x
):
if
not
isinstance
(
x
.
type
,
tensor
.
TensorType
):
if
not
isinstance
(
x
.
type
,
tensor
.
TensorType
):
raise
TypeError
(
"Expected a Theano variable with type "
raise
TypeError
(
"Expected a Theano variable with type "
...
@@ -583,6 +582,14 @@ class GpuCAReduce(GpuOp):
...
@@ -583,6 +582,14 @@ class GpuCAReduce(GpuOp):
if
not
hasattr
(
self
,
"pre_scalar_op"
):
if
not
hasattr
(
self
,
"pre_scalar_op"
):
self
.
pre_scalar_op
=
None
self
.
pre_scalar_op
=
None
def
__str__
(
self
):
pre
=
""
if
self
.
pre_scalar_op
:
pre
=
"pre=
%
s,red="
%
str
(
self
.
pre_scalar_op
)
return
"GpuCAReduce{
%
s
%
s}{
%
s}"
%
(
pre
,
str
(
self
.
scalar_op
),
','
.
join
(
str
(
i
)
for
i
in
self
.
reduce_mask
))
def
make_node
(
self
,
x
):
def
make_node
(
self
,
x
):
x
=
as_cuda_ndarray_variable
(
x
)
x
=
as_cuda_ndarray_variable
(
x
)
if
(
x
.
type
.
ndim
!=
len
(
self
.
reduce_mask
)):
if
(
x
.
type
.
ndim
!=
len
(
self
.
reduce_mask
)):
...
@@ -3634,6 +3641,7 @@ class GpuAllocEmpty(GpuOp):
...
@@ -3634,6 +3641,7 @@ class GpuAllocEmpty(GpuOp):
Implement Alloc on the gpu, but without initializing memory.
Implement Alloc on the gpu, but without initializing memory.
"""
"""
__props__
=
()
@staticmethod
@staticmethod
def
validate_shape
(
shape
):
def
validate_shape
(
shape
):
...
@@ -3832,6 +3840,7 @@ class CopyOnNegativeStrides(GpuOp):
...
@@ -3832,6 +3840,7 @@ class CopyOnNegativeStrides(GpuOp):
If it does, returns a c contiguous copy.
If it does, returns a c contiguous copy.
"""
"""
__props__
=
()
view_map
=
{
0
:
[
0
]}
view_map
=
{
0
:
[
0
]}
check_input
=
False
check_input
=
False
...
...
theano/sandbox/cuda/blas.py
浏览文件 @
359d4feb
...
@@ -898,7 +898,6 @@ class BaseGpuCorrMM(GpuOp):
...
@@ -898,7 +898,6 @@ class BaseGpuCorrMM(GpuOp):
return
self
.
border_mode
return
self
.
border_mode
return
(
0
,
0
)
return
(
0
,
0
)
def
flops
(
self
,
inp
,
outp
):
def
flops
(
self
,
inp
,
outp
):
"""
"""
Useful with the hack in profilemode to print the MFlops.
Useful with the hack in profilemode to print the MFlops.
...
@@ -2194,14 +2193,12 @@ class GpuDownsampleFactorMax(GpuOp):
...
@@ -2194,14 +2193,12 @@ class GpuDownsampleFactorMax(GpuOp):
Implement downsample with max on the gpu.
Implement downsample with max on the gpu.
"""
"""
__props__
=
(
'ds'
,
'ignore_border'
)
__props__
=
(
'ds'
,
'ignore_border'
)
def
__init__
(
self
,
ds
,
ignore_border
=
False
):
def
__init__
(
self
,
ds
,
ignore_border
=
False
):
self
.
ds
=
tuple
(
ds
)
self
.
ds
=
tuple
(
ds
)
self
.
ignore_border
=
ignore_border
self
.
ignore_border
=
ignore_border
def
make_node
(
self
,
x
):
def
make_node
(
self
,
x
):
if
not
isinstance
(
x
.
type
,
CudaNdarrayType
):
if
not
isinstance
(
x
.
type
,
CudaNdarrayType
):
raise
TypeError
()
raise
TypeError
()
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
359d4feb
...
@@ -1127,9 +1127,9 @@ def local_gpu_advanced_incsubtensor1(node):
...
@@ -1127,9 +1127,9 @@ def local_gpu_advanced_incsubtensor1(node):
compute_capability
=
device_properties
(
active_device_no
)[
'major'
]
compute_capability
=
device_properties
(
active_device_no
)[
'major'
]
if
(
compute_capability
<
2
or
y
.
ndim
!=
2
or
x
.
ndim
!=
2
):
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
:
else
:
gpu_op
=
theano
.
sandbox
.
cuda
.
basic_ops
.
GPU
AdvancedIncSubtensor1_dev20
(
**
node
.
op
.
_props_dict
())
gpu_op
=
Gpu
AdvancedIncSubtensor1_dev20
(
**
node
.
op
.
_props_dict
())
return
[
gpu_op
(
as_cuda_ndarray_variable
(
x
),
return
[
gpu_op
(
as_cuda_ndarray_variable
(
x
),
as_cuda_ndarray_variable
(
y
),
*
coords
)]
as_cuda_ndarray_variable
(
y
),
*
coords
)]
...
@@ -1912,7 +1912,7 @@ def local_gpu_downsample_factor_max(node):
...
@@ -1912,7 +1912,7 @@ def local_gpu_downsample_factor_max(node):
if
(
pad
)
!=
(
0
,
0
)
or
node
.
op
.
mode
!=
'max'
or
stride
!=
ws
:
if
(
pad
)
!=
(
0
,
0
)
or
node
.
op
.
mode
!=
'max'
or
stride
!=
ws
:
return
return
if
(
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
HostFromGpu
)):
if
(
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
HostFromGpu
)):
gpu_ds
=
GpuDownsampleFactorMax
(
node
.
op
.
ds
,
node
.
op
.
ignore_border
)
gpu_ds
=
GpuDownsampleFactorMax
(
**
node
.
op
.
_props_dict
()
)
return
[
host_from_gpu
(
gpu_ds
(
x
.
owner
.
inputs
[
0
]))]
return
[
host_from_gpu
(
gpu_ds
(
x
.
owner
.
inputs
[
0
]))]
...
@@ -1929,7 +1929,7 @@ def local_gpu_downsample_factor_max_grad(node):
...
@@ -1929,7 +1929,7 @@ def local_gpu_downsample_factor_max_grad(node):
if
pad
!=
(
0
,
0
)
or
node
.
op
.
mode
!=
'max'
or
stride
!=
ws
:
if
pad
!=
(
0
,
0
)
or
node
.
op
.
mode
!=
'max'
or
stride
!=
ws
:
return
return
if
(
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
HostFromGpu
)):
if
(
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
HostFromGpu
)):
gpu_ds_grad
=
GpuDownsampleFactorMaxGrad
(
ws
,
node
.
op
.
ignore_border
)
gpu_ds_grad
=
GpuDownsampleFactorMaxGrad
(
**
node
.
op
.
_props_dict
()
)
return
[
host_from_gpu
(
gpu_ds_grad
(
x
.
owner
.
inputs
[
0
],
return
[
host_from_gpu
(
gpu_ds_grad
(
x
.
owner
.
inputs
[
0
],
as_cuda_ndarray_variable
(
z
),
as_cuda_ndarray_variable
(
z
),
as_cuda_ndarray_variable
(
gz
)))]
as_cuda_ndarray_variable
(
gz
)))]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论