class_docstr: Custom TensorFlow function layer (specification key: `function`).
  
  Args:
      function (callable[x -> x] | str): TensorFlow function, or string expression with argument
          "x", e.g. "(x+1.0)/2.0"
          (<span style="color:#C00000"><b>required</b></span>).
      output_spec (specification): Output tensor specification containing type and/or shape
          information (<span style="color:#00C000"><b>default</b></span>: same as input).
      l2_regularization (float >= 0.0): Scalar controlling L2 regularization
          (<span style="color:#00C000"><b>default</b></span>: inherit value of parent module).
      name (string): Layer name
          (<span style="color:#00C000"><b>default</b></span>: internally chosen).
      input_spec (specification): <span style="color:#00C000"><b>internal use</b></span>.
class_docstr_tok: ["Custom","TensorFlow","function","layer","(","specification","key",":","`","function","`",")",".","Args",":","function","(","callable","[","x","-",">","x","]","|","str",")",":","TensorFlow","function",",","or","string","expression","with","argument","``","x","''",",","e.g",".","``","(","x+1.0",")","\/2.0","''","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","output_spec","(","specification",")",":","Output","tensor","specification","containing","type","and\/or","shape","information","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","same","as","input",")",".","l2_regularization","(","float",">","=","0.0",")",":","Scalar","controlling","L2","regularization","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","inherit","value","of","parent","module",")",".","name","(","string",")",":","Layer","name","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","internally","chosen",")",".","input_spec","(","specification",")",":","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">","."]
code: def __init__(
      self,
      function,
      output_spec=None,
      l2_regularization=None,
      name=None,
      input_spec=None,
  ):
      super().__init__(
          l2_regularization=l2_regularization,
          name=name,
          input_spec=input_spec,
      )
  
      self.function = function
      if output_spec is None:
          self._output_spec = None
      else:
          self._output_spec = TensorSpec(**output_spec)
  
      self.architecture_kwargs["function"] = str(function)
      if l2_regularization is not None:
          self.architecture_kwargs["l2_regularization"] = str(
              l2_regularization
          )
  
imports: import math
  import random
  import numpy
  import tensorflow
  from tensorforce import TensorforceError, util
  from tensorforce.core import parameter_modules, TensorSpec, tf_function, tf_util
  from tensorforce.core.layers import Layer, NondeterministicLayer
label_desc: Use image node_id 1 to create a new Function object from inherited base classes: Layer with example: obj = Function(function, output_spec, l2_regularization, name, input_spec)