Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0d99258d
提交
0d99258d
authored
4月 16, 2015
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2766 from nouiz/mixed
Mixed
上级
04716f2f
0a148e06
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
59 行增加
和
22 行删除
+59
-22
cmodule.py
theano/gof/cmodule.py
+12
-2
compiledir.py
theano/gof/compiledir.py
+1
-2
lazylinker_c.py
theano/gof/lazylinker_c.py
+2
-1
test_compute_test_value.py
theano/gof/tests/test_compute_test_value.py
+17
-0
printing.py
theano/printing.py
+2
-0
elemwise.py
theano/sandbox/cuda/elemwise.py
+15
-15
test_dnn.py
theano/sandbox/cuda/tests/test_dnn.py
+2
-0
scan_utils.py
theano/scan_module/scan_utils.py
+2
-0
opt.py
theano/tensor/opt.py
+5
-1
basic.py
theano/typed_list/basic.py
+1
-1
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
0d99258d
...
@@ -1111,8 +1111,18 @@ class ModuleCache(object):
...
@@ -1111,8 +1111,18 @@ class ModuleCache(object):
# Verify that when we reload the KeyData from the pickled file, the
# Verify that when we reload the KeyData from the pickled file, the
# same key can be found in it, and is not equal to more than one
# same key can be found in it, and is not equal to more than one
# other key.
# other key.
with
open
(
key_pkl
,
'rb'
)
as
f
:
for
i
in
range
(
3
):
key_data
=
cPickle
.
load
(
f
)
try
:
with
open
(
key_pkl
,
'rb'
)
as
f
:
key_data
=
cPickle
.
load
(
f
)
break
except
EOFError
:
# This file is probably getting written/updated at the
# same time. This can happen as we read the cache
# without taking the lock.
if
i
==
2
:
raise
time
.
sleep
(
2
)
found
=
sum
(
key
==
other_key
for
other_key
in
key_data
.
keys
)
found
=
sum
(
key
==
other_key
for
other_key
in
key_data
.
keys
)
msg
=
''
msg
=
''
...
...
theano/gof/compiledir.py
浏览文件 @
0d99258d
...
@@ -206,8 +206,7 @@ def filter_compiledir(path):
...
@@ -206,8 +206,7 @@ def filter_compiledir(path):
if
os
.
path
.
exists
(
init_file
):
if
os
.
path
.
exists
(
init_file
):
pass
# has already been created
pass
# has already been created
else
:
else
:
if
os
.
path
.
exists
(
path
):
e
.
args
+=
(
'
%
s exist?
%
s'
%
(
path
,
os
.
path
.
exists
(
path
)),)
e
.
args
+=
(
'
%
s does not exist..'
%
path
,)
raise
raise
return
path
return
path
...
...
theano/gof/lazylinker_c.py
浏览文件 @
0d99258d
...
@@ -59,7 +59,8 @@ try:
...
@@ -59,7 +59,8 @@ try:
if
os
.
path
.
exists
(
init_file
):
if
os
.
path
.
exists
(
init_file
):
pass
# has already been created
pass
# has already been created
else
:
else
:
e
.
args
+=
(
'
%
s exist?'
%
os
.
path
.
exists
(
location
),)
e
.
args
+=
(
'
%
s exist?
%
s'
%
(
location
,
os
.
path
.
exists
(
location
)),)
raise
raise
_need_reload
=
False
_need_reload
=
False
...
...
theano/gof/tests/test_compute_test_value.py
浏览文件 @
0d99258d
...
@@ -167,6 +167,23 @@ class TestComputeTestValue(unittest.TestCase):
...
@@ -167,6 +167,23 @@ class TestComputeTestValue(unittest.TestCase):
finally
:
finally
:
theano
.
config
.
compute_test_value
=
orig_compute_test_value
theano
.
config
.
compute_test_value
=
orig_compute_test_value
def
test_empty_elemwise
(
self
):
orig_compute_test_value
=
theano
.
config
.
compute_test_value
try
:
theano
.
config
.
compute_test_value
=
'raise'
x
=
theano
.
shared
(
numpy
.
random
.
rand
(
0
,
6
)
.
astype
(
config
.
floatX
),
'x'
)
# should work
z
=
(
x
+
2
)
*
3
assert
hasattr
(
z
.
tag
,
'test_value'
)
f
=
theano
.
function
([],
z
)
assert
_allclose
(
f
(),
z
.
tag
.
test_value
)
finally
:
theano
.
config
.
compute_test_value
=
orig_compute_test_value
def
test_constant
(
self
):
def
test_constant
(
self
):
orig_compute_test_value
=
theano
.
config
.
compute_test_value
orig_compute_test_value
=
theano
.
config
.
compute_test_value
try
:
try
:
...
...
theano/printing.py
浏览文件 @
0d99258d
...
@@ -74,6 +74,8 @@ def debugprint(obj, depth=-1, print_type=False,
...
@@ -74,6 +74,8 @@ def debugprint(obj, depth=-1, print_type=False,
to the Apply's identifier, to indicate which output a line corresponds to.
to the Apply's identifier, to indicate which output a line corresponds to.
"""
"""
if
not
isinstance
(
depth
,
int
):
raise
Exception
(
"depth parameter must be an int"
)
if
file
==
'str'
:
if
file
==
'str'
:
_file
=
StringIO
()
_file
=
StringIO
()
elif
file
is
None
:
elif
file
is
None
:
...
...
theano/sandbox/cuda/elemwise.py
浏览文件 @
0d99258d
...
@@ -599,12 +599,12 @@ class NaiveAlgo(object):
...
@@ -599,12 +599,12 @@ class NaiveAlgo(object):
for
d
in
xrange
(
nd
):
for
d
in
xrange
(
nd
):
print
>>
sio
,
'std::cerr << " " << local_dims[
%(d)
s]; '
%
locals
()
print
>>
sio
,
'std::cerr << " " << local_dims[
%(d)
s]; '
%
locals
()
print
>>
sio
,
'std::cerr << "
\\
n";'
print
>>
sio
,
'std::cerr << "
\\
n";'
if
nd
>
0
:
for
ipos
in
xrange
(
len
(
node
.
inputs
)):
for
ipos
in
xrange
(
len
(
node
.
inputs
)):
print
>>
sio
,
'std::cerr << " local_str inputs
%(ipos)
s: " <<'
%
locals
()
+
\
print
>>
sio
,
'std::cerr << " local_str inputs
%(ipos)
s: " <<'
%
locals
()
+
\
' << " " << '
.
join
([
"local_str[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
' << " " << '
.
join
([
"local_str[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
for
ipos
in
xrange
(
len
(
node
.
outputs
)):
for
ipos
in
xrange
(
len
(
node
.
outputs
)):
print
>>
sio
,
'std::cerr << " local_ostr inputs
%(ipos)
s: " <<'
%
locals
()
+
\
print
>>
sio
,
'std::cerr << " local_ostr inputs
%(ipos)
s: " <<'
%
locals
()
+
\
' << " " << '
.
join
([
"local_ostr[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
' << " " << '
.
join
([
"local_ostr[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
"""
print
>>
sio
,
"""
...
@@ -642,11 +642,11 @@ class NaiveAlgo(object):
...
@@ -642,11 +642,11 @@ class NaiveAlgo(object):
for
d
in
xrange
(
nd
):
for
d
in
xrange
(
nd
):
print
>>
sio
,
'std::cerr << " " << local_dims[
%(d)
s]; '
%
locals
()
print
>>
sio
,
'std::cerr << " " << local_dims[
%(d)
s]; '
%
locals
()
print
>>
sio
,
'std::cerr << "
\\
n";'
print
>>
sio
,
'std::cerr << "
\\
n";'
if
nd
>
0
:
for
ipos
in
xrange
(
len
(
node
.
inputs
)):
for
ipos
in
xrange
(
len
(
node
.
inputs
)):
print
>>
sio
,
'std::cerr << " local_str
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_str[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
'std::cerr << " local_str
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_str[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
for
ipos
in
xrange
(
len
(
node
.
outputs
)):
for
ipos
in
xrange
(
len
(
node
.
outputs
)):
print
>>
sio
,
'std::cerr << " local_ostr
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_ostr[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
'std::cerr << " local_ostr
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_ostr[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
# collapse contiguous dimensions (ignoring scalars, generic version(collapse any dimensions, right, left, middle))
# collapse contiguous dimensions (ignoring scalars, generic version(collapse any dimensions, right, left, middle))
# this is a good idea because we make less index calculation in the gpu.
# this is a good idea because we make less index calculation in the gpu.
...
@@ -729,11 +729,11 @@ nd_collapse_[i]=0;
...
@@ -729,11 +729,11 @@ nd_collapse_[i]=0;
for
d
in
xrange
(
nd
):
for
d
in
xrange
(
nd
):
print
>>
sio
,
'std::cerr << " " << local_dims[
%(d)
s]; '
%
locals
()
print
>>
sio
,
'std::cerr << " " << local_dims[
%(d)
s]; '
%
locals
()
print
>>
sio
,
'std::cerr << "
\\
n";'
print
>>
sio
,
'std::cerr << "
\\
n";'
if
nd
>
0
:
for
ipos
in
xrange
(
len
(
node
.
inputs
)):
for
ipos
in
xrange
(
len
(
node
.
inputs
)):
print
>>
sio
,
'std::cerr << " local_str
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_str[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
'std::cerr << " local_str
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_str[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
for
ipos
in
xrange
(
len
(
node
.
outputs
)):
for
ipos
in
xrange
(
len
(
node
.
outputs
)):
print
>>
sio
,
'std::cerr << " local_ostr
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_ostr[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
'std::cerr << " local_ostr
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_ostr[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
def
launch_Ccontiguous
(
nodename
,
scalar_op
,
sync
=
True
):
def
launch_Ccontiguous
(
nodename
,
scalar_op
,
sync
=
True
):
kernel_call_args
=
[
"numEls"
]
kernel_call_args
=
[
"numEls"
]
...
...
theano/sandbox/cuda/tests/test_dnn.py
浏览文件 @
0d99258d
...
@@ -29,6 +29,8 @@ else:
...
@@ -29,6 +29,8 @@ else:
def
test_dnn_conv_desc_merge
():
def
test_dnn_conv_desc_merge
():
if
not
cuda
.
dnn
.
dnn_available
():
raise
SkipTest
(
cuda
.
dnn
.
dnn_available
.
msg
)
img_shp
=
T
.
as_tensor_variable
(
img_shp
=
T
.
as_tensor_variable
(
numpy
.
asarray
([
2
,
1
,
8
,
8
])
.
astype
(
'int64'
))
numpy
.
asarray
([
2
,
1
,
8
,
8
])
.
astype
(
'int64'
))
kern_shp
=
T
.
as_tensor_variable
(
kern_shp
=
T
.
as_tensor_variable
(
...
...
theano/scan_module/scan_utils.py
浏览文件 @
0d99258d
...
@@ -185,6 +185,8 @@ def clone(output,
...
@@ -185,6 +185,8 @@ def clone(output,
as the original graph. If False, clone them. Note that cloned
as the original graph. If False, clone them. Note that cloned
shared variables still use the same underlying storage, so they
shared variables still use the same underlying storage, so they
will always have the same value.
will always have the same value.
:param copy_inputs: deprecated, use share_inputs.
"""
"""
if
copy_inputs
is
not
DEPRECATED_ARG
:
if
copy_inputs
is
not
DEPRECATED_ARG
:
warnings
.
warn
(
'In `clone()` function, the argument `copy_inputs` has been deprecated and renamed into `share_inputs`'
)
warnings
.
warn
(
'In `clone()` function, the argument `copy_inputs` has been deprecated and renamed into `share_inputs`'
)
...
...
theano/tensor/opt.py
浏览文件 @
0d99258d
...
@@ -5433,7 +5433,11 @@ def local_elemwise_fusion_op(OP, max_input_fct=lambda node: 1024,
...
@@ -5433,7 +5433,11 @@ def local_elemwise_fusion_op(OP, max_input_fct=lambda node: 1024,
else
:
else
:
tmp
=
scalar
.
get_scalar_type
(
ii
.
dtype
)
.
make_variable
()
tmp
=
scalar
.
get_scalar_type
(
ii
.
dtype
)
.
make_variable
()
try
:
try
:
tmp
.
tag
.
test_value
=
gof
.
op
.
get_test_value
(
ii
)
.
flatten
()[
0
]
tv
=
gof
.
op
.
get_test_value
(
ii
)
if
tv
.
size
>
0
:
tmp
.
tag
.
test_value
=
tv
.
flatten
()[
0
]
else
:
tmp
.
tag
.
test_value
=
tv
except
AttributeError
:
except
AttributeError
:
pass
pass
tmp_s_input
.
append
(
tmp
)
tmp_s_input
.
append
(
tmp
)
...
...
theano/typed_list/basic.py
浏览文件 @
0d99258d
...
@@ -134,7 +134,7 @@ class Append(Op):
...
@@ -134,7 +134,7 @@ class Append(Op):
def
make_node
(
self
,
x
,
toAppend
):
def
make_node
(
self
,
x
,
toAppend
):
assert
isinstance
(
x
.
type
,
TypedListType
)
assert
isinstance
(
x
.
type
,
TypedListType
)
assert
x
.
ttype
==
toAppend
.
type
assert
x
.
ttype
==
toAppend
.
type
,
(
x
.
ttype
,
toAppend
.
type
)
return
Apply
(
self
,
[
x
,
toAppend
],
[
x
.
type
()])
return
Apply
(
self
,
[
x
,
toAppend
],
[
x
.
type
()])
def
perform
(
self
,
node
,
(
x
,
toAppend
),
(
out
,
)):
def
perform
(
self
,
node
,
(
x
,
toAppend
),
(
out
,
)):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论