class_docstr: Output layer to restore listwise output shape.
  
  This layer maps the flattened 1D logits or 2D tensor of shape
  [batch_size * list_size, 1] back to 2D of shape [batch_size, list_size] and
  mask the invalid terms to be a defined large negative value.
  
  Example usage:
  
  ```python
  flattened_logits = [1, 0.5, 2, 0, -1, 0]
  mask = [[True, True, False], [True, False, False]]
  logits = RestoreList()(inputs=(flattened_logits, mask))
  logits.numpy()
  # Returns: [[1, 0.5, log(1e-10)], [0, log(1e-10), log(1e-10)]]
  ```
  
  This layer works also for 2D `flattened_logits` like
  [[1], [0.5], [2], [0], [-1], [0]].
  
  When `by_scatter=True`, an nd_indices will be generated using `mask` in the
  same way as `FlattenList`. All values in the `flattened_logits` will be used
  and repeated entries will be averaged.
  
  ```python
  flattened_logits = [1, 0.5, 2, 0, -1, 0]
  mask = [[True, True, False], [True, False, False]]
  logits = RestoreList(by_scatter=True)((flattened_logits, mask))
  logits.numpy()
  # Returns: [[1.5, 0.5, log(1e-10)], [-1/3, log(1e-10), log(1e-10)]]
  ```
  
  This is because the flattened_logits are treated as circularly padded entries.
  The [1st, 3rd] values [1, 2] are counted to logits[0, 0]. The [4th, 5th, 6th]
  values [0, -1, 0] are counted to logits[1, 0]. Note that We use different
  values for those repeated entries, while they are likely the same in practice.
code: def get_config(self):
      config = super().get_config()
      config.update(
          {
              "by_scatter": self._by_scatter,
          }
      )
      return config
  
imports: import math
  from typing import Any, Callable, Dict, List, Optional, Tuple
  import tensorflow
  from tensorflow_ranking.python import utils
label_desc: Use image node_id 3 for calling the RestoreList obj's underlying member method code with example usage: obj.get_config() and returns: config