code: def fit_zyz(target_gate):
      
  
      assert bk.BACKEND == 'tensorflow'
  
      tf = bk.TL
      steps = 4000
  
      t = tf.get_variable('t', [3])
      gate = qf.ZYZ(t[0], t[1], t[2])
  
      ang = qf.fubini_study_angle(target_gate.vec, gate.vec)
      opt = tf.train.AdamOptimizer(learning_rate=0.001)
      train = opt.minimize(ang, var_list=[t])
  
      with tf.Session() as sess:
          init_op = tf.global_variables_initializer()
          sess.run(init_op)
  
          for step in range(steps):
              sess.run(train)
              loss = sess.run(ang)
              sys.stdout.write('\r')
              sys.stdout.write("step: {} gate_angle: {}".format(step, loss))
              if loss < 0.0001:
                  break
          print()
          return sess.run(t)
docs: Tensorflow example. Given an arbitrary one-qubit gate, use gradient
      descent to find corresponding parameters of a universal ZYZ gate.