Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b2e9ea5d
提交
b2e9ea5d
authored
7月 18, 2011
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More clean-up of logging code.
上级
ce0002f8
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
19 行增加
和
31 行删除
+19
-31
printing.py
theano/printing.py
+1
-5
opt.py
theano/sandbox/cuda/opt.py
+1
-1
basic.py
theano/tensor/basic.py
+3
-7
conv.py
theano/tensor/nnet/conv.py
+14
-14
conv.py
theano/tensor/signal/conv.py
+0
-4
没有找到文件。
theano/printing.py
浏览文件 @
b2e9ea5d
...
@@ -16,10 +16,6 @@ from theano.compile import Function, debugmode
...
@@ -16,10 +16,6 @@ from theano.compile import Function, debugmode
from
theano.compile.profilemode
import
ProfileMode
from
theano.compile.profilemode
import
ProfileMode
_logger
=
logging
.
getLogger
(
"theano.printing"
)
_logger
=
logging
.
getLogger
(
"theano.printing"
)
def
_info
(
*
msg
):
_logger
.
info
(
' '
.
join
(
msg
))
def
_warn
(
*
msg
):
_logger
.
warn
(
' '
.
join
(
msg
))
def
debugprint
(
obj
,
depth
=-
1
,
print_type
=
False
,
file
=
None
):
def
debugprint
(
obj
,
depth
=-
1
,
print_type
=
False
,
file
=
None
):
"""Print a computation graph to file
"""Print a computation graph to file
...
@@ -476,7 +472,7 @@ def pydotprint(fct, outfile=None,
...
@@ -476,7 +472,7 @@ def pydotprint(fct, outfile=None,
if
node
.
op
.
__class__
.
__name__
==
'IfElse'
and
node
.
op
.
name
==
cond_highlight
:
if
node
.
op
.
__class__
.
__name__
==
'IfElse'
and
node
.
op
.
name
==
cond_highlight
:
cond
=
node
cond
=
node
if
cond
is
None
:
if
cond
is
None
:
_warn
(
"pydotprint: cond_highlight is set but there is no IfElse node in the graph"
)
_
logger
.
warn
(
"pydotprint: cond_highlight is set but there is no IfElse node in the graph"
)
cond_highlight
=
None
cond_highlight
=
None
if
cond_highlight
is
not
None
:
if
cond_highlight
is
not
None
:
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
b2e9ea5d
...
@@ -933,7 +933,7 @@ def get_device_type_sizes():
...
@@ -933,7 +933,7 @@ def get_device_type_sizes():
del
gpu_int_size
del
gpu_int_size
del
t
del
t
except
Exception
,
e
:
except
Exception
,
e
:
_logger
.
warning
((
"O
PTIMIZATION WARNING
: "
_logger
.
warning
((
"O
ptimization Warning
: "
"Got the following error, but we can ignore it. "
"Got the following error, but we can ignore it. "
"This could cause less GpuElemwise fused together.
\n
"
"This could cause less GpuElemwise fused together.
\n
"
"
%
s"
)
%
e
)
"
%
s"
)
%
e
)
...
...
theano/tensor/basic.py
浏览文件 @
b2e9ea5d
...
@@ -31,10 +31,6 @@ from elemwise import Elemwise, DimShuffle, CAReduce, Sum
...
@@ -31,10 +31,6 @@ from elemwise import Elemwise, DimShuffle, CAReduce, Sum
import
logging
import
logging
_logger
=
logging
.
getLogger
(
"theano.tensor.basic"
)
_logger
=
logging
.
getLogger
(
"theano.tensor.basic"
)
def
_info
(
*
msg
):
_logger
.
info
(
' '
.
join
(
msg
))
def
_warn
(
*
msg
):
_logger
.
warn
(
' '
.
join
(
msg
))
#This is needed as we will hide it later
#This is needed as we will hide it later
python_complex
=
complex
python_complex
=
complex
...
@@ -728,9 +724,9 @@ class TensorType(Type):
...
@@ -728,9 +724,9 @@ class TensorType(Type):
if
not
(
a_missing
.
any
()
or
(
allow_remove_inf
and
a_inf
.
any
())):
if
not
(
a_missing
.
any
()
or
(
allow_remove_inf
and
a_inf
.
any
())):
# There are no missing values in a, thus this is not the
# There are no missing values in a, thus this is not the
# reason why numpy.allclose(a, b) returned False.
# reason why numpy.allclose(a, b) returned False.
_
info
(
'numpy allclose failed for abs_err
%
f and rel_err
%
f'
%
(
_
logger
.
info
(
'numpy allclose failed for abs_err
%
f and rel_err
%
f'
,
numpy
.
max
(
abs
(
a
-
b
)),
numpy
.
max
(
abs
(
a
-
b
)),
numpy
.
max
(
abs
(
a
-
b
)
/
(
abs
(
a
)
+
abs
(
b
)
))))
numpy
.
max
(
abs
(
a
-
b
)
/
(
abs
(
a
)
+
abs
(
b
))))
return
False
return
False
# The following line is what numpy.allclose bases its decision
# The following line is what numpy.allclose bases its decision
# upon, according to its documentation.
# upon, according to its documentation.
...
...
theano/tensor/nnet/conv.py
浏览文件 @
b2e9ea5d
...
@@ -31,10 +31,6 @@ except ImportError:
...
@@ -31,10 +31,6 @@ except ImportError:
pass
pass
_logger
=
logging
.
getLogger
(
"theano.tensor.nnet.conv"
)
_logger
=
logging
.
getLogger
(
"theano.tensor.nnet.conv"
)
def
_debug
(
*
msg
):
_logger
.
debug
(
' '
.
join
([
str
(
x
)
for
x
in
msg
]))
def
_warn
(
*
msg
):
_logger
.
warn
(
' '
.
join
([
str
(
x
)
for
x
in
msg
]))
def
conv2d
(
input
,
filters
,
image_shape
=
None
,
filter_shape
=
None
,
def
conv2d
(
input
,
filters
,
image_shape
=
None
,
filter_shape
=
None
,
...
@@ -395,7 +391,7 @@ class ConvOp(Op):
...
@@ -395,7 +391,7 @@ class ConvOp(Op):
warnstr
=
"OPTIMISATION WARNING: in ConvOp.__init__() unroll_batch(
%
i)"
\
warnstr
=
"OPTIMISATION WARNING: in ConvOp.__init__() unroll_batch(
%
i)"
\
"must be 0 or a divisor of bsize(
%
i). We revert it to
%
i. This"
\
"must be 0 or a divisor of bsize(
%
i). We revert it to
%
i. This"
\
" won't change the result, but may make it slower."
" won't change the result, but may make it slower."
_
warn
(
warnstr
%
(
self
.
unroll_batch
,
self
.
bsize
,
new
)
)
_
logger
.
warn
(
warnstr
,
self
.
unroll_batch
,
self
.
bsize
,
new
)
self
.
unroll_batch
=
new
self
.
unroll_batch
=
new
...
@@ -414,7 +410,7 @@ class ConvOp(Op):
...
@@ -414,7 +410,7 @@ class ConvOp(Op):
warnstr
=
"OPTIMISATION WARNING: in ConvOp.__init__() unroll_kern(
%
i)"
\
warnstr
=
"OPTIMISATION WARNING: in ConvOp.__init__() unroll_kern(
%
i)"
\
"should be 0 or a divisor of nkern(
%
i). We revert it to
%
i."
\
"should be 0 or a divisor of nkern(
%
i). We revert it to
%
i."
\
"This won't change the result, but may make it slower."
"This won't change the result, but may make it slower."
_
warn
(
warnstr
%
(
self
.
unroll_kern
,
self
.
nkern
,
new
)
)
_
logger
.
warn
(
warnstr
,
self
.
unroll_kern
,
self
.
nkern
,
new
)
self
.
unroll_kern
=
new
self
.
unroll_kern
=
new
if
all_shape
:
if
all_shape
:
...
@@ -466,7 +462,11 @@ class ConvOp(Op):
...
@@ -466,7 +462,11 @@ class ConvOp(Op):
self
.
unroll_kern
=
self
.
speed_unroll_batch_kern
[
time_unroll_batch_kern_idx
][
1
]
self
.
unroll_kern
=
self
.
speed_unroll_batch_kern
[
time_unroll_batch_kern_idx
][
1
]
self
.
unroll_patch
=
False
self
.
unroll_patch
=
False
_debug
(
"AUTO FIND VERSION OF C_CODE OF CONV OP"
,
self
.
unroll_batch
,
self
.
unroll_kern
,
self
.
unroll_patch
,
self
.
bsize
,
self
.
nkern
,
time_unroll_patch
,
time_unroll_batch_kern
)
_logger
.
debug
(
"AUTO FIND VERSION OF C_CODE OF CONV OP "
"
%
s
%
s
%
s
%
s
%
s
%
s
%
s"
,
self
.
unroll_batch
,
self
.
unroll_kern
,
self
.
unroll_patch
,
self
.
bsize
,
self
.
nkern
,
time_unroll_patch
,
time_unroll_batch_kern
)
self
.
_rehash
()
self
.
_rehash
()
...
@@ -764,7 +764,7 @@ class ConvOp(Op):
...
@@ -764,7 +764,7 @@ class ConvOp(Op):
un_b
=
bsize
un_b
=
bsize
else
:
else
:
un_b
=
1
un_b
=
1
_
warn
(
"OPTIMISATION WARNING
: in ConvOp.grad() we can't determine "
\
_
logger
.
warn
(
"Optimization Warning
: in ConvOp.grad() we can't determine "
\
"a good unroll value for the batch. Maybe you can optimize this!"
)
"a good unroll value for the batch. Maybe you can optimize this!"
)
if
all_shape
and
un_k
!=
0
and
nkern
%
un_k
!=
0
:
if
all_shape
and
un_k
!=
0
and
nkern
%
un_k
!=
0
:
...
@@ -772,7 +772,7 @@ class ConvOp(Op):
...
@@ -772,7 +772,7 @@ class ConvOp(Op):
un_k
=
nkern
un_k
=
nkern
else
:
else
:
un_k
=
1
un_k
=
1
_
warn
(
"OPTIMISATION WARNING
: in ConvOp.grad() we can't determine "
\
_
logger
.
warn
(
"Optimization Warning
: in ConvOp.grad() we can't determine "
\
"a good unroll value for the kernel. Maybe you can optimize this!"
)
"a good unroll value for the kernel. Maybe you can optimize this!"
)
dw
=
ConvOp
(
imshp
,
kshp
,
nkern
,
bsize
,
1
,
1
,
output_mode
=
'valid'
,
dw
=
ConvOp
(
imshp
,
kshp
,
nkern
,
bsize
,
1
,
1
,
output_mode
=
'valid'
,
...
@@ -983,18 +983,18 @@ using namespace std;
...
@@ -983,18 +983,18 @@ using namespace std;
if
self
.
imshp
!=
self
.
imshp_logical
or
self
.
kshp
!=
self
.
kshp_logical
:
if
self
.
imshp
!=
self
.
imshp_logical
or
self
.
kshp
!=
self
.
kshp_logical
:
if
self
.
verbose
:
if
self
.
verbose
:
_debug
(
"return imshp!=imshp_logical or self.kshp != self.kshp_logical shape version"
)
_
logger
.
debug
(
"return imshp!=imshp_logical or self.kshp != self.kshp_logical shape version"
)
return
_conv_op_code_a
%
d
return
_conv_op_code_a
%
d
if
self
.
unroll_patch
:
if
self
.
unroll_patch
:
if
self
.
verbose
:
if
self
.
verbose
:
_
debug
(
"return unroll patch version. all_shape=
"
,
all_shape
)
_
logger
.
debug
(
"return unroll patch version. all_shape=
%
s
"
,
all_shape
)
return
_conv_op_code_unroll_patch
%
d
return
_conv_op_code_unroll_patch
%
d
if
self
.
unroll_batch
>
0
or
self
.
unroll_kern
>
0
:
if
self
.
unroll_batch
>
0
or
self
.
unroll_kern
>
0
:
assert
self
.
unroll_batch
>
0
assert
self
.
unroll_batch
>
0
assert
self
.
unroll_kern
>
0
assert
self
.
unroll_kern
>
0
if
self
.
verbose
:
if
self
.
verbose
:
_debug
(
"return unrolled batch (
%
s) and kern code (
%
s)"
,
_
logger
.
debug
(
"return unrolled batch (
%
s) and kern code (
%
s)"
,
str
(
self
.
unroll_batch
),
str
(
self
.
unroll_kern
))
str
(
self
.
unroll_batch
),
str
(
self
.
unroll_kern
))
return
gen_conv_code_unroll_batch_kern
(
d
,
self
.
unroll_batch
,
return
gen_conv_code_unroll_batch_kern
(
d
,
self
.
unroll_batch
,
self
.
unroll_kern
)
self
.
unroll_kern
)
...
@@ -1002,11 +1002,11 @@ using namespace std;
...
@@ -1002,11 +1002,11 @@ using namespace std;
#TODO: should we choose the unroll size automatically with the bigger divisor under 5?
#TODO: should we choose the unroll size automatically with the bigger divisor under 5?
if
self
.
out_mode
==
'valid'
and
self
.
dx
==
0
and
self
.
dy
==
0
:
if
self
.
out_mode
==
'valid'
and
self
.
dx
==
0
and
self
.
dy
==
0
:
if
self
.
verbose
:
if
self
.
verbose
:
_debug
(
"return gemm version"
)
_
logger
.
debug
(
"return gemm version"
)
return
_conv_op_code_valid_gemm
%
d
return
_conv_op_code_valid_gemm
%
d
else
:
else
:
if
self
.
verbose
:
if
self
.
verbose
:
_debug
(
"return no gemm version"
)
_
logger
.
debug
(
"return no gemm version"
)
return
_conv_op_code_a
%
d
return
_conv_op_code_a
%
d
...
...
theano/tensor/signal/conv.py
浏览文件 @
b2e9ea5d
...
@@ -14,10 +14,6 @@ from theano.tensor.nnet import conv
...
@@ -14,10 +14,6 @@ from theano.tensor.nnet import conv
import
logging
import
logging
_logger
=
logging
.
getLogger
(
"theano.tensor.signal.conv"
)
_logger
=
logging
.
getLogger
(
"theano.tensor.signal.conv"
)
def
_debug
(
*
msg
):
_logger
.
debug
(
' '
.
join
(
msg
))
def
_warn
(
*
msg
):
_logger
.
warn
(
' '
.
join
(
msg
))
def
conv2d
(
input
,
filters
,
image_shape
=
None
,
filter_shape
=
None
,
def
conv2d
(
input
,
filters
,
image_shape
=
None
,
filter_shape
=
None
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论