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 build() method correctly initializes the weights in the qnode_weights
  dictionary, i.e., that each value of the dictionary has correct shape and name.
docstr_tok: ["Test","if","the","build","(",")","method","correctly","initializes","the","weights","in","the","qnode_weights","dictionary",",","i.e.",",","that","each","value","of","the","dictionary","has","correct","shape","and","name","."]
code: def test_qnode_weights(
      self, get_circuit, n_qubits, output_dim
  ):  # pylint: disable=no-self-use
      """Test if the build() method correctly initializes the weights in the qnode_weights
      dictionary, i.e., that each value of the dictionary has correct shape and name.
      """
      c, w = get_circuit
      layer = KerasLayer(c, w, output_dim)
      layer.build(input_shape=(10, n_qubits))
  
      for weight, shape in layer.weight_shapes.items():
          assert layer.qnode_weights[weight].shape == shape
          assert layer.qnode_weights[weight].name[:-2] == weight
  
imports: from collections import defaultdict
  import numpy
  import pytest
  import pennylane
label_desc: Use image node_id 10 for calling the TestKerasLayer obj's underlying member method code with example usage: obj.test_qnode_weights(get_circuit, n_qubits, output_dim) without return types