input: Write a function to optimize a given function using TensorFlow's Adam optimizer.
  assert optimize_function(some_func).variables() == expected_variables
  assert optimize_function(another_func).variables() == another_expected_variables
  assert optimize_function(different_func).variables() == different_expected_variables
output: import tensorflow as tf
  
  def optimize_function(func):
      optimizer = tf.optimizers.Adam()
      var = tf.Variable([1.0, 2.0, 3.0], dtype=tf.float32)
  
      @tf.function
      def train_step():
          with tf.GradientTape() as tape:
              loss = func(var)
          gradients = tape.gradient(loss, [var])
          optimizer.apply_gradients(zip(gradients, [var]))
          return var
  
      train_step()
      return var