class_docstr: Unit tests for the pennylane.qnn.torch.TorchLayer class.
class_docstr_tok: ["Unit","tests","for","the","pennylane.qnn.torch.TorchLayer","class","."]
docstr: Test if the weights in qnode_weights are registered to the internal _parameters
  dictionary and that requires_grad == True
docstr_tok: ["Test","if","the","weights","in","qnode_weights","are","registered","to","the","internal","_parameters","dictionary","and","that","requires_grad","==","True"]
code: def test_qnode_weights_registered(
      self, get_circuit
  ):  # pylint: disable=no-self-use
      """Test if the weights in qnode_weights are registered to the internal _parameters
      dictionary and that requires_grad == True"""
      c, w = get_circuit
      layer = TorchLayer(c, w)
  
      for name, weight in layer.qnode_weights.items():
          assert torch.allclose(
              weight,
              layer._parameters[
                  name
              ],  # pylint: disable=protected-access
          )
          assert weight.requires_grad
  
      assert (
          layer.w1 is layer._parameters["w1"]
      )  # pylint: disable=protected-access
      assert layer.w2 is layer._parameters["w2"]
  
imports: from unittest import mock
  import math
  from collections import defaultdict
  import numpy
  import pytest
  import pennylane
  from pennylane.qnn.torch import TorchLayer
label_desc: Use image node_id 15 for calling the TestTorchLayer obj's underlying member method code with example usage: obj.test_qnode_weights_registered(get_circuit) without return types