code: def time_distributed(incoming, fn, args=None, scope=None):
      """Time Distributed.
  
      This layer applies a function to every timestep of the input tensor. The
      custom function first argument must be the input tensor at every timestep.
      Additional parameters for the custom function may be specified in 'args'
      argument (as a list).
  
      Examples:
          ```python
          # Applying a fully_connected layer at every timestep
          x = time_distributed(input_tensor, fully_connected, [64])
  
          # Using a conv layer at every timestep with a scope
          x = time_distributed(input_tensor, conv_2d, [64, 3], scope='tconv')
          ```
  
      Input:
          (3+)-D Tensor [samples, timestep, input_dim].
  
      Output:
          (3+)-D Tensor [samples, timestep, output_dim].
  
      Arguments:
          incoming: `Tensor`. The incoming tensor.
          fn: `function`. A function to apply at every timestep. This function
              first parameter must be the input tensor per timestep. Additional
              parameters may be specified in 'args' argument.
          args: `list`. A list of parameters to use with the provided function.
          scope: `str`. A scope to give to each timestep tensor. Useful when
              sharing weights. Each timestep tensor scope will be generated
              as 'scope'-'i' where i represents the timestep id. Note that your
              custom function will be required to have a 'scope' parameter.
  
      Returns:
          A Tensor.
  
      """
      if not args:
          args = list()
      assert isinstance(args, list), "'args' must be a list."
  
      if not isinstance(incoming, tf.Tensor):
          incoming = tf.transpose(tf.stack(incoming), [1, 0, 2])
  
      input_shape = utils.get_incoming_shape(incoming)
      timestep = input_shape[1]
      x = tf.unstack(incoming, axis=1)
      if scope:
          x = [
              fn(x[i], scope=scope + "-" + str(i), *args)
              for i in range(timestep)
          ]
      else:
          x = [fn(x[i], *args) for i in range(timestep)]
  
      x = list(
          map(
              lambda t: tf.reshape(
                  t, [-1, 1] + utils.get_incoming_shape(t)[1:]
              ),
              x,
          )
      )
      return tf.concat(x, 1)
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  import tensorflow.compat.v1
  from tensorflow.python.framework import dtypes
  from tensorflow.python.ops import standard_ops
  import tflearn
  from tflearn import utils
  from tflearn import variables
  from tflearn import activations
  from tflearn import initializations
  from tflearn import regularizers
label_desc: Use image node_id 11 for calling a global function with example usage: time_distributed(incoming, fn, args, scope) and returns: tf