class_docstr: Computes a parameterised scalar mixture of N tensors, ``mixture = gamma * sum(s_k * tensor_k)``
  where ``s = softmax(w)``, with ``w`` and ``gamma`` scalar parameters.
  
  In addition, if ``do_layer_norm=True`` then apply layer normalization to each tensor
  before weighting.
code: def __init__(self, mixture_size, do_layer_norm=False):
      super(ScalarMix, self).__init__()
  
      self.mixture_size = mixture_size
      self.do_layer_norm = do_layer_norm
  
      self.scalar_parameters = ParameterList(
          [
              Parameter(torch.FloatTensor([0.0]))
              for _ in range(mixture_size)
          ]
      )
      self.gamma = Parameter(torch.FloatTensor([1.0]))
  
file_path: magnitude/pymagnitude/third_party/allennlp/modules/scalar_mix.py
imports: from __future__ import division
  from __future__ import absolute_import
  import torch
  from torch.nn import ParameterList, Parameter
  from allennlp.common.checks import ConfigurationError
label_desc: Use image node_id 1 to create a new ScalarMix object from inherited base classes: torch.nn with example: obj = ScalarMix(mixture_size, do_layer_norm)