class_docstr: Test that tapes ending with expectations
  of Hamiltonians provide correct results and gradients
class_docstr_tok: ["Test","that","tapes","ending","with","expectations","of","Hamiltonians","provide","correct","results","and","gradients"]
docstr: Analytic jacobian of cost_fn above
docstr_tok: ["Analytic","jacobian","of","cost_fn","above"]
code: def cost_fn_jacobian(weights, coeffs1, coeffs2):
      """Analytic jacobian of cost_fn above"""
      a, b, c = coeffs1
      d = coeffs2[0]
      x, y = weights
      return tf.convert_to_tensor(
          [
              [
                  -c * tf.cos(x) * tf.sin(y)
                  - tf.sin(x) * (a + b * tf.sin(y)),
                  b * tf.cos(x) * tf.cos(y) - c * tf.cos(y) * tf.sin(x),
                  tf.cos(x),
                  tf.cos(x) * tf.sin(y),
                  -(tf.sin(x) * tf.sin(y)),
                  0,
              ],
              [-d * tf.sin(x), 0, 0, 0, 0, tf.cos(x)],
          ]
      )
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.devices import DefaultQubit
  from pennylane.gradients import param_shift
  from pennylane import execute
label_desc: Use image node_id 3 for calling the TestHamiltonianWorkflows obj's underlying member method code with example usage: obj.cost_fn_jacobian(weights, coeffs1, coeffs2) and returns: tf