MCPcopy
hub / github.com/XingangPan/DragGAN / clone

Method clone

stylegan_human/dnnlib/tflib/network.py:303–316  ·  view source on GitHub ↗

Create a clone of this network with its own copy of the variables.

(self, name: str = None, **new_static_kwargs)

Source from the content-addressed store, hash-verified

301 tfutil.set_vars({self.find_var(name): value for name, value in state["variables"]})
302
303 def clone(self, name: str = None, **new_static_kwargs) -> "Network":
304 """Create a clone of this network with its own copy of the variables."""
305 # pylint: disable=protected-access
306 net = object.__new__(Network)
307 net._init_fields()
308 net.name = name if name is not None else self.name
309 net.static_kwargs = util.EasyDict(self.static_kwargs)
310 net.static_kwargs.update(new_static_kwargs)
311 net._build_module_src = self._build_module_src
312 net._build_func_name = self._build_func_name
313 net._build_func = self._build_func
314 net._init_graph()
315 net.copy_vars_from(self)
316 return net
317
318 def copy_own_vars_from(self, src_net: "Network") -> None:
319 """Copy the values of all variables from the given network, excluding sub-networks."""

Callers 12

runMethod · 0.95
check_ddp_consistencyFunction · 0.80
visual_Method · 0.80
forwardMethod · 0.80
dual_optimizerMethod · 0.80
mainFunction · 0.80
generate_style_mixFunction · 0.80
check_ddp_consistencyFunction · 0.80
trainMethod · 0.80
handle_wMethod · 0.80
to_cpuMethod · 0.80
init_networkMethod · 0.80

Calls 4

_init_fieldsMethod · 0.80
_init_graphMethod · 0.80
copy_vars_fromMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected