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 an ImportError is raised when instantiated without PyTorch
docstr_tok: ["Test","if","an","ImportError","is","raised","when","instantiated","without","PyTorch"]
code: def test_no_torch(
      self, get_circuit, monkeypatch
  ):  # pylint: disable=no-self-use
      """Test if an ImportError is raised when instantiated without PyTorch"""
      c, w = get_circuit
      with monkeypatch.context() as m:
          m.setattr(qml.qnn.torch, "TORCH_IMPORTED", False)
          with pytest.raises(
              ImportError, match="TorchLayer requires PyTorch"
          ):
              TorchLayer(c, w)
  
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 1 for calling the TestTorchLayer obj's underlying member method code with example usage: obj.test_no_torch(get_circuit, monkeypatch) without return types