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

Method copy

tensorflow/python/ops/variable_scope.py:1903–1929  ·  view source on GitHub ↗

Copy this variable store and all of its contents. Variables contained in this store will be copied over to the new variable store, meaning that they can be modified without affecting the variables in this store. Returns: A new EagerVariableStore instance containing copied var

(self)

Source from the content-addressed store, hash-verified

1901 # pylint: enable=protected-access
1902
1903 def copy(self):
1904 """Copy this variable store and all of its contents.
1905
1906 Variables contained in this store will be copied over to the new variable
1907 store, meaning that they can be modified without affecting the variables in
1908 this store.
1909
1910 Returns:
1911 A new EagerVariableStore instance containing copied variables.
1912 """
1913 # pylint: disable=protected-access
1914 new_store = EagerVariableStore()
1915 for key, var in iteritems(self._store._vars):
1916 # Strip device out of variable name.
1917 try:
1918 index = var.name.index(":")
1919 except ValueError:
1920 stripped_var_name = var.name
1921 else:
1922 stripped_var_name = var.name[:index]
1923
1924 # Create new variable with same value, name, and "trainable" flag.
1925 new_var = resource_variable_ops.ResourceVariable(
1926 var.read_value(), name=stripped_var_name, trainable=var.trainable)
1927 new_store._store._vars[key] = new_var
1928 return new_store
1929 # pylint: enable=protected-access
1930
1931
1932# The argument list for get_variable must match arguments to get_local_variable.

Callers 8

from_configMethod · 0.45
from_configMethod · 0.45
handleMethod · 0.45
from_configMethod · 0.45
__enter__Method · 0.45
default_variable_creatorFunction · 0.45

Calls 4

EagerVariableStoreClass · 0.85
indexMethod · 0.45
ResourceVariableMethod · 0.45
read_valueMethod · 0.45

Tested by 1