del v1_structure[_V1_OPTIM_SCOPE]
v1_structure = _merge_optimizer_slots(v1_structure, slots)
mapping = model.map_v1_weights(v1_structure)
missing_mapping = set(model.variables).difference(set(six.iterkeys(mapping)))
if missing_mapping:
raise ValueError("The following variables were not mapped: %s" % (
", ".join(var.name for var in missing_mapping)))
// Assign each variable and possibly the optimizer slots.
After Change
v1_structure = _merge_optimizer_slots(v1_structure, slots)
mapping = model.map_v1_weights(v1_structure)
existing_variables = set(variable.experimental_ref() for variable in model.variables)
mapped_variables = set(variable.experimental_ref() for variable, _ in mapping)
missing_mapping = existing_variables.difference(mapped_variables)
if missing_mapping:
raise ValueError("The following variables were not mapped: %s" % (
", ".join(var.name for var in missing_mapping)))