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 that everything works when default arguments that are not the input argument are
  present in the QNode
docstr_tok: ["Test","that","everything","works","when","default","arguments","that","are","not","the","input","argument","are","present","in","the","QNode"]
code: def test_non_input_defaults(
      self, n_qubits, output_dim
  ):  # pylint: disable=no-self-use
      """Test that everything works when default arguments that are not the input argument are
      present in the QNode"""
      dev = qml.device("default.qubit", wires=n_qubits)
      w = {
          "w1": (3, n_qubits, 3),
          "w2": (1,),
          "w3": 1,
          "w4": [3],
          "w5": (2, n_qubits, 3),
          "w6": 3,
          "w7": 1,
      }
  
      @qml.qnode(dev, interface="torch")
      def c(
          inputs, w1, w2, w4, w5, w6, w7, w3=0.5
      ):  # pylint: disable=too-many-arguments
          """A circuit that embeds data using the AngleEmbedding and then performs a variety of
          operations. The output is a PauliZ measurement on the first output_dim qubits. One set of
          parameters, w5, are specified as non-trainable."""
          qml.templates.AngleEmbedding(
              inputs, wires=list(range(n_qubits))
          )
          qml.templates.StronglyEntanglingLayers(
              w1, wires=list(range(n_qubits))
          )
          qml.RX(w2[0], wires=0 % n_qubits)
          qml.RX(w3, wires=1 % n_qubits)
          qml.Rot(*w4, wires=2 % n_qubits)
          qml.templates.StronglyEntanglingLayers(
              w5, wires=list(range(n_qubits))
          )
          qml.Rot(*w6, wires=3 % n_qubits)
          qml.RX(w7, wires=4 % n_qubits)
          return [qml.expval(qml.PauliZ(i)) for i in range(output_dim)]
  
      layer = TorchLayer(c, w)
      x = torch.ones(n_qubits)
  
      layer_out = layer._evaluate_qnode(
          x
      )  # pylint: disable=protected-access
      circuit_out = torch.hstack(c(x, **layer.qnode_weights)).type(
          x.dtype
      )
  
      assert torch.allclose(layer_out, circuit_out)
  
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 13 for calling the TestTorchLayer obj's underlying member method code with example usage: obj.test_non_input_defaults(n_qubits, output_dim) and returns: unknown