docstr: Perform soft-update on target_params. Soft-update gradually blends
  source_params into target_params with this update equation:
  
      target_param = tau * source_param + (1 - tau) * target_param
docstr_tok: ["Perform","soft-update","on","target_params",".","Soft-update","gradually","blends","source_params","into","target_params","with","this","update","equation",":","target_param","=","tau","*","source_param","+","(","1","-","tau",")","*","target_param"]
code: def __init__(
      self, target_params, source_params, tau: float = 0.1
  ) -> None:
      """
      Perform soft-update on target_params. Soft-update gradually blends
      source_params into target_params with this update equation:
  
          target_param = tau * source_param + (1 - tau) * target_param
      """
      target_params = list(target_params)
      source_params = list(source_params)
  
      if len(target_params) != len(source_params):
          raise ValueError(
              "target and source must have the same number of parameters"
          )
  
      for t_param, s_param in zip(target_params, source_params):
          if t_param.shape != s_param.shape:
              raise ValueError(
                  "The shape of target parameter doesn't match that of the source"
              )
  
      params = target_params + source_params
      defaults = dict(
          tau=tau, lr=1.0
      )  # set a dummy learning rate because optimizers are expected to have one
      super().__init__(params, defaults)
  
      for group in self.param_groups:
          tau = group["tau"]
          if tau > 1.0 or tau < 0.0:
              raise ValueError(
                  f"tau should be in [0.0, 1.0]; got {tau}"
              )
  
imports: import torch
label_desc: Use image node_id 1 to create a new SoftUpdate object from inherited base classes: torch.optim with example: obj = SoftUpdate(target_params, source_params, tau)