def hi_given(samples, i, W_list, b_list, beta=1.0, apply_sigmoid=True):
    # There's as much layers in the DBM as there are bias vectors
    depth = len(samples)

    hi_mean = 0.
    if i < depth-1:
        # Top-down input
        wip1 = W_list[i+1]
        hi_mean += T.dot(samples[i+1], wip1.T) * beta

    if i > 0:
        # Bottom-up input
        wi = W_list[i]
        hi_mean += T.dot(samples[i-1], wi) * beta

    hi_mean += b_list[i] * beta

    if apply_sigmoid:
        return T.nnet.sigmoid(hi_mean)
    else:
        return hi_mean
Compute the state of hidden layer i given all other layers
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/scripts/dbm/dbm_metrics.py/hi_given