'target[i] = -log(self[label[i]] + tiny).'

def get_softmax_cross_entropy(self, labels, target, tiny=1e-10):

    assert (labels.shape == (1, self.shape[1]))
    assert (target.shape == labels.shape)
    if isinstance(labels, CUDAMatrix):
        err_code = _cudamat.get_softmax_cross_entropy(self.p_mat, labels.p_mat, target.p_mat, ct.c_float(tiny))
    else:
        raise ValueError, 'labels    must    be    of    type    CUDAMatrix.'
    if err_code:
        raise generate_exception(err_code)
    return target
