def _inner_take_over_or_update(self, full_values=None, current_values=None, value_indices=None):
for key in current_values.keys():<EOL><INDENT>if value_indices is not None and key in value_indices:<EOL><INDENT>index = value_indices[key]<EOL><DEDENT>else:<EOL><INDENT>index = slice(None)<EOL><DEDENT>if key in full_values:<EOL><INDENT>try:<EOL><INDENT>full_values[key][index] += current_values[key]<EOL><DEDENT>except:<EOL><INDENT>full_values[key] += current_values[key]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>full_values[key] = current_values[key]<EOL><DEDENT><DEDENT>
This is for automatic updates of values in the inner loop of missing
data handling. Both arguments are dictionaries and the values in
full_values will be updated by the current_gradients.

If a key from current_values does not exist in full_values, it will be
initialized to the value in current_values.

If there is indices needed for the update, value_indices can be used for
that. If value_indices has the same key, as current_values, the update
in full_values will be indexed by the indices in value_indices.

grads:
    dictionary of standing gradients (you will have to carefully make sure, that
    the ordering is right!). The values in here will be updated such that
    full_values[key] += current_values[key]  forall key in full_gradients.keys()

gradients:
    dictionary of gradients in the current set of parameters.

value_indices:
    dictionary holding indices for the update in full_values.
    if the key exists the update rule is:def df(x):
    full_values[key][value_indices[key]] += current_values[key]