class_docstr: Deltafier layer computing the difference between the current and the previous input; can only
  be used as preprocessing layer (specification key: `deltafier`).
  
  Args:
      concatenate (False | int >= 0): Whether to concatenate instead of replace deltas with
          input, and if so, concatenation axis
          (<span style="color:#00C000"><b>default</b></span>: false).
      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: ["Deltafier","layer","computing","the","difference","between","the","current","and","the","previous","input",";","can","only","be","used","as","preprocessing","layer","(","specification","key",":","`","deltafier","`",")",".","Args",":","concatenate","(","False","|","int",">","=","0",")",":","Whether","to","concatenate","instead","of","replace","deltas","with","input",",","and","if","so",",","concatenation","axis","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","false",")",".","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 apply(self, *, x):
      assertions = list()
      if self.config.create_tf_assertions:
          assertions.append(
              tf.debugging.assert_less_equal(
                  x=tf.shape(input=x)[0],
                  y=1,
                  message="Deltafier preprocessor currently not compatible with batched Agent.act.",
              )
          )
  
      # TODO: hack for empty batch (for self.previous.assign below)
      extended = tf.concat(values=(self.previous, x), axis=0)
  
      def first_delta():
          assignment = self.has_previous.assign(
              value=tf_util.constant(value=True, dtype="bool"),
              read_value=False,
          )
          with tf.control_dependencies(control_inputs=(assignment,)):
              return tf.concat(
                  values=(tf.zeros_like(input=x[:1]), x[1:] - x[:-1]),
                  axis=0,
              )
  
      def later_delta():
          return x - extended[:-1]
  
      with tf.control_dependencies(control_inputs=assertions):
          empty_batch = tf.math.equal(x=tf.shape(input=x)[0], y=0)
          pred = tf.math.logical_or(x=self.has_previous, y=empty_batch)
          delta = tf.cond(
              pred=pred, true_fn=later_delta, false_fn=first_delta
          )
  
          assignment = self.previous.assign(
              value=extended[-1:], read_value=False
          )
  
      with tf.control_dependencies(control_inputs=(assignment,)):
          if self.concatenate is False:
              return tf_util.identity(input=delta)
          else:
              return tf.concat(
                  values=(x, delta), axis=(self.concatenate + 1)
              )
  
imports: import tensorflow
  from tensorforce.core import parameter_modules, SignatureDict, TensorSpec, tf_function, tf_util
  from tensorforce.core.layers import Layer
label_desc: Use image node_id 6 for calling the Deltafier obj's underlying member method code with example usage: obj.apply() and returns: unknown, tf, tf_util, tf