MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _get_or_make_slot

Method _get_or_make_slot

tensorflow/python/training/optimizer.py:1289–1309  ·  view source on GitHub ↗

Find or create a slot for a variable. Args: var: A `Variable` object. val: A `Tensor`. The initial value of the slot. slot_name: Name for the slot. op_name: Name to use when scoping the Variable that needs to be created for the slot. Returns: A `Varia

(self, var, val, slot_name, op_name, slot_config=None)

Source from the content-addressed store, hash-verified

1287 return named_slots
1288
1289 def _get_or_make_slot(self, var, val, slot_name, op_name, slot_config=None):
1290 """Find or create a slot for a variable.
1291
1292 Args:
1293 var: A `Variable` object.
1294 val: A `Tensor`. The initial value of the slot.
1295 slot_name: Name for the slot.
1296 op_name: Name to use when scoping the Variable that
1297 needs to be created for the slot.
1298
1299 Returns:
1300 A `Variable` object.
1301 """
1302 named_slots = self._slot_dict(slot_name)
1303 if _var_key(var) not in named_slots:
1304 new_slot_variable = slot_creator.create_slot(var, val, op_name, slot_config=slot_config)
1305 self._restore_slot_variable(
1306 slot_name=slot_name, variable=var,
1307 slot_variable=new_slot_variable)
1308 named_slots[_var_key(var)] = new_slot_variable
1309 return named_slots[_var_key(var)]
1310
1311 def _get_or_make_slot_with_initializer(self, var, initializer, shape, dtype,
1312 slot_name, op_name, slot_config=None):

Callers 5

_create_slotsMethod · 0.45
_create_slotsMethod · 0.45
_create_slotsMethod · 0.45
_create_slotsMethod · 0.45

Calls 4

_slot_dictMethod · 0.95
_var_keyFunction · 0.70
create_slotMethod · 0.45

Tested by

no test coverage detected