code: def pytorch_doc_link(
      name: str,  # Name of a PyTorch module, class or function
  ) -> (str, None):
      "Get the URL to the documentation of a PyTorch module, class or function"
      if name.startswith("F"):
          name = "torch.nn.functional" + name[1:]
      if not name.startswith("torch."):
          name = "torch." + name
      if name == "torch.Tensor":
          return f"{PYTORCH_URL}tensors.html"
      try:
          mod = importlib.import_module(name)
          return f"{PYTORCH_URL}{_mod2page(mod)}"
      except:
          pass
      splits = name.split(".")
      mod_name, fname = ".".join(splits[:-1]), splits[-1]
      if mod_name == "torch.Tensor":
          return f"{PYTORCH_URL}tensors.html#{name}"
      try:
          mod = importlib.import_module(mod_name)
          page = _mod2page(mod)
          return f"{PYTORCH_URL}{page}#{name}"
      except:
          return None
  
imports: from __future__ import annotations
  from types import ModuleType
  import importlib
label_desc: Use image node_id 2 for calling a global function with example usage: pytorch_doc_link(name) and returns: PYTORCH_URL, str, PYTORCH_URL, _mod2page, PYTORCH_URL, str, name, PYTORCH_URL, page, str, name, None