def _(): v0 = qy.select(True, 3, 4) v1 = qy.select(False, 3, 4) @qy.python(v0, v1) def _(v0_py, v1_py): result[0] = v0_py result[1] = v1_py
def ll(self, parameter, sample, out): """ Compute constant-distribution log-likelihood. """ qy.select( parameter.data.load() == sample.data.load(), 0.0, numpy.finfo(float).min, ) \ .store(out)
def log_add_d(x_in, y_in): s = x_in >= y_in a = qy.select(s, x_in, y_in) @qy.if_else(a == -numpy.inf) def _(then): if then: qy.return_(-numpy.inf) else: qy.return_(a + qy.log1p(qy.exp(qy.select(s, y_in, x_in) - a)))
def _(then): if then: qy.return_(-numpy.inf) else: qy.return_(a + qy.log1p(qy.exp(qy.select(s, y_in, x_in) - a)))
def __abs__(self): """ Return the absolute value of this value. """ return qy.select(self > 0.0, self, -self)
def _(): qy.return_(qy.select(k == n, 0.0, -numpy.inf))