Google I/O returns May 18-20! Reserve space and build your schedule Register now


Performs a soft/hard update of variables from the source to the target.

For each variable v_t in target variables and its corresponding variable v_s in source variables, a soft update is: v_t = (1 - tau) * v_t + tau * v_s

When tau is 1.0 (the default), then it does a hard update: v_t = v_s

source_variables list of source variables.
target_variables list of target variables.
tau A float scalar in [0, 1]. When tau is 1.0 (the default), we do a hard update. This is used for trainable variables.
tau_non_trainable A float scalar in [0, 1] for non_trainable variables. If None, will copy from tau.
sort_variables_by_name A bool, when True would sort the variables by name before doing the update.

An operation that updates target variables from source variables.

ValueError if tau not in [0, 1].
ValueError if len(source_variables) != len(target_variables).
ValueError "Method requires being in cross-replica context, use get_replica_context().merge_call()" if used inside replica context.