def copy_parameters(model):
    """Copy a models parameters.

  This is a helper function to copy a models parameters and
  initialize each copied tensors so as to hold all zeros. The
  returned tensors reside on the same device as that of the
  corresponding tensor in model.parameters().

   Args:
     model (nn.Module): The model whose parameters to copy.

   Returns:
     list[tensor]: A list with the stucture of model.param-
         eters() (which is itself a generator) but with its
         tensors holding all zeros.
  """
    params = []
    for param in model.parameters():
        params.append(param.data.clone())
    for param in params:
        param.zero_()
    return params
