'Args:
x: samples of shape (batch, sample_dim)
theta: model parameters of shape (batch, param_dim)
Returns:
log likelihood of each sample, of shape (batch,)'

@class_scope
def loglikelihood(self, x, theta):

    assert ((x.get_shape().ndims == 2) and (x.get_shape()[1] == self.sample_dim)), x.get_shape()
    assert ((theta.get_shape().ndims == 2) and (theta.get_shape()[1] == self.param_dim)), theta.get_shape()
    ret = self._loglikelihood(x, theta)
    assert (ret.get_shape().ndims == 1), ret.get_shape()
    return ret
