We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Planetoid dtype mismatch for CiteSeer
### 🐛 Describe the bug

I find that I can't load the CiteSeer dataset with double precision

```python
import torch_geometric as tg
tg.datasets.Planetoid(root="/tmp", name="CiteSeer")
```

I get this error

```
File /user/work/pc22286/mambaforge/envs/dkm/lib/python3.11/site-packages/torch_geometric/io/planetoid.py:34, in read_planetoid_data(folder, prefix)
     31 len_test_indices = (test_index.max() - test_index.min()).item() + 1
     33 tx_ext = torch.zeros(len_test_indices, tx.size(1))
---> 34 tx_ext[sorted_test_index - test_index.min(), :] = tx
     35 ty_ext = torch.zeros(len_test_indices, ty.size(1))
     36 ty_ext[sorted_test_index - test_index.min(), :] = ty

RuntimeError: Index put requires the source and destination dtypes match, got Double for the destination and Float for the source.
```

Fortunately, there is a workaround if I set the default precision to single precision

```python
import torch as t
t.set_default_dtype(t.float32)
tg.datasets.Planetoid(root="/tmp", name="CiteSeer") ## success, this time
```

and then I will convert to double precision manually later. Not a bit problem, but I expected to be able to use float64

### Environment

* PyG version: 2.3.1
* PyTorch version: 2.0.1
* OS: CentOS 7
* Python version: 3.11.3
* CUDA/cuDNN version: 12.0
* How you installed PyTorch and PyG (`conda`, `pip`, source): installed torch by conda (mamba), PyG by pip
* Any other relevant information (*e.g.*, version of `torch-scatter`):


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `torch_geometric/io/planetoid.py`
Content:
```
1 import os.path as osp
2 import sys
3 import warnings
4 from itertools import repeat
5 
6 import torch
7 
8 from torch_geometric.data import Data
9 from torch_geometric.io import read_txt_array
10 from torch_geometric.typing import SparseTensor
11 from torch_geometric.utils import coalesce, index_to_mask, remove_self_loops
12 
13 try:
14     import cPickle as pickle
15 except ImportError:
16     import pickle
17 
18 
19 def read_planetoid_data(folder, prefix):
20     names = ['x', 'tx', 'allx', 'y', 'ty', 'ally', 'graph', 'test.index']
21     items = [read_file(folder, prefix, name) for name in names]
22     x, tx, allx, y, ty, ally, graph, test_index = items
23     train_index = torch.arange(y.size(0), dtype=torch.long)
24     val_index = torch.arange(y.size(0), y.size(0) + 500, dtype=torch.long)
25     sorted_test_index = test_index.sort()[0]
26 
27     if prefix.lower() == 'citeseer':
28         # There are some isolated nodes in the Citeseer graph, resulting in
29         # none consecutive test indices. We need to identify them and add them
30         # as zero vectors to `tx` and `ty`.
31         len_test_indices = (test_index.max() - test_index.min()).item() + 1
32 
33         tx_ext = torch.zeros(len_test_indices, tx.size(1))
34         tx_ext[sorted_test_index - test_index.min(), :] = tx
35         ty_ext = torch.zeros(len_test_indices, ty.size(1))
36         ty_ext[sorted_test_index - test_index.min(), :] = ty
37 
38         tx, ty = tx_ext, ty_ext
39 
40     if prefix.lower() == 'nell.0.001':
41         tx_ext = torch.zeros(len(graph) - allx.size(0), x.size(1))
42         tx_ext[sorted_test_index - allx.size(0)] = tx
43 
44         ty_ext = torch.zeros(len(graph) - ally.size(0), y.size(1))
45         ty_ext[sorted_test_index - ally.size(0)] = ty
46 
47         tx, ty = tx_ext, ty_ext
48 
49         x = torch.cat([allx, tx], dim=0)
50         x[test_index] = x[sorted_test_index]
51 
52         # Creating feature vectors for relations.
53         row, col, value = SparseTensor.from_dense(x).coo()
54         rows, cols, values = [row], [col], [value]
55 
56         mask1 = index_to_mask(test_index, size=len(graph))
57         mask2 = index_to_mask(torch.arange(allx.size(0), len(graph)),
58                               size=len(graph))
59         mask = ~mask1 | ~mask2
60         isolated_index = mask.nonzero(as_tuple=False).view(-1)[allx.size(0):]
61 
62         rows += [isolated_index]
63         cols += [torch.arange(isolated_index.size(0)) + x.size(1)]
64         values += [torch.ones(isolated_index.size(0))]
65 
66         x = SparseTensor(row=torch.cat(rows), col=torch.cat(cols),
67                          value=torch.cat(values))
68     else:
69         x = torch.cat([allx, tx], dim=0)
70         x[test_index] = x[sorted_test_index]
71 
72     y = torch.cat([ally, ty], dim=0).max(dim=1)[1]
73     y[test_index] = y[sorted_test_index]
74 
75     train_mask = index_to_mask(train_index, size=y.size(0))
76     val_mask = index_to_mask(val_index, size=y.size(0))
77     test_mask = index_to_mask(test_index, size=y.size(0))
78 
79     edge_index = edge_index_from_dict(graph, num_nodes=y.size(0))
80 
81     data = Data(x=x, edge_index=edge_index, y=y)
82     data.train_mask = train_mask
83     data.val_mask = val_mask
84     data.test_mask = test_mask
85 
86     return data
87 
88 
89 def read_file(folder, prefix, name):
90     path = osp.join(folder, f'ind.{prefix.lower()}.{name}')
91 
92     if name == 'test.index':
93         return read_txt_array(path, dtype=torch.long)
94 
95     with open(path, 'rb') as f:
96         if sys.version_info > (3, 0):
97             warnings.filterwarnings('ignore', '.*`scipy.sparse.csr` name.*')
98             out = pickle.load(f, encoding='latin1')
99         else:
100             out = pickle.load(f)
101 
102     if name == 'graph':
103         return out
104 
105     out = out.todense() if hasattr(out, 'todense') else out
106     out = torch.from_numpy(out).to(torch.float)
107     return out
108 
109 
110 def edge_index_from_dict(graph_dict, num_nodes=None):
111     row, col = [], []
112     for key, value in graph_dict.items():
113         row += repeat(key, len(value))
114         col += value
115     edge_index = torch.stack([torch.tensor(row), torch.tensor(col)], dim=0)
116 
117     # NOTE: There are some duplicated edges and self loops in the datasets.
118     #       Other implementations do not remove them!
119     edge_index, _ = remove_self_loops(edge_index)
120     edge_index = coalesce(edge_index, num_nodes=num_nodes)
121 
122     return edge_index
123
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/torch_geometric/io/planetoid.py b/torch_geometric/io/planetoid.py
--- a/torch_geometric/io/planetoid.py
+++ b/torch_geometric/io/planetoid.py
@@ -30,9 +30,9 @@
         # as zero vectors to `tx` and `ty`.
         len_test_indices = (test_index.max() - test_index.min()).item() + 1
 
-        tx_ext = torch.zeros(len_test_indices, tx.size(1))
+        tx_ext = torch.zeros(len_test_indices, tx.size(1), dtype=tx.dtype)
         tx_ext[sorted_test_index - test_index.min(), :] = tx
-        ty_ext = torch.zeros(len_test_indices, ty.size(1))
+        ty_ext = torch.zeros(len_test_indices, ty.size(1), dtype=ty.dtype)
         ty_ext[sorted_test_index - test_index.min(), :] = ty
 
         tx, ty = tx_ext, ty_ext

{"golden_diff": "diff --git a/torch_geometric/io/planetoid.py b/torch_geometric/io/planetoid.py\n--- a/torch_geometric/io/planetoid.py\n+++ b/torch_geometric/io/planetoid.py\n@@ -30,9 +30,9 @@\n         # as zero vectors to `tx` and `ty`.\n         len_test_indices = (test_index.max() - test_index.min()).item() + 1\n \n-        tx_ext = torch.zeros(len_test_indices, tx.size(1))\n+        tx_ext = torch.zeros(len_test_indices, tx.size(1), dtype=tx.dtype)\n         tx_ext[sorted_test_index - test_index.min(), :] = tx\n-        ty_ext = torch.zeros(len_test_indices, ty.size(1))\n+        ty_ext = torch.zeros(len_test_indices, ty.size(1), dtype=ty.dtype)\n         ty_ext[sorted_test_index - test_index.min(), :] = ty\n \n         tx, ty = tx_ext, ty_ext\n", "issue": "Planetoid dtype mismatch for CiteSeer\n### \ud83d\udc1b Describe the bug\r\n\r\nI find that I can't load the CiteSeer dataset with double precision\r\n\r\n```python\r\nimport torch_geometric as tg\r\ntg.datasets.Planetoid(root=\"/tmp\", name=\"CiteSeer\")\r\n```\r\n\r\nI get this error\r\n\r\n```\r\nFile /user/work/pc22286/mambaforge/envs/dkm/lib/python3.11/site-packages/torch_geometric/io/planetoid.py:34, in read_planetoid_data(folder, prefix)\r\n     31 len_test_indices = (test_index.max() - test_index.min()).item() + 1\r\n     33 tx_ext = torch.zeros(len_test_indices, tx.size(1))\r\n---> 34 tx_ext[sorted_test_index - test_index.min(), :] = tx\r\n     35 ty_ext = torch.zeros(len_test_indices, ty.size(1))\r\n     36 ty_ext[sorted_test_index - test_index.min(), :] = ty\r\n\r\nRuntimeError: Index put requires the source and destination dtypes match, got Double for the destination and Float for the source.\r\n```\r\n\r\nFortunately, there is a workaround if I set the default precision to single precision\r\n\r\n```python\r\nimport torch as t\r\nt.set_default_dtype(t.float32)\r\ntg.datasets.Planetoid(root=\"/tmp\", name=\"CiteSeer\") ## success, this time\r\n```\r\n\r\nand then I will convert to double precision manually later. Not a bit problem, but I expected to be able to use float64\r\n\r\n### Environment\r\n\r\n* PyG version: 2.3.1\r\n* PyTorch version: 2.0.1\r\n* OS: CentOS 7\r\n* Python version: 3.11.3\r\n* CUDA/cuDNN version: 12.0\r\n* How you installed PyTorch and PyG (`conda`, `pip`, source): installed torch by conda (mamba), PyG by pip\r\n* Any other relevant information (*e.g.*, version of `torch-scatter`):\r\n\n", "before_files": [{"content": "import os.path as osp\nimport sys\nimport warnings\nfrom itertools import repeat\n\nimport torch\n\nfrom torch_geometric.data import Data\nfrom torch_geometric.io import read_txt_array\nfrom torch_geometric.typing import SparseTensor\nfrom torch_geometric.utils import coalesce, index_to_mask, remove_self_loops\n\ntry:\n    import cPickle as pickle\nexcept ImportError:\n    import pickle\n\n\ndef read_planetoid_data(folder, prefix):\n    names = ['x', 'tx', 'allx', 'y', 'ty', 'ally', 'graph', 'test.index']\n    items = [read_file(folder, prefix, name) for name in names]\n    x, tx, allx, y, ty, ally, graph, test_index = items\n    train_index = torch.arange(y.size(0), dtype=torch.long)\n    val_index = torch.arange(y.size(0), y.size(0) + 500, dtype=torch.long)\n    sorted_test_index = test_index.sort()[0]\n\n    if prefix.lower() == 'citeseer':\n        # There are some isolated nodes in the Citeseer graph, resulting in\n        # none consecutive test indices. We need to identify them and add them\n        # as zero vectors to `tx` and `ty`.\n        len_test_indices = (test_index.max() - test_index.min()).item() + 1\n\n        tx_ext = torch.zeros(len_test_indices, tx.size(1))\n        tx_ext[sorted_test_index - test_index.min(), :] = tx\n        ty_ext = torch.zeros(len_test_indices, ty.size(1))\n        ty_ext[sorted_test_index - test_index.min(), :] = ty\n\n        tx, ty = tx_ext, ty_ext\n\n    if prefix.lower() == 'nell.0.001':\n        tx_ext = torch.zeros(len(graph) - allx.size(0), x.size(1))\n        tx_ext[sorted_test_index - allx.size(0)] = tx\n\n        ty_ext = torch.zeros(len(graph) - ally.size(0), y.size(1))\n        ty_ext[sorted_test_index - ally.size(0)] = ty\n\n        tx, ty = tx_ext, ty_ext\n\n        x = torch.cat([allx, tx], dim=0)\n        x[test_index] = x[sorted_test_index]\n\n        # Creating feature vectors for relations.\n        row, col, value = SparseTensor.from_dense(x).coo()\n        rows, cols, values = [row], [col], [value]\n\n        mask1 = index_to_mask(test_index, size=len(graph))\n        mask2 = index_to_mask(torch.arange(allx.size(0), len(graph)),\n                              size=len(graph))\n        mask = ~mask1 | ~mask2\n        isolated_index = mask.nonzero(as_tuple=False).view(-1)[allx.size(0):]\n\n        rows += [isolated_index]\n        cols += [torch.arange(isolated_index.size(0)) + x.size(1)]\n        values += [torch.ones(isolated_index.size(0))]\n\n        x = SparseTensor(row=torch.cat(rows), col=torch.cat(cols),\n                         value=torch.cat(values))\n    else:\n        x = torch.cat([allx, tx], dim=0)\n        x[test_index] = x[sorted_test_index]\n\n    y = torch.cat([ally, ty], dim=0).max(dim=1)[1]\n    y[test_index] = y[sorted_test_index]\n\n    train_mask = index_to_mask(train_index, size=y.size(0))\n    val_mask = index_to_mask(val_index, size=y.size(0))\n    test_mask = index_to_mask(test_index, size=y.size(0))\n\n    edge_index = edge_index_from_dict(graph, num_nodes=y.size(0))\n\n    data = Data(x=x, edge_index=edge_index, y=y)\n    data.train_mask = train_mask\n    data.val_mask = val_mask\n    data.test_mask = test_mask\n\n    return data\n\n\ndef read_file(folder, prefix, name):\n    path = osp.join(folder, f'ind.{prefix.lower()}.{name}')\n\n    if name == 'test.index':\n        return read_txt_array(path, dtype=torch.long)\n\n    with open(path, 'rb') as f:\n        if sys.version_info > (3, 0):\n            warnings.filterwarnings('ignore', '.*`scipy.sparse.csr` name.*')\n            out = pickle.load(f, encoding='latin1')\n        else:\n            out = pickle.load(f)\n\n    if name == 'graph':\n        return out\n\n    out = out.todense() if hasattr(out, 'todense') else out\n    out = torch.from_numpy(out).to(torch.float)\n    return out\n\n\ndef edge_index_from_dict(graph_dict, num_nodes=None):\n    row, col = [], []\n    for key, value in graph_dict.items():\n        row += repeat(key, len(value))\n        col += value\n    edge_index = torch.stack([torch.tensor(row), torch.tensor(col)], dim=0)\n\n    # NOTE: There are some duplicated edges and self loops in the datasets.\n    #       Other implementations do not remove them!\n    edge_index, _ = remove_self_loops(edge_index)\n    edge_index = coalesce(edge_index, num_nodes=num_nodes)\n\n    return edge_index\n", "path": "torch_geometric/io/planetoid.py"}], "after_files": [{"content": "import os.path as osp\nimport sys\nimport warnings\nfrom itertools import repeat\n\nimport torch\n\nfrom torch_geometric.data import Data\nfrom torch_geometric.io import read_txt_array\nfrom torch_geometric.typing import SparseTensor\nfrom torch_geometric.utils import coalesce, index_to_mask, remove_self_loops\n\ntry:\n    import cPickle as pickle\nexcept ImportError:\n    import pickle\n\n\ndef read_planetoid_data(folder, prefix):\n    names = ['x', 'tx', 'allx', 'y', 'ty', 'ally', 'graph', 'test.index']\n    items = [read_file(folder, prefix, name) for name in names]\n    x, tx, allx, y, ty, ally, graph, test_index = items\n    train_index = torch.arange(y.size(0), dtype=torch.long)\n    val_index = torch.arange(y.size(0), y.size(0) + 500, dtype=torch.long)\n    sorted_test_index = test_index.sort()[0]\n\n    if prefix.lower() == 'citeseer':\n        # There are some isolated nodes in the Citeseer graph, resulting in\n        # none consecutive test indices. We need to identify them and add them\n        # as zero vectors to `tx` and `ty`.\n        len_test_indices = (test_index.max() - test_index.min()).item() + 1\n\n        tx_ext = torch.zeros(len_test_indices, tx.size(1), dtype=tx.dtype)\n        tx_ext[sorted_test_index - test_index.min(), :] = tx\n        ty_ext = torch.zeros(len_test_indices, ty.size(1), dtype=ty.dtype)\n        ty_ext[sorted_test_index - test_index.min(), :] = ty\n\n        tx, ty = tx_ext, ty_ext\n\n    if prefix.lower() == 'nell.0.001':\n        tx_ext = torch.zeros(len(graph) - allx.size(0), x.size(1))\n        tx_ext[sorted_test_index - allx.size(0)] = tx\n\n        ty_ext = torch.zeros(len(graph) - ally.size(0), y.size(1))\n        ty_ext[sorted_test_index - ally.size(0)] = ty\n\n        tx, ty = tx_ext, ty_ext\n\n        x = torch.cat([allx, tx], dim=0)\n        x[test_index] = x[sorted_test_index]\n\n        # Creating feature vectors for relations.\n        row, col, value = SparseTensor.from_dense(x).coo()\n        rows, cols, values = [row], [col], [value]\n\n        mask1 = index_to_mask(test_index, size=len(graph))\n        mask2 = index_to_mask(torch.arange(allx.size(0), len(graph)),\n                              size=len(graph))\n        mask = ~mask1 | ~mask2\n        isolated_index = mask.nonzero(as_tuple=False).view(-1)[allx.size(0):]\n\n        rows += [isolated_index]\n        cols += [torch.arange(isolated_index.size(0)) + x.size(1)]\n        values += [torch.ones(isolated_index.size(0))]\n\n        x = SparseTensor(row=torch.cat(rows), col=torch.cat(cols),\n                         value=torch.cat(values))\n    else:\n        x = torch.cat([allx, tx], dim=0)\n        x[test_index] = x[sorted_test_index]\n\n    y = torch.cat([ally, ty], dim=0).max(dim=1)[1]\n    y[test_index] = y[sorted_test_index]\n\n    train_mask = index_to_mask(train_index, size=y.size(0))\n    val_mask = index_to_mask(val_index, size=y.size(0))\n    test_mask = index_to_mask(test_index, size=y.size(0))\n\n    edge_index = edge_index_from_dict(graph, num_nodes=y.size(0))\n\n    data = Data(x=x, edge_index=edge_index, y=y)\n    data.train_mask = train_mask\n    data.val_mask = val_mask\n    data.test_mask = test_mask\n\n    return data\n\n\ndef read_file(folder, prefix, name):\n    path = osp.join(folder, f'ind.{prefix.lower()}.{name}')\n\n    if name == 'test.index':\n        return read_txt_array(path, dtype=torch.long)\n\n    with open(path, 'rb') as f:\n        if sys.version_info > (3, 0):\n            warnings.filterwarnings('ignore', '.*`scipy.sparse.csr` name.*')\n            out = pickle.load(f, encoding='latin1')\n        else:\n            out = pickle.load(f)\n\n    if name == 'graph':\n        return out\n\n    out = out.todense() if hasattr(out, 'todense') else out\n    out = torch.from_numpy(out).to(torch.float)\n    return out\n\n\ndef edge_index_from_dict(graph_dict, num_nodes=None):\n    row, col = [], []\n    for key, value in graph_dict.items():\n        row += repeat(key, len(value))\n        col += value\n    edge_index = torch.stack([torch.tensor(row), torch.tensor(col)], dim=0)\n\n    # NOTE: There are some duplicated edges and self loops in the datasets.\n    #       Other implementations do not remove them!\n    edge_index, _ = remove_self_loops(edge_index)\n    edge_index = coalesce(edge_index, num_nodes=num_nodes)\n\n    return edge_index\n", "path": "torch_geometric/io/planetoid.py"}]}