def copy_vars_from(self, src_net: "Network") -> None:
        """Copy the values of all variables from the given network, including sub-networks."""

        # Source has unknown variables or unknown components => init now.
        if (src_net._var_inits is not None and not src_net._all_inits_known) or src_net._components is None:
            src_net._get_vars()

        # Source is inited, but destination components have not been created yet => set as initial values.
        if src_net._var_inits is None and self._components is None:
            self._var_inits.update(tfutil.run(src_net._get_vars()))
            return

        # Destination has unknown components => init now.
        if self._components is None:
            self._get_vars()

        # Both networks are inited => copy directly.
        if src_net._var_inits is None and self._var_inits is None:
            names = [name for name in self._get_vars().keys() if name in src_net._get_vars()]
            tfutil.set_vars(tfutil.run({self._get_vars()[name]: src_net._get_vars()[name] for name in names}))
            return

        # Copy recursively, component by component.
        self.copy_own_vars_from(src_net)
        for name, src_comp in src_net._components.items():
            if name in self._components:
                self._components[name].copy_vars_from(src_comp)
Copy the values of all variables from the given network, including sub-networks.
converters/stylegan2ada_tf_official/dnnlib/tflib/network.py