def expected_energy_term(self, state, average, state_below, average_below):

        # state = Print('h_state', attrs=['min', 'max'])(state)

        self.input_space.validate(state_below)

        if self.requires_reformat:
            if not isinstance(state_below, tuple):
                for sb in get_debug_values(state_below):
                    if sb.shape[0] != self.dbm.batch_size:
                        raise ValueError("self.dbm.batch_size is %d but got " +
                                         "shape of %d" % (self.dbm.batch_size,
                                                          sb.shape[0]))
                    assert reduce(operator.mul, sb.shape[1:]) == self.input_dim

            state_below = self.input_space.format_as(state_below,
                                                     self.desired_space)

        # Energy function is linear so it doesn't matter if we're averaging or
        # not. Specifically, our terms are -u^T W d - b^T d where u is the
        # upward state of layer below and d is the downward state of this layer

        bias_term = T.dot(state, self.b)
        weights_term = (self.transformer.lmul(state_below) * state).sum(axis=1)

        rval = -bias_term - weights_term

        rval *= self.beta

        assert rval.ndim == 1

        return rval
.. todo::
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/models/dbm/ising.py/IsingHidden.expected_energy_term