class_docstr: Test the adjoint method for the metric tensor when calling it directly on
  a tape.
class_docstr_tok: ["Test","the","adjoint","method","for","the","metric","tensor","when","calling","it","directly","on","a","tape","."]
docstr: Test that the output is correct when using TensorFlow and
  calling the adjoint metric tensor directly on a tape.
docstr_tok: ["Test","that","the","output","is","correct","when","using","TensorFlow","and","calling","the","adjoint","metric","tensor","directly","on","a","tape","."]
code: def test_correct_output_tape_tf(
      self, ansatz, params, interface, dev_name
  ):
      """Test that the output is correct when using TensorFlow and
      calling the adjoint metric tensor directly on a tape."""
  
      import tensorflow as tf
  
      expected = autodiff_metric_tensor(ansatz, self.num_wires)(*params)
      t_params = tuple(tf.Variable(p) for p in params)
      dev = qml.device(dev_name, wires=self.num_wires)
  
      @qml.qnode(dev, interface=interface)
      def circuit(*params):
          """Circuit with dummy output to create a QNode."""
          ansatz(*params, dev.wires)
          return qml.expval(qml.PauliZ(0))
  
      with tf.GradientTape():
          circuit(*t_params)
          mt = qml.adjoint_metric_tensor(circuit.qtape)
  
      with tf.GradientTape():
          mt = qml.adjoint_metric_tensor(circuit)(*t_params)
      assert qml.math.allclose(mt, expected)
  
      expected = qml.math.reshape(expected, qml.math.shape(mt))
      assert qml.math.allclose(mt, expected)
  
imports: import pytest
  from pennylane import numpy
  import pennylane
label_desc: Use image node_id 4 for calling the TestAdjointMetricTensorTape obj's underlying member method code with example usage: obj.test_correct_output_tape_tf(ansatz, params, interface, dev_name) and returns: qml