class_docstr: A layer that use a custom function to combine multiple :class:`Layer` inputs.
  If the function has trainable weights, the weights should be provided.
  Remember to make sure the weights provided when the layer is constructed are SAME as
  the weights used when the layer is forwarded.
  
  Parameters
  ----------
  fn : function
      The function that applies to the inputs (e.g. tensor from the previous layer).
  fn_weights : list
      The trainable weights for the function if any. Optional.
  fn_args : dict
      The arguments for the function if any. Optional.
  name : str or None
      A unique layer name.
  
  Examples
  --------
  
  Non-parametric and with args case
  This case is supported in the Model.save() / Model.load() to save / load the whole model architecture and weights(optional).
  
  >>> # z = mean + noise * tf.exp(std * 0.5) + foo
  >>> def func(noise, mean, std, foo=42):
  >>>     return mean + noise * tf.exp(std * 0.5) + foo
  >>> noise = tl.layers.Input([100, 1])
  >>> mean = tl.layers.Input([100, 1])
  >>> std = tl.layers.Input([100, 1])
  >>> out = tl.layers.ElementwiseLambda(fn=func, fn_args={'foo': 84}, name='elementwiselambda')([noise, mean, std])
  
  
  Non-parametric and non-args case
  This case is supported in the Model.save() / Model.load() to save / load the whole model architecture and weights(optional).
  
  >>> # z = mean + noise * tf.exp(std * 0.5)
  >>> noise = tl.layers.Input([100, 1])
  >>> mean = tl.layers.Input([100, 1])
  >>> std = tl.layers.Input([100, 1])
  >>> out = tl.layers.ElementwiseLambda(fn=lambda x, y, z: x + y * tf.exp(z * 0.5), name='elementwiselambda')([noise, mean, std])
  
  
  Any function with outside variables
  This case has not been supported in Model.save() / Model.load() yet.
  Please avoid using Model.save() / Model.load() to save / load models that contain such ElementwiseLambda layer. Instead, you may use Model.save_weights() / Model.load_weights() to save / load model weights.
  Note: In this case, fn_weights should be a list, and then the trainable weights in this ElementwiseLambda layer can be added into the weights of the whole model.
  
  >>> # z = mean + noise * tf.exp(std * 0.5) + vara
  >>> vara = [tf.Variable(1.0)]
  >>> def func(noise, mean, std):
  >>>     return mean + noise * tf.exp(std * 0.5) + vara
  >>> noise = tl.layers.Input([100, 1])
  >>> mean = tl.layers.Input([100, 1])
  >>> std = tl.layers.Input([100, 1])
  >>> out = tl.layers.ElementwiseLambda(fn=func, fn_weights=vara, name='elementwiselambda')([noise, mean, std])
class_docstr_tok: ["A","layer","that","use","a","custom","function","to","combine","multiple",":","class",":","`","Layer","`","inputs",".","If","the","function","has","trainable","weights",",","the","weights","should","be","provided",".","Remember","to","make","sure","the","weights","provided","when","the","layer","is","constructed","are","SAME","as","the","weights","used","when","the","layer","is","forwarded",".","Parameters","--","--","--","--","--","fn",":","function","The","function","that","applies","to","the","inputs","(","e.g",".","tensor","from","the","previous","layer",")",".","fn_weights",":","list","The","trainable","weights","for","the","function","if","any",".","Optional",".","fn_args",":","dict","The","arguments","for","the","function","if","any",".","Optional",".","name",":","str","or","None","A","unique","layer","name",".","Examples","--","--","--","--","Non-parametric","and","with","args","case","This","case","is","supported","in","the","Model.save","(",")","\/","Model.load","(",")","to","save","\/","load","the","whole","model","architecture","and","weights","(","optional",")",".",">",">",">","#","z","=","mean","+","noise","*","tf.exp","(","std","*","0.5",")","+","foo",">",">",">","def","func","(","noise",",","mean",",","std",",","foo=42",")",":",">",">",">","return","mean","+","noise","*","tf.exp","(","std","*","0.5",")","+","foo",">",">",">","noise","=","tl.layers.Input","(","[","100",",","1","]",")",">",">",">","mean","=","tl.layers.Input","(","[","100",",","1","]",")",">",">",">","std","=","tl.layers.Input","(","[","100",",","1","]",")",">",">",">","out","=","tl.layers.ElementwiseLambda","(","fn=func",",","fn_args=","{","'foo","'",":","84","}",",","name='elementwiselambda","'",")","(","[","noise",",","mean",",","std","]",")","Non-parametric","and","non-args","case","This","case","is","supported","in","the","Model.save","(",")","\/","Model.load","(",")","to","save","\/","load","the","whole","model","architecture","and","weights","(","optional",")",".",">",">",">","#","z","=","mean","+","noise","*","tf.exp","(","std","*","0.5",")",">",">",">","noise","=","tl.layers.Input","(","[","100",",","1","]",")",">",">",">","mean","=","tl.layers.Input","(","[","100",",","1","]",")",">",">",">","std","=","tl.layers.Input","(","[","100",",","1","]",")",">",">",">","out","=","tl.layers.ElementwiseLambda","(","fn=lambda","x",",","y",",","z",":","x","+","y","*","tf.exp","(","z","*","0.5",")",",","name='elementwiselambda","'",")","(","[","noise",",","mean",",","std","]",")","Any","function","with","outside","variables","This","case","has","not","been","supported","in","Model.save","(",")","\/","Model.load","(",")","yet",".","Please","avoid","using","Model.save","(",")","\/","Model.load","(",")","to","save","\/","load","models","that","contain","such","ElementwiseLambda","layer",".","Instead",",","you","may","use","Model.save_weights","(",")","\/","Model.load_weights","(",")","to","save","\/","load","model","weights",".","Note",":","In","this","case",",","fn_weights","should","be","a","list",",","and","then","the","trainable","weights","in","this","ElementwiseLambda","layer","can","be","added","into","the","weights","of","the","whole","model",".",">",">",">","#","z","=","mean","+","noise","*","tf.exp","(","std","*","0.5",")","+","vara",">",">",">","vara","=","[","tf.Variable","(","1.0",")","]",">",">",">","def","func","(","noise",",","mean",",","std",")",":",">",">",">","return","mean","+","noise","*","tf.exp","(","std","*","0.5",")","+","vara",">",">",">","noise","=","tl.layers.Input","(","[","100",",","1","]",")",">",">",">","mean","=","tl.layers.Input","(","[","100",",","1","]",")",">",">",">","std","=","tl.layers.Input","(","[","100",",","1","]",")",">",">",">","out","=","tl.layers.ElementwiseLambda","(","fn=func",",","fn_weights=vara",",","name='elementwiselambda","'",")","(","[","noise",",","mean",",","std","]",")"]
code: def __repr__(self):
      s = "{classname}("
      s += "fn={fn_name},"
      s += "len_weights={len_weights},"
      s += "name='{name}'"
      s += ")"
      try:
          fn_name = repr(self.fn)
      except:
          fn_name = "name not available"
      return s.format(
          classname=self.__class__.__name__,
          fn_name=fn_name,
          len_weights=len(self._trainable_weights),
          **self.__dict__,
      )
  
file_path: TensorLayer/tensorlayer/layers/lambda_layers.py
imports: import tensorflow
  from tensorlayer import logging
  from tensorlayer.decorators import deprecated_alias
  from tensorlayer.files import utils
  from tensorlayer.layers.core import Layer
label_desc: Use image node_id 2 for calling the ElementwiseLambda obj's underlying member method code with example usage: obj.__repr__() and returns: s