mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-09 12:02:38 +02:00
fixed caching bug with args having Nones
This commit is contained in:
parent
83f5b9377a
commit
82a25d691b
1 changed files with 3 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
from ..core.parameterization.parameter_core import Observable
|
from ..core.parameterization.parameter_core import Observable
|
||||||
|
import itertools
|
||||||
|
|
||||||
class Cacher(object):
|
class Cacher(object):
|
||||||
"""
|
"""
|
||||||
|
|
@ -40,9 +41,9 @@ class Cacher(object):
|
||||||
|
|
||||||
# TODO: WARNING !!! Cache OFFSWITCH !!! WARNING
|
# TODO: WARNING !!! Cache OFFSWITCH !!! WARNING
|
||||||
# return self.operation(*args)
|
# return self.operation(*args)
|
||||||
|
|
||||||
#if the result is cached, return the cached computation
|
#if the result is cached, return the cached computation
|
||||||
state = [all(a is b for a, b in zip(args, cached_i)) for cached_i in self.cached_inputs]
|
state = [all(a is b for a, b in itertools.izip_longest(args, cached_i)) for cached_i in self.cached_inputs]
|
||||||
if any(state):
|
if any(state):
|
||||||
i = state.index(True)
|
i = state.index(True)
|
||||||
if self.inputs_changed[i]:
|
if self.inputs_changed[i]:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue