def predict_w_noise(self, xs, stochastic=True, **kwargs): ts_ys, ts_ms, _ = self.ts_predict_all(array_to_ts(xs), stochastic=stochastic, **kwargs) ys, ms = ts_to_array(ts_ys), ts_to_array(ts_ms) ns = ys - ms return ys, ms
def kl(self, other, xs, reversesd=False, **kwargs): """ Return the KL divergence for each data point in the batch xs. """ return ts_to_array(self.ts_kl(other, array_to_ts(xs), reversesd=reversesd))
def mean_variable(self): return flatten(ts_to_array(super().ts_variables))
def grad(self, x, **kwargs): return flatten(ts_to_array(self.ts_grad(array_to_ts(x), **kwargs)))
def fun(self, x, **kwargs): return ts_to_array(self.ts_fun(array_to_ts(x)), **kwargs)
def grad(self, xs, **kwargs): """ Derivative with respect to xs. """ return ts_to_array(self.ts_grad(array_to_ts(xs), **kwargs))