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 value of cost_fn above
docstr_tok: ["Analytic","value","of","cost_fn","above"]
code: def cost_fn_expected(weights, coeffs1, coeffs2):
      """Analytic value of cost_fn above"""
      a, b, c = coeffs1
      d = coeffs2[0]
      x, y = weights
      return [
          -c * tf.sin(x) * tf.sin(y) + tf.cos(x) * (a + b * tf.sin(y)),
          d * 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 2 for calling the TestHamiltonianWorkflows obj's underlying member method code with example usage: obj.cost_fn_expected(weights, coeffs1, coeffs2) and returns: list