Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c46741e0
提交
c46741e0
authored
8月 23, 2016
作者:
sentient07
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed __eq__ __hash__ and __str__ from redundant places
上级
7885227c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
17 行增加
和
59 行删除
+17
-59
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+16
-33
blas.py
theano/sandbox/cuda/blas.py
+0
-25
opt.py
theano/sandbox/cuda/opt.py
+1
-1
没有找到文件。
theano/sandbox/cuda/basic_ops.py
浏览文件 @
c46741e0
...
@@ -121,6 +121,15 @@ class GpuFromHost(GpuOp):
...
@@ -121,6 +121,15 @@ class GpuFromHost(GpuOp):
check_input
=
False
check_input
=
False
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
hash
(
type
(
self
))
def
__str__
(
self
):
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
):
...
@@ -312,13 +321,18 @@ class GpuDimShuffle(GpuOp):
...
@@ -312,13 +321,18 @@ class GpuDimShuffle(GpuOp):
check_broadcast
=
False
check_broadcast
=
False
__props__
=
(
"input_broadcastable"
,
"new_order"
)
__props__
=
(
"input_broadcastable"
,
"new_order"
,
"inplace"
)
def
__init__
(
self
,
input_broadcastable
,
new_order
):
def
__init__
(
self
,
input_broadcastable
,
new_order
,
inplace
=
True
):
input_broadcastable
=
tuple
(
input_broadcastable
)
input_broadcastable
=
tuple
(
input_broadcastable
)
self
.
input_broadcastable
=
input_broadcastable
self
.
input_broadcastable
=
input_broadcastable
self
.
new_order
=
tuple
(
new_order
)
self
.
new_order
=
tuple
(
new_order
)
self
.
inplace
=
int
(
inplace
)
self
.
inplace
=
int
(
inplace
)
if
inplace
is
True
:
self
.
inplace
=
inplace
self
.
_props_dict
()
.
pop
(
'inplace'
)
else
:
raise
ValueError
(
"DimShuffle is inplace by default and hence the inplace for DimShuffle must be true"
)
for
i
,
b
in
enumerate
(
input_broadcastable
):
for
i
,
b
in
enumerate
(
input_broadcastable
):
if
i
not
in
new_order
:
if
i
not
in
new_order
:
...
@@ -374,24 +388,12 @@ class GpuDimShuffle(GpuOp):
...
@@ -374,24 +388,12 @@ class GpuDimShuffle(GpuOp):
ob
.
append
(
ib
[
value
])
ob
.
append
(
ib
[
value
])
return
Apply
(
self
,
[
input
],
[
CudaNdarrayType
(
broadcastable
=
ob
)()])
return
Apply
(
self
,
[
input
],
[
CudaNdarrayType
(
broadcastable
=
ob
)()])
def
__eq__
(
self
,
other
):
# it's probably not necessary to compare input_broadcastable
return
type
(
self
)
==
type
(
other
)
\
and
self
.
new_order
==
other
.
new_order
\
and
self
.
input_broadcastable
==
other
.
input_broadcastable
def
_rehash
(
self
):
def
_rehash
(
self
):
self
.
_hashval
=
(
hash
(
type
(
self
)
.
__name__
)
^
self
.
_hashval
=
(
hash
(
type
(
self
)
.
__name__
)
^
hash
(
type
(
self
)
.
__module__
)
^
hash
(
type
(
self
)
.
__module__
)
^
hash
(
self
.
new_order
)
^
hash
(
self
.
new_order
)
^
hash
(
self
.
input_broadcastable
))
hash
(
self
.
input_broadcastable
))
def
__hash__
(
self
):
return
self
.
_hashval
def
__str__
(
self
):
return
"GpuDimShuffle{
%
s}"
%
","
.
join
(
str
(
x
)
for
x
in
self
.
new_order
)
def
c_code
(
self
,
node
,
name
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
name
,
inp
,
out
,
sub
):
input
,
=
inp
input
,
=
inp
res
,
=
out
res
,
=
out
...
@@ -575,14 +577,6 @@ class GpuCAReduce(GpuOp):
...
@@ -575,14 +577,6 @@ class GpuCAReduce(GpuOp):
if
pre_scalar_op
:
if
pre_scalar_op
:
assert
pre_scalar_op
.
nin
==
1
assert
pre_scalar_op
.
nin
==
1
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
__setstate__
(
self
,
d
):
def
__setstate__
(
self
,
d
):
self
.
__dict__
.
update
(
d
)
self
.
__dict__
.
update
(
d
)
# For unpickling of old ops.
# For unpickling of old ops.
...
@@ -3641,8 +3635,6 @@ class GpuAllocEmpty(GpuOp):
...
@@ -3641,8 +3635,6 @@ class GpuAllocEmpty(GpuOp):
"""
"""
__props__
=
()
@staticmethod
@staticmethod
def
validate_shape
(
shape
):
def
validate_shape
(
shape
):
sh
=
[
tensor
.
as_tensor_variable
(
s
)
for
s
in
shape
]
sh
=
[
tensor
.
as_tensor_variable
(
s
)
for
s
in
shape
]
...
@@ -3740,14 +3732,6 @@ class GpuAlloc(GpuAllocEmpty):
...
@@ -3740,14 +3732,6 @@ class GpuAlloc(GpuAllocEmpty):
def
__init__
(
self
,
memset_0
=
False
):
def
__init__
(
self
,
memset_0
=
False
):
self
.
memset_0
=
memset_0
self
.
memset_0
=
memset_0
def
__str__
(
self
):
# Hide the memset parameter when not used to prevent confusion.
if
self
.
memset_0
:
s
=
"
%
s{memset_0=
%
s}"
%
(
self
.
__class__
.
__name__
,
self
.
memset_0
)
else
:
s
=
self
.
__class__
.
__name__
return
s
def
make_node
(
self
,
value
,
*
shape
):
def
make_node
(
self
,
value
,
*
shape
):
# if there is unneeded transfert generated by the next line
# if there is unneeded transfert generated by the next line
# the optimizer will remove them.
# the optimizer will remove them.
...
@@ -3851,7 +3835,6 @@ class CopyOnNegativeStrides(GpuOp):
...
@@ -3851,7 +3835,6 @@ class CopyOnNegativeStrides(GpuOp):
view_map
=
{
0
:
[
0
]}
view_map
=
{
0
:
[
0
]}
check_input
=
False
check_input
=
False
__props__
=
()
def
grad
(
self
,
inputs
,
dout
):
def
grad
(
self
,
inputs
,
dout
):
...
...
theano/sandbox/cuda/blas.py
浏览文件 @
c46741e0
...
@@ -898,12 +898,6 @@ class BaseGpuCorrMM(GpuOp):
...
@@ -898,12 +898,6 @@ class BaseGpuCorrMM(GpuOp):
return
self
.
border_mode
return
self
.
border_mode
return
(
0
,
0
)
return
(
0
,
0
)
def
__str__
(
self
):
return
'
%
s{
%
s,
%
s,
%
s}'
%
(
self
.
__class__
.
__name__
,
self
.
border_mode
,
str
(
self
.
subsample
),
str
(
self
.
filter_dilation
))
def
flops
(
self
,
inp
,
outp
):
def
flops
(
self
,
inp
,
outp
):
"""
"""
...
@@ -1413,13 +1407,6 @@ class BaseGpuCorr3dMM(GpuOp):
...
@@ -1413,13 +1407,6 @@ class BaseGpuCorr3dMM(GpuOp):
raise
ValueError
(
"pad must be 'half', 'full', or have three elements"
)
raise
ValueError
(
"pad must be 'half', 'full', or have three elements"
)
self
.
pad
=
pad
self
.
pad
=
pad
def
__str__
(
self
):
return
'
%
s{
%
s,
%
s, pad=
%
r}'
%
(
self
.
__class__
.
__name__
,
self
.
border_mode
,
str
(
self
.
subsample
),
self
.
pad
)
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"""
# if the output shape is correct, then this gives the correct
# if the output shape is correct, then this gives the correct
...
@@ -2214,18 +2201,6 @@ class GpuDownsampleFactorMax(GpuOp):
...
@@ -2214,18 +2201,6 @@ class GpuDownsampleFactorMax(GpuOp):
self
.
ds
=
tuple
(
ds
)
self
.
ds
=
tuple
(
ds
)
self
.
ignore_border
=
ignore_border
self
.
ignore_border
=
ignore_border
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
)
and
self
.
ds
==
other
.
ds
and
self
.
ignore_border
==
other
.
ignore_border
)
def
__hash__
(
self
):
return
hash
(
type
(
self
))
^
hash
(
self
.
ds
)
^
hash
(
self
.
ignore_border
)
def
__str__
(
self
):
return
'
%
s{
%
s,
%
s}'
%
(
self
.
__class__
.
__name__
,
self
.
ds
,
self
.
ignore_border
)
def
make_node
(
self
,
x
):
def
make_node
(
self
,
x
):
if
not
isinstance
(
x
.
type
,
CudaNdarrayType
):
if
not
isinstance
(
x
.
type
,
CudaNdarrayType
):
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
c46741e0
...
@@ -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
.
_props_dict
()
)
gpu_ds
=
GpuDownsampleFactorMax
(
node
.
op
.
ds
,
node
.
op
.
ignore_border
)
return
[
host_from_gpu
(
gpu_ds
(
x
.
owner
.
inputs
[
0
]))]
return
[
host_from_gpu
(
gpu_ds
(
x
.
owner
.
inputs
[
0
]))]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论