original_docstring:  Returns the rep with an additional scalar 'gate' for each of the nonscalars and non regular
          reps in the input. To be used as the output for linear (and or bilinear) layers directly
          before a :func:`GatedNonlinearity` to produce its scalar gates. 
docstring: Returns the rep with an additional scalar 'gate' for each of the nonscalars and non regular
  reps in the input. To be used as the output for linear (and or bilinear) layers directly
  before a :func:`GatedNonlinearity` to produce its scalar gates.
docstring_tokens: Returns the rep with an additional scalar ' gate ' for each of the nonscalars and non regular reps in the input . To be used as the output for linear ( and or bilinear ) layers directly before a : func : ` GatedNonlinearity ` to produce its scalar gates .
code: def gated(sumrep): #TODO: generalize to mixed tensors?
      """ Returns the rep with an additional scalar 'gate' for each of the nonscalars and non regular
          reps in the input. To be used as the output for linear (and or bilinear) layers directly
          before a :func:`GatedNonlinearity` to produce its scalar gates. """
      return sumrep+sum([Scalar(rep.G) for rep in sumrep if rep!=Scalar and not rep.is_permutation])
code_tokens: def gated ( sumrep ) : return sumrep + sum ( [ Scalar ( rep . G ) for rep in sumrep if rep != Scalar and not rep . is_permutation ] )
short_docstring: Returns the rep with an additional scalar 'gate' for each of the nonscalars and non regular
  reps in the input.
short_docstring_tokens: Returns the rep with an additional scalar ' gate ' for each of the nonscalars and non regular reps in the input .
comment: #TODO: generalize to mixed tensors?
  $SEP$""" Returns the rep with an additional scalar 'gate' for each of the nonscalars and non regular
          reps in the input. To be used as the output for linear (and or bilinear) layers directly
          before a :func:`GatedNonlinearity` to produce its scalar gates. """