Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c2092862
提交
c2092862
authored
4月 03, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
5月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename Function.fn to Function.vm
上级
d39b852a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
70 行增加
和
68 行删除
+70
-68
types.py
aesara/compile/function/types.py
+0
-0
profiling.py
aesara/compile/profiling.py
+2
-2
basic.py
aesara/graph/basic.py
+2
-2
check_blas.py
aesara/misc/check_blas.py
+1
-1
printing.py
aesara/printing.py
+1
-1
rng_mrg.py
aesara/sandbox/rng_mrg.py
+2
-2
op.py
aesara/scan/op.py
+18
-18
opt.py
aesara/scan/opt.py
+2
-0
faq.rst
doc/faq.rst
+2
-2
debug_faq.rst
doc/tutorial/debug_faq.rst
+2
-2
profiling.rst
doc/tutorial/profiling.rst
+2
-2
profiling_example_out.prof
doc/tutorial/profiling_example_out.prof
+1
-1
test_types.py
tests/compile/function/test_types.py
+7
-7
test_numba.py
tests/link/test_numba.py
+4
-4
test_numba_performance.py
tests/link/test_numba_performance.py
+2
-2
test_vm.py
tests/link/test_vm.py
+16
-16
test_rng_mrg.py
tests/sandbox/test_rng_mrg.py
+1
-1
test_basic.py
tests/scan/test_basic.py
+4
-4
test_conv.py
tests/tensor/nnet/test_conv.py
+1
-1
没有找到文件。
aesara/compile/function/types.py
浏览文件 @
c2092862
差异被折叠。
点击展开。
aesara/compile/profiling.py
浏览文件 @
c2092862
...
...
@@ -217,7 +217,7 @@ class ProfileStats:
#
vm_call_time
=
0.0
# Total time spent in Function.
fn
.__call__
# Total time spent in Function.
vm
.__call__
#
apply_time
=
None
...
...
@@ -781,7 +781,7 @@ class ProfileStats:
)
if
self
.
fct_call_time
>
0
:
print
(
f
" Time in Function.
fn
.__call__: {self.vm_call_time}s ({100 * self.vm_call_time / self.fct_call_time:.3f}
%
)"
,
f
" Time in Function.
vm
.__call__: {self.vm_call_time}s ({100 * self.vm_call_time / self.fct_call_time:.3f}
%
)"
,
file
=
file
,
)
local_time
=
sum
(
self
.
apply_time
.
values
())
...
...
aesara/graph/basic.py
浏览文件 @
c2092862
...
...
@@ -1139,9 +1139,9 @@ def clone_replace(
Parameters
----------
output
: Aesara Variables (or Aesara expressions)
output
Aesara expression that represents the computational graph.
replace
: dict
replace
Dictionary describing which subgraphs should be replaced by what.
rebuild_kwds
Keywords to `rebuild_collect_shared`.
...
...
aesara/misc/check_blas.py
浏览文件 @
c2092862
...
...
@@ -59,7 +59,7 @@ def execute(execute=True, verbose=True, M=2000, N=2000, K=2000, iters=10, order=
if
any
(
x
.
op
.
__class__
.
__name__
==
"Gemm"
for
x
in
f
.
maker
.
fgraph
.
toposort
()):
c_impl
=
[
hasattr
(
thunk
,
"cthunk"
)
for
node
,
thunk
in
zip
(
f
.
fn
.
nodes
,
f
.
fn
.
thunks
)
for
node
,
thunk
in
zip
(
f
.
vm
.
nodes
,
f
.
vm
.
thunks
)
if
node
.
op
.
__class__
.
__name__
==
"Gemm"
]
assert
len
(
c_impl
)
==
1
...
...
aesara/printing.py
浏览文件 @
c2092862
...
...
@@ -222,7 +222,7 @@ def debugprint(
results_to_print
.
extend
(
obj
.
maker
.
fgraph
.
outputs
)
profile_list
.
extend
([
obj
.
profile
for
item
in
obj
.
maker
.
fgraph
.
outputs
])
if
print_storage
:
smap
.
extend
([
obj
.
fn
.
storage_map
for
item
in
obj
.
maker
.
fgraph
.
outputs
])
smap
.
extend
([
obj
.
vm
.
storage_map
for
item
in
obj
.
maker
.
fgraph
.
outputs
])
else
:
smap
.
extend
([
None
for
item
in
obj
.
maker
.
fgraph
.
outputs
])
topo
=
obj
.
maker
.
fgraph
.
toposort
()
...
...
aesara/sandbox/rng_mrg.py
浏览文件 @
c2092862
...
...
@@ -75,7 +75,7 @@ def multMatVect(v, A, m1, B, m2):
f
.
input_storage
[
3
]
.
storage
[
0
]
=
B
f
.
input_storage
[
4
]
.
storage
[
0
]
=
v
[
3
:]
f
.
input_storage
[
5
]
.
storage
[
0
]
=
m2
f
.
fn
()
f
.
vm
()
r
=
f
.
output_storage
[
0
]
.
storage
[
0
]
return
r
...
...
@@ -829,7 +829,7 @@ class MRG_RandomStream:
v
=
rval
[
i
-
1
]
f
.
input_storage
[
1
]
.
storage
[
0
]
=
v
[:
3
]
f
.
input_storage
[
4
]
.
storage
[
0
]
=
v
[
3
:]
f
.
fn
()
f
.
vm
()
rval
[
i
]
=
f
.
output_storage
[
0
]
.
storage
[
0
]
if
inc_rstate
:
...
...
aesara/scan/op.py
浏览文件 @
c2092862
...
...
@@ -1594,8 +1594,8 @@ class Scan(Op, ScanMethodsMixin, HasInnerGraph):
from
aesara.scan.utils
import
InnerFunctionError
# TODO: Extract `Capsule` object and use that
# c_thunk = getattr(self.fn.
fn
.thunks[0], "cthunk", None)
# if len(self.fn.
fn
.thunks) == 1 and c_thunk:
# c_thunk = getattr(self.fn.
vm
.thunks[0], "cthunk", None)
# if len(self.fn.
vm
.thunks) == 1 and c_thunk:
# thunk_capsule = c_thunk.cthunk
# # We need to perform the following after calling
# # the thunk function:
...
...
@@ -1633,20 +1633,20 @@ class Scan(Op, ScanMethodsMixin, HasInnerGraph):
outputs
,
outer_output_dtypes
,
outer_output_ndims
,
self
.
fn
.
fn
,
self
.
fn
.
vm
,
)
except
InnerFunctionError
as
exc
:
exc_type
=
type
(
exc
.
args
[
0
])
exc_value
=
exc
.
args
[
0
]
exc_trace
=
exc
.
args
[
1
]
if
hasattr
(
self
.
fn
.
fn
,
"position_of_error"
)
and
hasattr
(
self
.
fn
.
fn
,
"thunks"
if
hasattr
(
self
.
fn
.
vm
,
"position_of_error"
)
and
hasattr
(
self
.
fn
.
vm
,
"thunks"
):
raise_with_op
(
self
.
fn
.
maker
.
fgraph
,
self
.
fn
.
fn
.
nodes
[
self
.
fn
.
fn
.
position_of_error
],
self
.
fn
.
fn
.
thunks
[
self
.
fn
.
fn
.
position_of_error
],
self
.
fn
.
vm
.
nodes
[
self
.
fn
.
vm
.
position_of_error
],
self
.
fn
.
vm
.
thunks
[
self
.
fn
.
vm
.
position_of_error
],
exc_info
=
(
exc_type
,
exc_value
,
exc_trace
),
)
else
:
...
...
@@ -1661,8 +1661,8 @@ class Scan(Op, ScanMethodsMixin, HasInnerGraph):
profile
.
callcount
+=
1
profile
.
nbsteps
+=
n_steps
profile
.
call_time
+=
t_call
if
hasattr
(
self
.
fn
.
fn
,
"update_profile"
):
self
.
fn
.
fn
.
update_profile
(
profile
)
if
hasattr
(
self
.
fn
.
vm
,
"update_profile"
):
self
.
fn
.
vm
.
update_profile
(
profile
)
except
(
ImportError
,
MissingGXX
):
p
=
self
.
perform
...
...
@@ -1795,7 +1795,7 @@ class Scan(Op, ScanMethodsMixin, HasInnerGraph):
inner_output_storage
=
self
.
fn
.
output_storage
old_inner_output_storage
=
[
None
]
*
len
(
inner_output_storage
)
old_inner_output_data
=
[
None
]
*
len
(
inner_output_storage
)
fn
=
self
.
fn
.
fn
vm
=
self
.
fn
.
vm
offset
=
(
info
.
n_seqs
+
sum
(
...
...
@@ -1938,18 +1938,18 @@ class Scan(Op, ScanMethodsMixin, HasInnerGraph):
t0_fn
=
time
.
time
()
try
:
fn
()
vm
()
except
Exception
:
if
hasattr
(
fn
,
"position_of_error"
):
if
hasattr
(
vm
,
"position_of_error"
):
# this is a new vm-provided function or c linker
# they need this because the exception manipulation
# done by raise_with_op is not implemented in C.
if
hasattr
(
fn
,
"thunks"
):
if
hasattr
(
vm
,
"thunks"
):
# For the CVM
raise_with_op
(
self
.
fn
.
maker
.
fgraph
,
fn
.
nodes
[
fn
.
position_of_error
],
fn
.
thunks
[
fn
.
position_of_error
],
vm
.
nodes
[
vm
.
position_of_error
],
vm
.
thunks
[
vm
.
position_of_error
],
)
else
:
# For the c linker
...
...
@@ -1957,7 +1957,7 @@ class Scan(Op, ScanMethodsMixin, HasInnerGraph):
# temps values So for now, we just don't print
# the extra shapes/strides info
raise_with_op
(
self
.
fn
.
maker
.
fgraph
,
fn
.
nodes
[
fn
.
position_of_error
]
self
.
fn
.
maker
.
fgraph
,
vm
.
nodes
[
vm
.
position_of_error
]
)
else
:
# old-style linkers raise their own exceptions
...
...
@@ -2200,8 +2200,8 @@ class Scan(Op, ScanMethodsMixin, HasInnerGraph):
profile
.
nbsteps
+=
n_steps
profile
.
call_time
+=
t_call
profile
.
vm_call_time
+=
t_fn
if
hasattr
(
self
.
fn
.
fn
,
"update_profile"
):
self
.
fn
.
fn
.
update_profile
(
profile
)
if
hasattr
(
self
.
fn
.
vm
,
"update_profile"
):
self
.
fn
.
vm
.
update_profile
(
profile
)
self
.
t_call
=
t_call
self
.
t_fn
=
t_fn
...
...
aesara/scan/opt.py
浏览文件 @
c2092862
...
...
@@ -751,6 +751,8 @@ def add_nitsot_outputs(
new_outputs_inner
,
)
->
Tuple
[
Apply
,
Dict
[
Variable
,
Variable
]]:
assert
isinstance
(
old_scan_node
.
op
,
Scan
)
nb_new_outs
=
len
(
new_outputs_inner
)
# Create the initial values for the new nitsot outputs
...
...
doc/faq.rst
浏览文件 @
c2092862
...
...
@@ -141,8 +141,8 @@ with
Also, for small Aesara functions, you can remove more Python overhead by
making an Aesara function that does not take any input. You can use shared
variables to achieve this. Then you can call it like this: ``f.
fn
()`` or
``f.
fn
(n_calls=N)`` to speed it up. In the last case, only the last
variables to achieve this. Then you can call it like this: ``f.
vm
()`` or
``f.
vm
(n_calls=N)`` to speed it up. In the last case, only the last
function output (out of N calls) is returned.
You can also use the ``C`` linker that will put all nodes in the same C
...
...
doc/tutorial/debug_faq.rst
浏览文件 @
c2092862
...
...
@@ -140,9 +140,9 @@ Running the above code generates the following error message:
File "test1.py", line 31, in <module>
f(np.random.random((5, 10)))
File "PATH_TO_AESARA/aesara/compile/function/types.py", line 605, in __call__
self.
fn.thunks[self.fn
.position_of_error])
self.
vm.thunks[self.vm
.position_of_error])
File "PATH_TO_AESARA/aesara/compile/function/types.py", line 595, in __call__
outputs = self.
fn
()
outputs = self.
vm
()
ValueError: Shape mismatch: x has 10 cols (and 5 rows) but y has 20 rows (and 10 cols)
Apply node that caused the error: Dot22(x, DimShuffle{1,0}.0)
Inputs types: [TensorType(float64, (None, None)), TensorType(float64, (None, None))]
...
...
doc/tutorial/profiling.rst
浏览文件 @
c2092862
...
...
@@ -52,8 +52,8 @@ function. aesara.function() has an optional parameter ``name`` that
defaults to None. Change it to something else to help you profile many
Aesara functions. In that section, we also see the number of times the
function was called (1) and the total time spent in all those
calls. The time spent in
Function.fn.__call__
and in thunks is useful
to understand Aesara overhead.
calls. The time spent in
:meth:`Function.vm.__call__`
and in thunks is useful
to understand Aesara
's
overhead.
Also, we see the time spent in the two parts of the compilation
process: optimization (modify the graph to make it more stable/faster)
...
...
doc/tutorial/profiling_example_out.prof
浏览文件 @
c2092862
...
...
@@ -2,7 +2,7 @@ Function profiling
==================
Message: None
Time in 1 calls to Function.__call__: 5.698204e-05s
Time in Function.
fn
.__call__: 1.192093e-05s (20.921%)
Time in Function.
vm
.__call__: 1.192093e-05s (20.921%)
Time in thunks: 6.198883e-06s (10.879%)
Total compile time: 3.642474e+00s
Aesara Optimizer time: 7.326508e-02s
...
...
tests/compile/function/test_types.py
浏览文件 @
c2092862
...
...
@@ -346,8 +346,8 @@ class TestFunction:
cpy
=
ori
.
copy
(
share_memory
=
True
)
# Test if memories shared
storage_map_ori
=
ori
.
fn
.
storage_map
storage_map_cpy
=
cpy
.
fn
.
storage_map
storage_map_ori
=
ori
.
vm
.
storage_map
storage_map_cpy
=
cpy
.
vm
.
storage_map
fgraph_cpy
=
cpy
.
maker
.
fgraph
# Assert intermediate and Constants storages are shared.
...
...
@@ -424,11 +424,11 @@ class TestFunction:
# 2. SharedVariable is updatable -> values did update(z == 5)
# 1. sharedvariable is swap -> Rpl sharedvariables share storage
names
=
map_SV
.
keys
()
for
key
in
cpy
.
fn
.
storage_map
:
for
key
in
cpy
.
vm
.
storage_map
:
if
key
.
name
in
names
:
assert
(
map_SV
[
key
.
name
]
.
container
.
storage
[
0
]
==
cpy
.
fn
.
storage_map
[
key
][
0
]
==
cpy
.
vm
.
storage_map
[
key
][
0
]
)
second_time
=
True
...
...
@@ -688,18 +688,18 @@ class TestFunction:
x
=
vector
(
"x"
)
func
=
function
([
x
],
x
+
1
)
func
.
fn
.
allow_gc
=
False
func
.
vm
.
allow_gc
=
False
func
([
1
])
check_list
=
[]
for
key
,
val
in
func
.
fn
.
storage_map
.
items
():
for
key
,
val
in
func
.
vm
.
storage_map
.
items
():
if
not
isinstance
(
key
,
Constant
):
check_list
.
append
(
val
)
assert
any
(
val
[
0
]
for
val
in
check_list
)
func
.
free
()
for
key
,
val
in
func
.
fn
.
storage_map
.
items
():
for
key
,
val
in
func
.
vm
.
storage_map
.
items
():
if
not
isinstance
(
key
,
Constant
):
assert
val
[
0
]
is
None
...
...
tests/link/test_numba.py
浏览文件 @
c2092862
...
...
@@ -3505,7 +3505,7 @@ def test_config_options_parallel():
with
config
.
change_flags
(
numba__vectorize_target
=
"parallel"
):
aesara_numba_fn
=
function
([
x
],
x
*
2
,
mode
=
numba_mode
)
numba_mul_fn
=
aesara_numba_fn
.
fn
.
jit_fn
.
py_func
.
__globals__
[
"mul"
]
numba_mul_fn
=
aesara_numba_fn
.
vm
.
jit_fn
.
py_func
.
__globals__
[
"mul"
]
assert
numba_mul_fn
.
targetoptions
[
"parallel"
]
is
True
...
...
@@ -3514,7 +3514,7 @@ def test_config_options_fastmath():
with
config
.
change_flags
(
numba__fastmath
=
True
):
aesara_numba_fn
=
function
([
x
],
x
*
2
,
mode
=
numba_mode
)
numba_mul_fn
=
aesara_numba_fn
.
fn
.
jit_fn
.
py_func
.
__globals__
[
"mul"
]
numba_mul_fn
=
aesara_numba_fn
.
vm
.
jit_fn
.
py_func
.
__globals__
[
"mul"
]
assert
numba_mul_fn
.
targetoptions
[
"fastmath"
]
is
True
...
...
@@ -3523,12 +3523,12 @@ def test_config_options_cached():
with
config
.
change_flags
(
numba__cache
=
True
):
aesara_numba_fn
=
function
([
x
],
x
*
2
,
mode
=
numba_mode
)
numba_mul_fn
=
aesara_numba_fn
.
fn
.
jit_fn
.
py_func
.
__globals__
[
"mul"
]
numba_mul_fn
=
aesara_numba_fn
.
vm
.
jit_fn
.
py_func
.
__globals__
[
"mul"
]
assert
not
isinstance
(
numba_mul_fn
.
_dispatcher
.
cache
,
numba
.
core
.
caching
.
NullCache
)
with
config
.
change_flags
(
numba__cache
=
False
):
aesara_numba_fn
=
function
([
x
],
x
*
2
,
mode
=
numba_mode
)
numba_mul_fn
=
aesara_numba_fn
.
fn
.
jit_fn
.
py_func
.
__globals__
[
"mul"
]
numba_mul_fn
=
aesara_numba_fn
.
vm
.
jit_fn
.
py_func
.
__globals__
[
"mul"
]
assert
isinstance
(
numba_mul_fn
.
_dispatcher
.
cache
,
numba
.
core
.
caching
.
NullCache
)
tests/link/test_numba_performance.py
浏览文件 @
c2092862
...
...
@@ -52,11 +52,11 @@ def test_careduce_performance(careduce_fn, numpy_fn, axis, inputs, input_vals):
assert
np
.
array_equal
(
numba_res
,
numpy_res
)
# FYI: To test the Numba JITed function directly, use `aesara_numba_fn.
fn
.jit_fn`
# FYI: To test the Numba JITed function directly, use `aesara_numba_fn.
vm
.jit_fn`
numpy_timer
=
timeit
.
Timer
(
"numpy_fn(*input_vals)"
,
"pass"
,
globals
=
locals
())
numba_timer
=
timeit
.
Timer
(
"aesara_numba_fn.
fn
.jit_fn(*input_vals)"
,
"pass"
,
globals
=
locals
()
"aesara_numba_fn.
vm
.jit_fn(*input_vals)"
,
"pass"
,
globals
=
locals
()
)
# c_timer = timeit.Timer("aesara_c_fn(*input_vals)", "pass", globals=locals())
...
...
tests/link/test_vm.py
浏览文件 @
c2092862
...
...
@@ -86,7 +86,7 @@ def test_use_c_thunks():
),
)
assert
np
.
array_equal
(
a
*
b
,
f
(
a
,
b
))
assert
any
(
hasattr
(
t
,
"cthunk"
)
for
t
in
f
.
fn
.
thunks
)
==
use_c_thunks
assert
any
(
hasattr
(
t
,
"cthunk"
)
for
t
in
f
.
vm
.
thunks
)
==
use_c_thunks
@pytest.mark.skipif
(
...
...
@@ -215,9 +215,9 @@ def test_partial_function(linker):
if
linker
==
"cvm"
:
from
aesara.link.c.cvm
import
CVM
assert
isinstance
(
f
.
fn
,
CVM
)
assert
isinstance
(
f
.
vm
,
CVM
)
else
:
assert
isinstance
(
f
.
fn
,
Stack
)
assert
isinstance
(
f
.
vm
,
Stack
)
assert
f
(
3
,
output_subset
=
[
0
,
1
,
2
])
==
f
(
3
)
assert
f
(
4
,
output_subset
=
[
0
,
2
])
==
[
f
(
4
)[
0
],
f
(
4
)[
2
]]
...
...
@@ -277,17 +277,17 @@ def test_allow_gc_cvm():
f
([
1
])
n
=
list
(
f
.
maker
.
fgraph
.
apply_nodes
)[
0
]
.
outputs
[
0
]
assert
f
.
fn
.
storage_map
[
n
][
0
]
is
None
assert
f
.
fn
.
allow_gc
is
True
assert
f
.
vm
.
storage_map
[
n
][
0
]
is
None
assert
f
.
vm
.
allow_gc
is
True
f
.
fn
.
allow_gc
=
False
assert
f
.
fn
.
allow_gc
is
False
f
.
vm
.
allow_gc
=
False
assert
f
.
vm
.
allow_gc
is
False
f
([
1
])
assert
f
.
fn
.
storage_map
[
n
][
0
]
is
not
None
f
.
fn
.
allow_gc
=
True
assert
f
.
fn
.
allow_gc
is
True
assert
f
.
vm
.
storage_map
[
n
][
0
]
is
not
None
f
.
vm
.
allow_gc
=
True
assert
f
.
vm
.
allow_gc
is
True
f
([
1
])
assert
f
.
fn
.
storage_map
[
n
][
0
]
is
None
assert
f
.
vm
.
storage_map
[
n
][
0
]
is
None
class
RunOnce
(
Op
):
...
...
@@ -334,7 +334,7 @@ def test_reallocation():
f
=
function
([
x
,
y
],
z
,
name
=
"test_reduce_memory"
,
mode
=
m
)
output
=
f
(
1
,
2
)
assert
output
storage_map
=
f
.
fn
.
storage_map
storage_map
=
f
.
vm
.
storage_map
def
check_storage
(
storage_map
):
for
i
in
storage_map
:
...
...
@@ -365,8 +365,8 @@ def test_no_recycling():
mode
=
Mode
(
optimizer
=
"fast_compile"
,
linker
=
lnk
)
f
=
function
([
x
],
x
+
1
,
mode
=
mode
)
f2
=
function
([
x
],
(
x
+
1
)
*
2
,
mode
=
mode
)
m1
=
f
.
fn
.
thunks
[
0
]
.
thunk
.
module
m2
=
f2
.
fn
.
thunks
[
0
]
.
thunk
.
module
m1
=
f
.
vm
.
thunks
[
0
]
.
thunk
.
module
m2
=
f2
.
vm
.
thunks
[
0
]
.
thunk
.
module
assert
m1
is
m2
...
...
@@ -381,7 +381,7 @@ def test_VMLinker_make_vm_cvm():
linker
=
VMLinker
(
allow_gc
=
False
,
use_cloop
=
True
)
f
=
function
([
a
],
a
,
mode
=
Mode
(
optimizer
=
None
,
linker
=
linker
))
assert
isinstance
(
f
.
fn
,
CVM
)
assert
isinstance
(
f
.
vm
,
CVM
)
def
test_VMLinker_make_vm_no_cvm
():
...
...
@@ -405,7 +405,7 @@ def test_VMLinker_make_vm_no_cvm():
import
aesara.link.c.cvm
f
=
function
([
a
],
a
,
mode
=
Mode
(
optimizer
=
None
,
linker
=
linker
))
assert
isinstance
(
f
.
fn
,
Loop
)
assert
isinstance
(
f
.
vm
,
Loop
)
def
test_VMLinker_exception
():
...
...
tests/sandbox/test_rng_mrg.py
浏览文件 @
c2092862
...
...
@@ -916,7 +916,7 @@ def test_multMatVect():
r_a1
=
rng_mrg
.
matVecModM
(
A1
,
s1
,
m1
)
r_a2
=
rng_mrg
.
matVecModM
(
A2
,
s2
,
m2
)
f0
.
fn
()
f0
.
vm
()
r_b
=
f0
.
output_storage
[
0
]
.
value
assert
np
.
allclose
(
r_a1
,
r_b
[:
3
])
...
...
tests/scan/test_basic.py
浏览文件 @
c2092862
...
...
@@ -2702,8 +2702,8 @@ def test_profile_info():
assert
profile
.
callcount
==
0
assert
profile
.
nbsteps
==
0
assert
profile
.
call_time
==
0.0
assert
fn
.
fn
.
call_times
==
[
0.0
]
assert
fn
.
fn
.
call_counts
==
[
0
]
assert
fn
.
vm
.
call_times
==
[
0.0
]
assert
fn
.
vm
.
call_counts
==
[
0
]
z_fn
=
function
([],
z
)
...
...
@@ -2716,8 +2716,8 @@ def test_profile_info():
# Confirm that `VM.update_profile` was called
assert
profile
.
apply_time
assert
fn
.
fn
.
call_times
==
[
0.0
]
assert
fn
.
fn
.
call_counts
==
[
0
]
assert
fn
.
vm
.
call_times
==
[
0.0
]
assert
fn
.
vm
.
call_counts
==
[
0
]
class
TestExamples
:
...
...
tests/tensor/nnet/test_conv.py
浏览文件 @
c2092862
...
...
@@ -616,7 +616,7 @@ class TestConv2D(utt.InferShapeTester):
)
aesara_conv
=
aesara
.
function
([],
output
,
mode
=
mode
)
t1
=
time
.
time
()
aesara_conv
.
fn
(
n_calls
=
n_calls
)
aesara_conv
.
vm
(
n_calls
=
n_calls
)
t2
=
time
.
time
()
print
(
t2
-
t1
,
end
=
" "
)
print
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论