本文整理汇总了Python中nengo.cache.DecoderCache.invalidate方法的典型用法代码示例。如果您正苦于以下问题:Python DecoderCache.invalidate方法的具体用法?Python DecoderCache.invalidate怎么用?Python DecoderCache.invalidate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nengo.cache.DecoderCache
的用法示例。
在下文中一共展示了DecoderCache.invalidate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_decoder_cache_invalidation
# 需要导入模块: from nengo.cache import DecoderCache [as 别名]
# 或者: from nengo.cache.DecoderCache import invalidate [as 别名]
def test_decoder_cache_invalidation(tmpdir):
cache_dir = str(tmpdir)
solver_mock = SolverMock()
# Basic test, that results are cached.
cache = DecoderCache(cache_dir=cache_dir)
cache.wrap_solver(solver_mock)(**get_solver_test_args())
assert SolverMock.n_calls[solver_mock] == 1
cache.invalidate()
cache.wrap_solver(solver_mock)(**get_solver_test_args())
assert SolverMock.n_calls[solver_mock] == 2
示例2: test_decoder_cache_invalidation
# 需要导入模块: from nengo.cache import DecoderCache [as 别名]
# 或者: from nengo.cache.DecoderCache import invalidate [as 别名]
def test_decoder_cache_invalidation(tmpdir):
cache_dir = str(tmpdir)
solver_mock = SolverMock()
M = 100
N = 10
D = 2
activities = np.ones((M, D))
targets = np.ones((M, N))
rng = np.random.RandomState(42)
# Basic test, that results are cached.
cache = DecoderCache(cache_dir=cache_dir)
cache.wrap_solver(solver_mock)(activities, targets, rng)
assert SolverMock.n_calls[solver_mock] == 1
cache.invalidate()
cache.wrap_solver(solver_mock)(activities, targets, rng)
assert SolverMock.n_calls[solver_mock] == 2