mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-15 06:52:39 +02:00
Revert "Revert "[kern] Add kernel was swallowing parts #fix #412""
This reverts commit 0abb9b835f.
This commit is contained in:
parent
0abb9b835f
commit
27d49bbe01
1 changed files with 11 additions and 5 deletions
|
|
@ -13,15 +13,21 @@ class Add(CombinationKernel):
|
||||||
propagates gradients through.
|
propagates gradients through.
|
||||||
|
|
||||||
This kernel will take over the active dims of it's subkernels passed in.
|
This kernel will take over the active dims of it's subkernels passed in.
|
||||||
|
|
||||||
|
NOTE: The subkernels will be copies of the original kernels, to prevent
|
||||||
|
unexpected behavior.
|
||||||
"""
|
"""
|
||||||
def __init__(self, subkerns, name='sum'):
|
def __init__(self, subkerns, name='sum'):
|
||||||
for i, kern in enumerate(subkerns[:]):
|
_newkerns = []
|
||||||
|
for kern in subkerns:
|
||||||
if isinstance(kern, Add):
|
if isinstance(kern, Add):
|
||||||
del subkerns[i]
|
for part in kern.parts:
|
||||||
for part in kern.parts[::-1]:
|
|
||||||
#kern.unlink_parameter(part)
|
#kern.unlink_parameter(part)
|
||||||
subkerns.insert(i, part.copy())
|
_newkerns.append(part.copy())
|
||||||
super(Add, self).__init__(subkerns, name)
|
else:
|
||||||
|
_newkerns.append(kern.copy())
|
||||||
|
|
||||||
|
super(Add, self).__init__(_newkerns, name)
|
||||||
self._exact_psicomp = self._check_exact_psicomp()
|
self._exact_psicomp = self._check_exact_psicomp()
|
||||||
|
|
||||||
def _check_exact_psicomp(self):
|
def _check_exact_psicomp(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue