Repository: pyg-team/pytorch_geometric (branch: master)
Commit date: 2023-11-14T01:03:49Z

Workflow file: .github/workflows/latest_testing.yml (Testing PyTorch nightly)
name: Testing PyTorch nightly

on:  # yamllint disable-line rule:truthy
  push:
    branches:
      - master
  pull_request:

jobs:

  latest_pytest:
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 40

      # Skip workflow if only certain files have been changed.
      - name: Get changed files
        id: changed-files-specific
        uses: tj-actions/changed-files@v34
        with:
          files: |
            benchmark/**
            conda/**
            docker/**
            docs/**
            examples/**
            graphgym/**
            README.md
            CHANGELOG.md

      - name: Setup packages
        if: steps.changed-files-specific.outputs.only_changed != 'true'
        uses: ./.github/actions/setup
        with:
          torch-version: nightly

      - name: Install main package
        if: steps.changed-files-specific.outputs.only_changed != 'true'
        run: |
          pip install -e .[test]

      - name: Run tests
        if: steps.changed-files-specific.outputs.only_changed != 'true'
        run: |
          pytest

env:
  PIP_INDEX_URL: http://localhost:8629/2023-11-14
  UV_INDEX_URL: http://localhost:8629/2023-11-14


Failed build logs:
step_name: latest_pytest/6_Run tests.txt
log: ##[group]Run pytest
[36;1mpytest[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.8.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib
##[endgroup]
ImportError while loading conftest '/home/runner/work/pytorch_geometric/pytorch_geometric/test/conftest.py'.
test/conftest.py:8: in <module>
    import torch_geometric.typing
torch_geometric/__init__.py:6: in <module>
    import torch_geometric.datasets
torch_geometric/datasets/__init__.py:101: in <module>
    from .explainer_dataset import ExplainerDataset
torch_geometric/datasets/explainer_dataset.py:8: in <module>
    from torch_geometric.explain import Explanation
torch_geometric/explain/__init__.py:3: in <module>
    from .algorithm import *  # noqa
torch_geometric/explain/algorithm/__init__.py:1: in <module>
    from .base import ExplainerAlgorithm
torch_geometric/explain/algorithm/base.py:14: in <module>
    from torch_geometric.nn import MessagePassing
torch_geometric/nn/__init__.py:2: in <module>
    from .sequential import Sequential
torch_geometric/nn/sequential.py:8: in <module>
    from torch_geometric.nn.conv.utils.jit import class_from_module_repr
torch_geometric/nn/conv/__init__.py:6: in <module>
    from .sage_conv_temporal import SAGEConv_temporal
E   ModuleNotFoundError: No module named 'torch_geometric.nn.conv.sage_conv_temporal'
##[error]Process completed with exit code 4.


Changed files:
examples/hetero/hetero_link_pred_temporal.py
examples/homo_link_pred_temporal.py
torch_geometric/nn/conv/__init__.py
torch_geometric/sampler/neighbor_sampler.py

Fix diff:
diff --git a/examples/hetero/hetero_link_pred_temporal.py b/examples/hetero/hetero_link_pred_temporal.py
index 50739ea4e..347f6095c 100644
--- a/examples/hetero/hetero_link_pred_temporal.py
+++ b/examples/hetero/hetero_link_pred_temporal.py
@@ -12,6 +12,9 @@ from torch_geometric.nn import to_hetero
 from torch_geometric.nn.conv import SAGEConv
 
 parser = argparse.ArgumentParser()
+parser.add_argument('--profile_code', action='store_true',
+                    help='Display timing information')
+parser.set_defaults(profile_code=False)
 parser.add_argument('--use_weighted_loss', action='store_true',
                     help='Whether to use weighted MSE loss.')
 args = parser.parse_args()
@@ -144,7 +147,8 @@ def train(train_dl, val_dl):
         t1 = time.time()
         train_time += t1 - t0
         t0 = time.time()
-    print(f'train time = {train_time}')
+    if args.profile_code is True:
+        print(f'train time = {train_time}')
     return float(loss)
 
 
@@ -164,7 +168,8 @@ def test(dl, desc='val'):
         t1 = time.time()
         val_time += t1 - t0
         t0 = time.time()
-    print(f'{desc} time = {val_time}')
+    if args.profile_code is True:
+        print(f'{desc} time = {val_time}')
     return float(rmse)
 
 
diff --git a/examples/homo_link_pred_temporal.py b/examples/homo_link_pred_temporal.py
index a5eadfa46..0ebdbc73d 100644
--- a/examples/homo_link_pred_temporal.py
+++ b/examples/homo_link_pred_temporal.py
@@ -13,6 +13,9 @@ from torch_geometric.nn import to_hetero
 from torch_geometric.nn.conv import SAGEConv
 
 parser = argparse.ArgumentParser()
+parser.add_argument('--profile_code', action='store_true',
+                    help='Display timing information')
+parser.set_defaults(profile_code=False)
 parser.add_argument('--use_weighted_loss', action='store_true',
                     help='Whether to use weighted MSE loss.')
 args = parser.parse_args()
@@ -148,7 +151,8 @@ def train(train_dl, val_dl):
         t1 = time.time()
         train_time += t1 - t0
         t0 = time.time()
-    print(f'train time = {train_time}')
+    if args.profile_code is True:
+        print(f'train time = {train_time}')
     return float(loss)
 
 
@@ -167,7 +171,8 @@ def test(dl, desc='val'):
         t1 = time.time()
         val_time += t1 - t0
         t0 = time.time()
-    print(f'{desc} time = {val_time}')
+    if args.profile_code is True:
+        print(f'{desc} time = {val_time}')
     return float(rmse)
 
 
diff --git a/torch_geometric/nn/conv/__init__.py b/torch_geometric/nn/conv/__init__.py
index a6f20a02d..c51d5a831 100644
--- a/torch_geometric/nn/conv/__init__.py
+++ b/torch_geometric/nn/conv/__init__.py
@@ -3,7 +3,6 @@ from .simple_conv import SimpleConv
 from .gcn_conv import GCNConv
 from .cheb_conv import ChebConv
 from .sage_conv import SAGEConv
-from .sage_conv_temporal import SAGEConv_temporal
 from .cugraph.sage_conv import CuGraphSAGEConv
 from .graph_conv import GraphConv
 from .gravnet_conv import GravNetConv
diff --git a/torch_geometric/sampler/neighbor_sampler.py b/torch_geometric/sampler/neighbor_sampler.py
index 0950cc06a..3db36f926 100644
--- a/torch_geometric/sampler/neighbor_sampler.py
+++ b/torch_geometric/sampler/neighbor_sampler.py
@@ -310,26 +310,7 @@ class NeighborSampler(BaseSampler):
                 colptrs = list(self.colptr_dict.values())
                 dtype = colptrs[0].dtype if len(colptrs) > 0 else torch.int64
                 seed = {k: v.to(dtype) for k, v in seed.items()}
-
-                def check_temporal():
-                    for k, edge_type_ in enumerate(self.colptr_dict.keys()):
-                        # print('edge_type = ',edge_type_)
-                        colptr = self.colptr_dict[edge_type_]
-                        row = self.row_dict[edge_type_]
-                        for i in range(self.num_nodes[self.node_types[k]]):
-                            col_start = colptr[i]
-                            col_end = colptr[i + 1]
-                            # print(f'node = {i}')
-                            # print('col_start = ', col_start)
-                            # print('col_end = ', col_end)
-                            for j in range(col_start, col_end - 1):
-                                # print(self.edge_time[edge_type_][j], ' ', self.edge_time[edge_type_][j+1])
-                                # print(f'col={i}, row={j}')
-                                assert self.edge_time[edge_type_][
-                                    j] <= self.edge_time[edge_type_][j + 1]
-
-                #check_temporal()
-                # start_time = time_measure.time()
+                
                 args = (
                     self.node_types,
                     self.edge_types,
@@ -355,8 +336,6 @@ class NeighborSampler(BaseSampler):
 
                 out = torch.ops.pyg.hetero_neighbor_sample(*args)
                 row, col, node, edge, batch = out[:4] + (None, )
-                # end_time = time_measure.time()
-                # print(f'Elapsed time per batch = {end_time-start_time}s')
                 # `pyg-lib>0.1.0` returns sampled number of nodes/edges:
                 num_sampled_nodes = num_sampled_edges = None
                 if len(out) >= 6: