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 a ValueError is raised when using a Tensor with the wrong shape.
docstr_tok: ["Test","that","a","ValueError","is","raised","when","using","a","Tensor","with","the","wrong","shape","."]
code: def test_fixed_init_raises_error(
      self, get_circuit, n_qubits
  ):  # pylint: disable=no-self-use
      """Test that a ValueError is raised when using a Tensor with the wrong shape."""
      c, w = get_circuit
  
      init_method = {
          "w1": torch.normal(mean=0, std=1, size=(1,)),
          "w2": torch.normal(mean=0, std=1, size=(1,)),
          "w3": torch.normal(mean=0, std=1, size=[]),
          "w4": torch.normal(mean=0, std=1, size=(3,)),
          "w5": torch.normal(mean=0, std=1, size=(2, n_qubits, 3)),
          "w6": torch.normal(mean=0, std=1, size=(3,)),
          "w7": torch.normal(mean=0, std=1, size=[]),
      }
  
      with pytest.raises(ValueError):
          TorchLayer(qnode=c, weight_shapes=w, init_method=init_method)
  
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 10 for calling the TestTorchLayer obj's underlying member method code with example usage: obj.test_fixed_init_raises_error(get_circuit, n_qubits) without return types