Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1d3454fa
Unverified
提交
1d3454fa
authored
10月 07, 2020
作者:
Brandon T. Willard
提交者:
GitHub
10月 07, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #85 from pymc-devs/fix-84
Stop importing test suite from __init__
上级
295ea57d
21a993ea
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
78 行增加
和
117 行删除
+78
-117
debug_faq.txt
doc/tutorial/debug_faq.txt
+2
-2
setup.cfg
setup.cfg
+0
-1
test_basic_ops.py
tests/gpuarray/test_basic_ops.py
+1
-1
test_gemmcorr.py
tests/gpuarray/test_gemmcorr.py
+2
-2
test_opt.py
tests/gpuarray/test_opt.py
+1
-1
test_type.py
tests/gpuarray/test_type.py
+1
-1
test_breakpoint.py
tests/test_breakpoint.py
+2
-1
unittest_tools.py
tests/unittest_tools.py
+1
-66
__init__.py
theano/__init__.py
+0
-4
breakpoint.py
theano/breakpoint.py
+1
-1
debugmode.py
theano/compile/debugmode.py
+66
-4
opt.py
theano/gpuarray/opt.py
+1
-1
__init__.py
theano/sandbox/cuda/__init__.py
+0
-9
truedot.py
theano/sparse/sandbox/truedot.py
+0
-23
没有找到文件。
doc/tutorial/debug_faq.txt
浏览文件 @
1d3454fa
...
...
@@ -607,7 +607,7 @@ Breakpoint during Theano function execution
-------------------------------------------
You can set a breakpoint during the execution of a Theano function with
:class:`PdbBreakpoint <t
ests
.breakpoint.PdbBreakpoint>`.
:class:`PdbBreakpoint <t
ests
.breakpoint.PdbBreakpoint>` automatically
:class:`PdbBreakpoint <t
heano
.breakpoint.PdbBreakpoint>`.
:class:`PdbBreakpoint <t
heano
.breakpoint.PdbBreakpoint>` automatically
detects available debuggers and uses the first available in the following order:
`pudb`, `ipdb`, or `pdb`.
setup.cfg
浏览文件 @
1d3454fa
[flake8]
ignore=E501,E123,E133,FI12,FI14,FI15,FI50,FI51,FI53,W503,W504,E203,C901,E231,E741
per-file-ignores =
theano/sparse/sandbox/truedot.py:F401
theano/sparse/sandbox/sp2.py:F401
tests/sparse/test_basic.py:E402
tests/sparse/test_opt.py:E402
...
...
tests/gpuarray/test_basic_ops.py
浏览文件 @
1d3454fa
...
...
@@ -32,7 +32,7 @@ from theano.gpuarray.subtensor import GpuSubtensor
from
tests
import
unittest_tools
as
utt
from
tests.gpuarray.config
import
mode_with_gpu
,
mode_without_gpu
,
test_ctx_name
from
tests.t
heano.t
ensor.test_basic
import
(
from
tests.tensor.test_basic
import
(
rand
,
safe_make_node
,
TestAlloc
,
...
...
tests/gpuarray/test_gemmcorr.py
浏览文件 @
1d3454fa
...
...
@@ -9,11 +9,11 @@ from theano.gpuarray.blas import GpuCorrMM, GpuCorrMM_gradWeights, GpuCorrMM_gra
from
tests
import
unittest_tools
as
utt
from
tests.gpuarray.config
import
mode_with_gpu
,
mode_without_gpu
,
ref_cast
from
tests.t
heano.t
ensor.nnet.test_abstract_conv
import
(
from
tests.tensor.nnet.test_abstract_conv
import
(
TestGroupedConvNoOptim
,
TestUnsharedConv
,
)
from
tests.tensor.nnet.t
heano.t
est_abstract_conv
import
(
from
tests.tensor.nnet.test_abstract_conv
import
(
TestAsymmetricPadding
,
TestCausalConv
,
)
...
...
tests/gpuarray/test_opt.py
浏览文件 @
1d3454fa
...
...
@@ -9,6 +9,7 @@ import theano.tensor.slinalg as slinalg
from
theano
import
tensor
from
theano.gof.opt
import
check_stack_trace
from
theano.tensor.nnet
import
abstract_conv
from
theano.breakpoint
import
PdbBreakpoint
from
theano.gpuarray
import
basic_ops
from
theano.gpuarray.type
import
GpuArrayType
,
gpuarray_shared_constructor
,
get_context
from
theano.gpuarray.basic_ops
import
(
...
...
@@ -34,7 +35,6 @@ from theano.gpuarray.linalg import GpuCusolverSolve, cusolver_available, GpuChol
from
tests
import
unittest_tools
as
utt
,
test_ifelse
from
tests.tensor
import
test_basic
from
tests.breakpoint
import
PdbBreakpoint
from
tests.gpuarray.config
import
mode_with_gpu
,
mode_without_gpu
,
test_ctx_name
...
...
tests/gpuarray/test_type.py
浏览文件 @
1d3454fa
...
...
@@ -15,7 +15,7 @@ from tests.gpuarray.config import test_ctx_name
from
tests.gpuarray.test_basic_ops
import
rand_gpuarray
# Disabled for now
# from tests.t
heano.t
ensor.test_sharedvar import makeSharedTester
# from tests.tensor.test_sharedvar import makeSharedTester
def
test_deep_copy
():
...
...
tests/test_breakpoint.py
浏览文件 @
1d3454fa
...
...
@@ -3,8 +3,9 @@ import numpy as np
import
theano
import
theano.tensor
as
T
from
theano.breakpoint
import
PdbBreakpoint
from
tests
import
unittest_tools
as
utt
from
tests.breakpoint
import
PdbBreakpoint
class
TestPdbBreakpoint
(
utt
.
InferShapeTester
):
...
...
tests/unittest_tools.py
浏览文件 @
1d3454fa
...
...
@@ -12,9 +12,9 @@ from functools import wraps
from
copy
import
copy
,
deepcopy
from
six
import
integer_types
from
six.moves
import
StringIO
from
theano
import
config
from
theano.compile.debugmode
import
str_diagnostic
_logger
=
logging
.
getLogger
(
"tests.unittest_tools"
)
...
...
@@ -282,71 +282,6 @@ class InferShapeTester:
assert
np
.
all
(
out
.
shape
==
shape
),
(
out
.
shape
,
shape
)
def
str_diagnostic
(
expected
,
value
,
rtol
,
atol
):
"""Return a pretty multiline string representating the cause
of the exception"""
sio
=
StringIO
()
try
:
ssio
=
StringIO
()
print
(
" : shape, dtype, strides, min, max, n_inf, n_nan:"
,
file
=
ssio
)
print
(
" Expected :"
,
end
=
" "
,
file
=
ssio
)
print
(
expected
.
shape
,
end
=
" "
,
file
=
ssio
)
print
(
expected
.
dtype
,
end
=
" "
,
file
=
ssio
)
print
(
expected
.
strides
,
end
=
" "
,
file
=
ssio
)
print
(
expected
.
min
(),
end
=
" "
,
file
=
ssio
)
print
(
expected
.
max
(),
end
=
" "
,
file
=
ssio
)
print
(
np
.
isinf
(
expected
)
.
sum
(),
end
=
" "
,
file
=
ssio
)
print
(
np
.
isnan
(
expected
)
.
sum
(),
end
=
" "
,
file
=
ssio
)
# only if all succeeds to we add anything to sio
print
(
ssio
.
getvalue
(),
file
=
sio
)
except
Exception
:
pass
try
:
ssio
=
StringIO
()
print
(
" Value :"
,
end
=
" "
,
file
=
ssio
)
print
(
value
.
shape
,
end
=
" "
,
file
=
ssio
)
print
(
value
.
dtype
,
end
=
" "
,
file
=
ssio
)
print
(
value
.
strides
,
end
=
" "
,
file
=
ssio
)
print
(
value
.
min
(),
end
=
" "
,
file
=
ssio
)
print
(
value
.
max
(),
end
=
" "
,
file
=
ssio
)
print
(
np
.
isinf
(
value
)
.
sum
(),
end
=
" "
,
file
=
ssio
)
print
(
np
.
isnan
(
value
)
.
sum
(),
end
=
" "
,
file
=
ssio
)
# only if all succeeds to we add anything to sio
print
(
ssio
.
getvalue
(),
file
=
sio
)
except
Exception
:
pass
print
(
" expected :"
,
expected
,
file
=
sio
)
print
(
" value :"
,
value
,
file
=
sio
)
try
:
ov
=
np
.
asarray
(
expected
)
nv
=
np
.
asarray
(
value
)
ssio
=
StringIO
()
absdiff
=
np
.
absolute
(
nv
-
ov
)
print
(
" Max Abs Diff: "
,
np
.
max
(
absdiff
),
file
=
ssio
)
print
(
" Mean Abs Diff: "
,
np
.
mean
(
absdiff
),
file
=
ssio
)
print
(
" Median Abs Diff: "
,
np
.
median
(
absdiff
),
file
=
ssio
)
print
(
" Std Abs Diff: "
,
np
.
std
(
absdiff
),
file
=
ssio
)
reldiff
=
np
.
absolute
(
nv
-
ov
)
/
np
.
absolute
(
ov
)
print
(
" Max Rel Diff: "
,
np
.
max
(
reldiff
),
file
=
ssio
)
print
(
" Mean Rel Diff: "
,
np
.
mean
(
reldiff
),
file
=
ssio
)
print
(
" Median Rel Diff: "
,
np
.
median
(
reldiff
),
file
=
ssio
)
print
(
" Std Rel Diff: "
,
np
.
std
(
reldiff
),
file
=
ssio
)
# only if all succeeds to we add anything to sio
print
(
ssio
.
getvalue
(),
file
=
sio
)
except
Exception
:
pass
atol_
,
rtol_
=
T
.
basic
.
_get_atol_rtol
(
expected
,
value
)
if
rtol
is
not
None
:
rtol_
=
rtol
if
atol
is
not
None
:
atol_
=
atol
print
(
" rtol, atol:"
,
rtol_
,
atol_
,
file
=
sio
)
return
sio
.
getvalue
()
class
WrongValue
(
Exception
):
def
__init__
(
self
,
expected_val
,
val
,
rtol
,
atol
):
Exception
.
__init__
(
self
)
# to be compatible with python2.4
...
...
theano/__init__.py
浏览文件 @
1d3454fa
...
...
@@ -165,10 +165,6 @@ from theano.updates import OrderedUpdates
from
theano.gradient
import
Rop
,
Lop
,
grad
,
subgraph_grad
# This need to be before the init of GPU, as it add config variable
# needed during that phase.
import
tests
if
(
config
.
device
.
startswith
(
"cuda"
)
or
config
.
device
.
startswith
(
"opencl"
)
...
...
t
ests
/breakpoint.py
→
t
heano
/breakpoint.py
浏览文件 @
1d3454fa
...
...
@@ -36,7 +36,7 @@ class PdbBreakpoint(Op):
import theano
import theano.tensor as T
from t
ests
.breakpoint import PdbBreakpoint
from t
heano
.breakpoint import PdbBreakpoint
input = T.fvector()
target = T.fvector()
...
...
theano/compile/debugmode.py
浏览文件 @
1d3454fa
...
...
@@ -157,10 +157,7 @@ class BadThunkOutput(DebugModeError):
print
(
" thunk1 :"
,
self
.
thunk1
,
file
=
sio
)
print
(
" thunk2 :"
,
self
.
thunk2
,
file
=
sio
)
# Don't import it at the top of the file to prevent circular import.
import
tests.unittest_tools
as
utt
print
(
utt
.
str_diagnostic
(
self
.
val1
,
self
.
val2
,
None
,
None
),
file
=
sio
)
print
(
str_diagnostic
(
self
.
val1
,
self
.
val2
,
None
,
None
),
file
=
sio
)
ret
=
sio
.
getvalue
()
return
ret
...
...
@@ -382,6 +379,71 @@ class InvalidValueError(DebugModeError):
########################
def
str_diagnostic
(
expected
,
value
,
rtol
,
atol
):
"""Return a pretty multiline string representating the cause
of the exception"""
sio
=
StringIO
()
try
:
ssio
=
StringIO
()
print
(
" : shape, dtype, strides, min, max, n_inf, n_nan:"
,
file
=
ssio
)
print
(
" Expected :"
,
end
=
" "
,
file
=
ssio
)
print
(
expected
.
shape
,
end
=
" "
,
file
=
ssio
)
print
(
expected
.
dtype
,
end
=
" "
,
file
=
ssio
)
print
(
expected
.
strides
,
end
=
" "
,
file
=
ssio
)
print
(
expected
.
min
(),
end
=
" "
,
file
=
ssio
)
print
(
expected
.
max
(),
end
=
" "
,
file
=
ssio
)
print
(
np
.
isinf
(
expected
)
.
sum
(),
end
=
" "
,
file
=
ssio
)
print
(
np
.
isnan
(
expected
)
.
sum
(),
end
=
" "
,
file
=
ssio
)
# only if all succeeds to we add anything to sio
print
(
ssio
.
getvalue
(),
file
=
sio
)
except
Exception
:
pass
try
:
ssio
=
StringIO
()
print
(
" Value :"
,
end
=
" "
,
file
=
ssio
)
print
(
value
.
shape
,
end
=
" "
,
file
=
ssio
)
print
(
value
.
dtype
,
end
=
" "
,
file
=
ssio
)
print
(
value
.
strides
,
end
=
" "
,
file
=
ssio
)
print
(
value
.
min
(),
end
=
" "
,
file
=
ssio
)
print
(
value
.
max
(),
end
=
" "
,
file
=
ssio
)
print
(
np
.
isinf
(
value
)
.
sum
(),
end
=
" "
,
file
=
ssio
)
print
(
np
.
isnan
(
value
)
.
sum
(),
end
=
" "
,
file
=
ssio
)
# only if all succeeds to we add anything to sio
print
(
ssio
.
getvalue
(),
file
=
sio
)
except
Exception
:
pass
print
(
" expected :"
,
expected
,
file
=
sio
)
print
(
" value :"
,
value
,
file
=
sio
)
try
:
ov
=
np
.
asarray
(
expected
)
nv
=
np
.
asarray
(
value
)
ssio
=
StringIO
()
absdiff
=
np
.
absolute
(
nv
-
ov
)
print
(
" Max Abs Diff: "
,
np
.
max
(
absdiff
),
file
=
ssio
)
print
(
" Mean Abs Diff: "
,
np
.
mean
(
absdiff
),
file
=
ssio
)
print
(
" Median Abs Diff: "
,
np
.
median
(
absdiff
),
file
=
ssio
)
print
(
" Std Abs Diff: "
,
np
.
std
(
absdiff
),
file
=
ssio
)
reldiff
=
np
.
absolute
(
nv
-
ov
)
/
np
.
absolute
(
ov
)
print
(
" Max Rel Diff: "
,
np
.
max
(
reldiff
),
file
=
ssio
)
print
(
" Mean Rel Diff: "
,
np
.
mean
(
reldiff
),
file
=
ssio
)
print
(
" Median Rel Diff: "
,
np
.
median
(
reldiff
),
file
=
ssio
)
print
(
" Std Rel Diff: "
,
np
.
std
(
reldiff
),
file
=
ssio
)
# only if all succeeds to we add anything to sio
print
(
ssio
.
getvalue
(),
file
=
sio
)
except
Exception
:
pass
atol_
,
rtol_
=
theano
.
tensor
.
basic
.
_get_atol_rtol
(
expected
,
value
)
if
rtol
is
not
None
:
rtol_
=
rtol
if
atol
is
not
None
:
atol_
=
atol
print
(
" rtol, atol:"
,
rtol_
,
atol_
,
file
=
sio
)
return
sio
.
getvalue
()
def
char_from_number
(
number
):
"""
Converts number to string by rendering it in base 26 using
...
...
theano/gpuarray/opt.py
浏览文件 @
1d3454fa
...
...
@@ -51,7 +51,7 @@ import theano.tensor.signal.pool as pool
import
theano.tensor.slinalg
as
slinalg
from
collections
import
Counter
from
t
ests
.breakpoint
import
PdbBreakpoint
from
t
heano
.breakpoint
import
PdbBreakpoint
from
.type
import
(
GpuArrayType
,
...
...
theano/sandbox/cuda/__init__.py
deleted
100644 → 0
浏览文件 @
295ea57d
import
pytest
pytest
.
skip
(
"You are importing theano.sandbox.cuda. This is the old GPU back-end and "
"is removed from Theano. Use Theano 0.9 to use it. Even better, "
"transition to the new GPU back-end! See "
"https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end
%28
gpuarray
%29
"
,
allow_module_level
=
True
,
)
theano/sparse/sandbox/truedot.py
deleted
100644 → 0
浏览文件 @
295ea57d
import
theano
import
numpy
as
np
import
scipy.sparse
as
sp
from
theano
import
sparse
from
theano
import
gof
,
tensor
,
compile
from
theano.sparse.basic
import
(
_is_sparse_variable
,
_is_dense_variable
,
as_sparse_variable
,
_is_sparse
,
_mtypes
,
_mtype_to_str
,
)
from
theano.sparse
import
SparseType
,
dense_from_sparse
,
transpose
from
tests
import
unittest_tools
as
utt
from
tests.sparse.test_basic
import
eval_outputs
from
tests.theano.sparse.test_basic
import
sparse_random_inputs
# To maintain compatibility
from
theano.sparse.basic
import
TrueDot
,
true_dot
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论