'Loads input and computes the sparse code for it.'

def ForwardPropagate(self, train=False, method='iter'):

    input_layer = self.input_layer
    code_layer = self.code_layer
    input_layer.GetData()
    inputs = input_layer.state
    we = self.encoder.params['weight']
    be = code_layer.params['bias']
    scale = code_layer.params['scale']
    hyp = code_layer.hyperparams
    code_approx = code_layer.approximator
    cm.dot(we.T, inputs, target=code_approx)
    code_approx.add_col_vec(be)
    code_layer.ApplyActivation(code_approx)
    code_approx.mult_by_col(scale)
    if (hyp.dropout and train):
        code_layer.mask.fill_with_rand()
        code_layer.mask.greater_than(hyp.dropout_prob)
        code_approx.mult(code_layer.mask)
    if train:
        if (method == 'iter'):
            self.IterateForZ(train=train)
        elif (method == 'exact'):
            self.SolveForZ()
    elif (method == 'iter'):
        self.IterateForZ(train=train)
