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

Method _recreate_variable

tensorflow/python/saved_model/load.py:356–384  ·  view source on GitHub ↗
(self, proto)

Source from the content-addressed store, hash-verified

354 proto, self._concrete_functions), setattr
355
356 def _recreate_variable(self, proto):
357 name = proto.name if proto.name else None
358 if name is not None:
359 dbg_name = name
360 else:
361 dbg_name = "<variable loaded from saved model>"
362 synchronization, aggregation, trainable = (
363 variables.validate_synchronization_aggregation_trainable(
364 proto.synchronization, proto.aggregation, proto.trainable,
365 name=dbg_name))
366
367 def uninitialized_variable_creator(next_creator, **kwargs):
368 """A variable creator that creates uninitialized variables."""
369 del next_creator
370 return resource_variable_ops.UninitializedVariable(**kwargs)
371
372 # Create a variable_creator_scope that creates uninitialized variables with
373 # a lower priority such that a potential distributed variable_creator_scope
374 # can take precedence.
375 with ops.get_default_graph()._variable_creator_scope( # pylint: disable=protected-access
376 uninitialized_variable_creator,
377 priority=50):
378 return variables.Variable(
379 shape=proto.shape,
380 dtype=proto.dtype,
381 name=name,
382 trainable=trainable,
383 synchronization=synchronization,
384 aggregation=aggregation), setattr
385
386 def _recreate_constant(self, proto):
387 tensor_proto = self._operation_attributes[proto.operation]["value"].tensor

Callers 1

_recreateMethod · 0.95

Calls 2

VariableMethod · 0.80

Tested by

no test coverage detected