revrand
revrand copied to clipboard
Make ARD length-scale bases return generator gradients instead of tensors
Otherwise we get potentially massive memory usage, i.e. using the SLM on SARCOS, ARD on 21 dimensions uses too much memory.
Make these sorts of lines return generators, and fix apply_grad
to work with them instead of 3-D arrays:
for i, l in enumerate(lenscale):
ldist = cdist(X[:, [i]] / l**3, self.C[:, [i]] / l**3,
'sqeuclidean')
dPhi.append(Phi * ldist)
return np.dstack(dPhi) if len(lenscale) != 1 else dPhi[0]
see https://github.com/NICTA/revrand/blob/master/revrand/basis_functions.py#L714