We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
The the feature dim of data.x is zero in Proteins dataset with the pyg version after 2.0.5
### 🐛 Describe the bug

The main reason is in line 136 of tu_dataset.py

it is strange that the value of num_edge_attributes is larger than the feature dimension of self.data.x in proteins, which leads to the resulting dimension of self.data.x is num_nodes*0


### Environment

* PyG version:
* PyTorch version:
* OS:
* Python version:
* CUDA/cuDNN version:
* How you installed PyTorch and PyG (`conda`, `pip`, source):
* 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/tu.py`
Content:
```
1 import glob
2 import os
3 import os.path as osp
4 
5 import numpy as np
6 import torch
7 import torch.nn.functional as F
8 from torch_sparse import coalesce
9 
10 from torch_geometric.data import Data
11 from torch_geometric.io import read_txt_array
12 from torch_geometric.utils import remove_self_loops
13 
14 names = [
15     'A', 'graph_indicator', 'node_labels', 'node_attributes'
16     'edge_labels', 'edge_attributes', 'graph_labels', 'graph_attributes'
17 ]
18 
19 
20 def read_tu_data(folder, prefix):
21     files = glob.glob(osp.join(folder, f'{prefix}_*.txt'))
22     names = [f.split(os.sep)[-1][len(prefix) + 1:-4] for f in files]
23 
24     edge_index = read_file(folder, prefix, 'A', torch.long).t() - 1
25     batch = read_file(folder, prefix, 'graph_indicator', torch.long) - 1
26 
27     node_attributes = torch.empty((batch.size(0), 0))
28     if 'node_attributes' in names:
29         node_attributes = read_file(folder, prefix, 'node_attributes')
30 
31     node_labels = torch.empty((batch.size(0), 0))
32     if 'node_labels' in names:
33         node_labels = read_file(folder, prefix, 'node_labels', torch.long)
34         if node_labels.dim() == 1:
35             node_labels = node_labels.unsqueeze(-1)
36         node_labels = node_labels - node_labels.min(dim=0)[0]
37         node_labels = node_labels.unbind(dim=-1)
38         node_labels = [F.one_hot(x, num_classes=-1) for x in node_labels]
39         node_labels = torch.cat(node_labels, dim=-1).to(torch.float)
40 
41     edge_attributes = torch.empty((edge_index.size(1), 0))
42     if 'edge_attributes' in names:
43         edge_attributes = read_file(folder, prefix, 'edge_attributes')
44 
45     edge_labels = torch.empty((edge_index.size(1), 0))
46     if 'edge_labels' in names:
47         edge_labels = read_file(folder, prefix, 'edge_labels', torch.long)
48         if edge_labels.dim() == 1:
49             edge_labels = edge_labels.unsqueeze(-1)
50         edge_labels = edge_labels - edge_labels.min(dim=0)[0]
51         edge_labels = edge_labels.unbind(dim=-1)
52         edge_labels = [F.one_hot(e, num_classes=-1) for e in edge_labels]
53         edge_labels = torch.cat(edge_labels, dim=-1).to(torch.float)
54 
55     x = cat([node_attributes, node_labels])
56     edge_attr = cat([edge_attributes, edge_labels])
57 
58     y = None
59     if 'graph_attributes' in names:  # Regression problem.
60         y = read_file(folder, prefix, 'graph_attributes')
61     elif 'graph_labels' in names:  # Classification problem.
62         y = read_file(folder, prefix, 'graph_labels', torch.long)
63         _, y = y.unique(sorted=True, return_inverse=True)
64 
65     num_nodes = edge_index.max().item() + 1 if x is None else x.size(0)
66     edge_index, edge_attr = remove_self_loops(edge_index, edge_attr)
67     edge_index, edge_attr = coalesce(edge_index, edge_attr, num_nodes,
68                                      num_nodes)
69 
70     data = Data(x=x, edge_index=edge_index, edge_attr=edge_attr, y=y)
71     data, slices = split(data, batch)
72 
73     sizes = {
74         'num_node_attributes': node_attributes.size(-1),
75         'num_node_labels': node_labels.size(-1),
76         'num_edge_attributes': edge_attributes.size(-1),
77         'num_edge_labels': edge_labels.size(-1),
78     }
79 
80     return data, slices, sizes
81 
82 
83 def read_file(folder, prefix, name, dtype=None):
84     path = osp.join(folder, f'{prefix}_{name}.txt')
85     return read_txt_array(path, sep=',', dtype=dtype)
86 
87 
88 def cat(seq):
89     seq = [item for item in seq if item is not None]
90     seq = [item for item in seq if item.numel() > 0]
91     seq = [item.unsqueeze(-1) if item.dim() == 1 else item for item in seq]
92     return torch.cat(seq, dim=-1) if len(seq) > 0 else None
93 
94 
95 def split(data, batch):
96     node_slice = torch.cumsum(torch.from_numpy(np.bincount(batch)), 0)
97     node_slice = torch.cat([torch.tensor([0]), node_slice])
98 
99     row, _ = data.edge_index
100     edge_slice = torch.cumsum(torch.from_numpy(np.bincount(batch[row])), 0)
101     edge_slice = torch.cat([torch.tensor([0]), edge_slice])
102 
103     # Edge indices should start at zero for every graph.
104     data.edge_index -= node_slice[batch[row]].unsqueeze(0)
105 
106     slices = {'edge_index': edge_slice}
107     if data.x is not None:
108         slices['x'] = node_slice
109     else:
110         # Imitate `collate` functionality:
111         data._num_nodes = torch.bincount(batch).tolist()
112         data.num_nodes = batch.numel()
113     if data.edge_attr is not None:
114         slices['edge_attr'] = edge_slice
115     if data.y is not None:
116         if data.y.size(0) == batch.size(0):
117             slices['y'] = node_slice
118         else:
119             slices['y'] = torch.arange(0, batch[-1] + 2, dtype=torch.long)
120 
121     return data, slices
122
```
--- 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/tu.py b/torch_geometric/io/tu.py
--- a/torch_geometric/io/tu.py
+++ b/torch_geometric/io/tu.py
@@ -27,6 +27,8 @@
     node_attributes = torch.empty((batch.size(0), 0))
     if 'node_attributes' in names:
         node_attributes = read_file(folder, prefix, 'node_attributes')
+        if node_attributes.dim() == 1:
+            node_attributes = node_attributes.unsqueeze(-1)
 
     node_labels = torch.empty((batch.size(0), 0))
     if 'node_labels' in names:
@@ -41,6 +43,8 @@
     edge_attributes = torch.empty((edge_index.size(1), 0))
     if 'edge_attributes' in names:
         edge_attributes = read_file(folder, prefix, 'edge_attributes')
+        if edge_attributes.dim() == 1:
+            edge_attributes = edge_attributes.unsqueeze(-1)
 
     edge_labels = torch.empty((edge_index.size(1), 0))
     if 'edge_labels' in names:

{"golden_diff": "diff --git a/torch_geometric/io/tu.py b/torch_geometric/io/tu.py\n--- a/torch_geometric/io/tu.py\n+++ b/torch_geometric/io/tu.py\n@@ -27,6 +27,8 @@\n     node_attributes = torch.empty((batch.size(0), 0))\n     if 'node_attributes' in names:\n         node_attributes = read_file(folder, prefix, 'node_attributes')\n+        if node_attributes.dim() == 1:\n+            node_attributes = node_attributes.unsqueeze(-1)\n \n     node_labels = torch.empty((batch.size(0), 0))\n     if 'node_labels' in names:\n@@ -41,6 +43,8 @@\n     edge_attributes = torch.empty((edge_index.size(1), 0))\n     if 'edge_attributes' in names:\n         edge_attributes = read_file(folder, prefix, 'edge_attributes')\n+        if edge_attributes.dim() == 1:\n+            edge_attributes = edge_attributes.unsqueeze(-1)\n \n     edge_labels = torch.empty((edge_index.size(1), 0))\n     if 'edge_labels' in names:\n", "issue": "The the feature dim of data.x is zero in Proteins dataset with the pyg version after 2.0.5\n### \ud83d\udc1b Describe the bug\n\nThe main reason is in line 136 of tu_dataset.py\r\n\r\nit is strange that the value of num_edge_attributes is larger than the feature dimension of self.data.x in proteins, which leads to the resulting dimension of self.data.x is num_nodes*0\r\n\n\n### Environment\n\n* PyG version:\r\n* PyTorch version:\r\n* OS:\r\n* Python version:\r\n* CUDA/cuDNN version:\r\n* How you installed PyTorch and PyG (`conda`, `pip`, source):\r\n* Any other relevant information (*e.g.*, version of `torch-scatter`):\r\n\n", "before_files": [{"content": "import glob\nimport os\nimport os.path as osp\n\nimport numpy as np\nimport torch\nimport torch.nn.functional as F\nfrom torch_sparse import coalesce\n\nfrom torch_geometric.data import Data\nfrom torch_geometric.io import read_txt_array\nfrom torch_geometric.utils import remove_self_loops\n\nnames = [\n    'A', 'graph_indicator', 'node_labels', 'node_attributes'\n    'edge_labels', 'edge_attributes', 'graph_labels', 'graph_attributes'\n]\n\n\ndef read_tu_data(folder, prefix):\n    files = glob.glob(osp.join(folder, f'{prefix}_*.txt'))\n    names = [f.split(os.sep)[-1][len(prefix) + 1:-4] for f in files]\n\n    edge_index = read_file(folder, prefix, 'A', torch.long).t() - 1\n    batch = read_file(folder, prefix, 'graph_indicator', torch.long) - 1\n\n    node_attributes = torch.empty((batch.size(0), 0))\n    if 'node_attributes' in names:\n        node_attributes = read_file(folder, prefix, 'node_attributes')\n\n    node_labels = torch.empty((batch.size(0), 0))\n    if 'node_labels' in names:\n        node_labels = read_file(folder, prefix, 'node_labels', torch.long)\n        if node_labels.dim() == 1:\n            node_labels = node_labels.unsqueeze(-1)\n        node_labels = node_labels - node_labels.min(dim=0)[0]\n        node_labels = node_labels.unbind(dim=-1)\n        node_labels = [F.one_hot(x, num_classes=-1) for x in node_labels]\n        node_labels = torch.cat(node_labels, dim=-1).to(torch.float)\n\n    edge_attributes = torch.empty((edge_index.size(1), 0))\n    if 'edge_attributes' in names:\n        edge_attributes = read_file(folder, prefix, 'edge_attributes')\n\n    edge_labels = torch.empty((edge_index.size(1), 0))\n    if 'edge_labels' in names:\n        edge_labels = read_file(folder, prefix, 'edge_labels', torch.long)\n        if edge_labels.dim() == 1:\n            edge_labels = edge_labels.unsqueeze(-1)\n        edge_labels = edge_labels - edge_labels.min(dim=0)[0]\n        edge_labels = edge_labels.unbind(dim=-1)\n        edge_labels = [F.one_hot(e, num_classes=-1) for e in edge_labels]\n        edge_labels = torch.cat(edge_labels, dim=-1).to(torch.float)\n\n    x = cat([node_attributes, node_labels])\n    edge_attr = cat([edge_attributes, edge_labels])\n\n    y = None\n    if 'graph_attributes' in names:  # Regression problem.\n        y = read_file(folder, prefix, 'graph_attributes')\n    elif 'graph_labels' in names:  # Classification problem.\n        y = read_file(folder, prefix, 'graph_labels', torch.long)\n        _, y = y.unique(sorted=True, return_inverse=True)\n\n    num_nodes = edge_index.max().item() + 1 if x is None else x.size(0)\n    edge_index, edge_attr = remove_self_loops(edge_index, edge_attr)\n    edge_index, edge_attr = coalesce(edge_index, edge_attr, num_nodes,\n                                     num_nodes)\n\n    data = Data(x=x, edge_index=edge_index, edge_attr=edge_attr, y=y)\n    data, slices = split(data, batch)\n\n    sizes = {\n        'num_node_attributes': node_attributes.size(-1),\n        'num_node_labels': node_labels.size(-1),\n        'num_edge_attributes': edge_attributes.size(-1),\n        'num_edge_labels': edge_labels.size(-1),\n    }\n\n    return data, slices, sizes\n\n\ndef read_file(folder, prefix, name, dtype=None):\n    path = osp.join(folder, f'{prefix}_{name}.txt')\n    return read_txt_array(path, sep=',', dtype=dtype)\n\n\ndef cat(seq):\n    seq = [item for item in seq if item is not None]\n    seq = [item for item in seq if item.numel() > 0]\n    seq = [item.unsqueeze(-1) if item.dim() == 1 else item for item in seq]\n    return torch.cat(seq, dim=-1) if len(seq) > 0 else None\n\n\ndef split(data, batch):\n    node_slice = torch.cumsum(torch.from_numpy(np.bincount(batch)), 0)\n    node_slice = torch.cat([torch.tensor([0]), node_slice])\n\n    row, _ = data.edge_index\n    edge_slice = torch.cumsum(torch.from_numpy(np.bincount(batch[row])), 0)\n    edge_slice = torch.cat([torch.tensor([0]), edge_slice])\n\n    # Edge indices should start at zero for every graph.\n    data.edge_index -= node_slice[batch[row]].unsqueeze(0)\n\n    slices = {'edge_index': edge_slice}\n    if data.x is not None:\n        slices['x'] = node_slice\n    else:\n        # Imitate `collate` functionality:\n        data._num_nodes = torch.bincount(batch).tolist()\n        data.num_nodes = batch.numel()\n    if data.edge_attr is not None:\n        slices['edge_attr'] = edge_slice\n    if data.y is not None:\n        if data.y.size(0) == batch.size(0):\n            slices['y'] = node_slice\n        else:\n            slices['y'] = torch.arange(0, batch[-1] + 2, dtype=torch.long)\n\n    return data, slices\n", "path": "torch_geometric/io/tu.py"}], "after_files": [{"content": "import glob\nimport os\nimport os.path as osp\n\nimport numpy as np\nimport torch\nimport torch.nn.functional as F\nfrom torch_sparse import coalesce\n\nfrom torch_geometric.data import Data\nfrom torch_geometric.io import read_txt_array\nfrom torch_geometric.utils import remove_self_loops\n\nnames = [\n    'A', 'graph_indicator', 'node_labels', 'node_attributes'\n    'edge_labels', 'edge_attributes', 'graph_labels', 'graph_attributes'\n]\n\n\ndef read_tu_data(folder, prefix):\n    files = glob.glob(osp.join(folder, f'{prefix}_*.txt'))\n    names = [f.split(os.sep)[-1][len(prefix) + 1:-4] for f in files]\n\n    edge_index = read_file(folder, prefix, 'A', torch.long).t() - 1\n    batch = read_file(folder, prefix, 'graph_indicator', torch.long) - 1\n\n    node_attributes = torch.empty((batch.size(0), 0))\n    if 'node_attributes' in names:\n        node_attributes = read_file(folder, prefix, 'node_attributes')\n        if node_attributes.dim() == 1:\n            node_attributes = node_attributes.unsqueeze(-1)\n\n    node_labels = torch.empty((batch.size(0), 0))\n    if 'node_labels' in names:\n        node_labels = read_file(folder, prefix, 'node_labels', torch.long)\n        if node_labels.dim() == 1:\n            node_labels = node_labels.unsqueeze(-1)\n        node_labels = node_labels - node_labels.min(dim=0)[0]\n        node_labels = node_labels.unbind(dim=-1)\n        node_labels = [F.one_hot(x, num_classes=-1) for x in node_labels]\n        node_labels = torch.cat(node_labels, dim=-1).to(torch.float)\n\n    edge_attributes = torch.empty((edge_index.size(1), 0))\n    if 'edge_attributes' in names:\n        edge_attributes = read_file(folder, prefix, 'edge_attributes')\n        if edge_attributes.dim() == 1:\n            edge_attributes = edge_attributes.unsqueeze(-1)\n\n    edge_labels = torch.empty((edge_index.size(1), 0))\n    if 'edge_labels' in names:\n        edge_labels = read_file(folder, prefix, 'edge_labels', torch.long)\n        if edge_labels.dim() == 1:\n            edge_labels = edge_labels.unsqueeze(-1)\n        edge_labels = edge_labels - edge_labels.min(dim=0)[0]\n        edge_labels = edge_labels.unbind(dim=-1)\n        edge_labels = [F.one_hot(e, num_classes=-1) for e in edge_labels]\n        edge_labels = torch.cat(edge_labels, dim=-1).to(torch.float)\n\n    x = cat([node_attributes, node_labels])\n    edge_attr = cat([edge_attributes, edge_labels])\n\n    y = None\n    if 'graph_attributes' in names:  # Regression problem.\n        y = read_file(folder, prefix, 'graph_attributes')\n    elif 'graph_labels' in names:  # Classification problem.\n        y = read_file(folder, prefix, 'graph_labels', torch.long)\n        _, y = y.unique(sorted=True, return_inverse=True)\n\n    num_nodes = edge_index.max().item() + 1 if x is None else x.size(0)\n    edge_index, edge_attr = remove_self_loops(edge_index, edge_attr)\n    edge_index, edge_attr = coalesce(edge_index, edge_attr, num_nodes,\n                                     num_nodes)\n\n    data = Data(x=x, edge_index=edge_index, edge_attr=edge_attr, y=y)\n    data, slices = split(data, batch)\n\n    sizes = {\n        'num_node_attributes': node_attributes.size(-1),\n        'num_node_labels': node_labels.size(-1),\n        'num_edge_attributes': edge_attributes.size(-1),\n        'num_edge_labels': edge_labels.size(-1),\n    }\n\n    return data, slices, sizes\n\n\ndef read_file(folder, prefix, name, dtype=None):\n    path = osp.join(folder, f'{prefix}_{name}.txt')\n    return read_txt_array(path, sep=',', dtype=dtype)\n\n\ndef cat(seq):\n    seq = [item for item in seq if item is not None]\n    seq = [item for item in seq if item.numel() > 0]\n    seq = [item.unsqueeze(-1) if item.dim() == 1 else item for item in seq]\n    return torch.cat(seq, dim=-1) if len(seq) > 0 else None\n\n\ndef split(data, batch):\n    node_slice = torch.cumsum(torch.from_numpy(np.bincount(batch)), 0)\n    node_slice = torch.cat([torch.tensor([0]), node_slice])\n\n    row, _ = data.edge_index\n    edge_slice = torch.cumsum(torch.from_numpy(np.bincount(batch[row])), 0)\n    edge_slice = torch.cat([torch.tensor([0]), edge_slice])\n\n    # Edge indices should start at zero for every graph.\n    data.edge_index -= node_slice[batch[row]].unsqueeze(0)\n\n    slices = {'edge_index': edge_slice}\n    if data.x is not None:\n        slices['x'] = node_slice\n    else:\n        # Imitate `collate` functionality:\n        data._num_nodes = torch.bincount(batch).tolist()\n        data.num_nodes = batch.numel()\n    if data.edge_attr is not None:\n        slices['edge_attr'] = edge_slice\n    if data.y is not None:\n        if data.y.size(0) == batch.size(0):\n            slices['y'] = node_slice\n        else:\n            slices['y'] = torch.arange(0, batch[-1] + 2, dtype=torch.long)\n\n    return data, slices\n", "path": "torch_geometric/io/tu.py"}]}