class_docstr: Unit tests for the pennylane.qnn.keras.KerasLayer class.
class_docstr_tok: ["Unit","tests","for","the","pennylane.qnn.keras.KerasLayer","class","."]
docstr: Test if the call() method performs correctly, i.e., that it outputs with shape
  (batch_size, output_dim) with results that agree with directly calling the QNode
docstr_tok: ["Test","if","the","call","(",")","method","performs","correctly",",","i.e.",",","that","it","outputs","with","shape","(","batch_size",",","output_dim",")","with","results","that","agree","with","directly","calling","the","QNode"]
code: def test_call(
      self, get_circuit, output_dim, batch_size, n_qubits
  ):  # pylint: disable=no-self-use
      """Test if the call() method performs correctly, i.e., that it outputs with shape
      (batch_size, output_dim) with results that agree with directly calling the QNode
      """
      c, w = get_circuit
      layer = KerasLayer(c, w, output_dim)
      x = tf.ones((batch_size, n_qubits))
  
      layer_out = layer(x)
      weights = [w.numpy() for w in layer.qnode_weights.values()]
      assert layer_out.shape == (batch_size, output_dim)
      assert np.allclose(layer_out[0], c(x[0], *weights), atol=1e-7)
  
imports: from collections import defaultdict
  import numpy
  import pytest
  import pennylane
label_desc: Use image node_id 13 for calling the TestKerasLayer obj's underlying member method code with example usage: obj.test_call(get_circuit, output_dim, batch_size, n_qubits) without return types