def METHOD_NAME(self):
    ref_variable, ref_optimizer = _create_variable_and_slots([1, 2, 3, 4, 5, 6, 7])
    new_variable, new_optimizer = _create_variable_and_slots([0, 0, 0, 0, 0, 0])
    mapping = [0, -1, -1, 4, -1, 2]
    expected = [1, 0, 0, 5, 0, 3]
    vocab_lib.update_variable_and_slots(
        ref_variable, new_variable, ref_optimizer, new_optimizer, mapping
    )
    variables = [new_variable] + [
        new_optimizer.get_slot(new_variable, slot) for slot in ("m", "v")
    ]
    for variable in self.evaluate(variables):
        self.assertAllEqual(variable, expected)