repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
mtenv
mtenv-main/mtenv/utils/types.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Any, Dict, Tuple, Union import numpy as np TaskObsType = Union[str, int, float, np.ndarray] ActionType = Union[str, int, float, np.ndarray] EnvObsType = Union[np.ndarray] ObsType = Dict[str, Union[EnvObsType, TaskObsType]] Rewar...
530
32.1875
70
py
mtenv
mtenv-main/mtenv/utils/seeding.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Optional, Tuple from gym.utils import seeding from numpy.random import RandomState def np_random(seed: Optional[int]) -> Tuple[RandomState, int]: """Set the seed for numpy's random generator. Args: seed (Option...
521
25.1
74
py
mtenv
mtenv-main/mtenv/utils/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
71
35
70
py
mtenv
mtenv-main/local_dm_control_suite/base.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
4,139
35.637168
84
py
mtenv
mtenv-main/local_dm_control_suite/explore.py
# Copyright 2018 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
3,023
30.5
84
py
mtenv
mtenv-main/local_dm_control_suite/cartpole.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
9,502
36.561265
85
py
mtenv
mtenv-main/local_dm_control_suite/humanoid.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
8,547
34.915966
85
py
mtenv
mtenv-main/local_dm_control_suite/lqr.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
10,082
36.069853
87
py
mtenv
mtenv-main/local_dm_control_suite/fish.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
6,657
34.227513
84
py
mtenv
mtenv-main/local_dm_control_suite/walker.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
6,162
31.267016
83
py
mtenv
mtenv-main/local_dm_control_suite/ball_in_cup.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
3,550
32.819048
80
py
mtenv
mtenv-main/local_dm_control_suite/finger.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
8,498
33.975309
86
py
mtenv
mtenv-main/local_dm_control_suite/point_mass.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
5,007
36.096296
88
py
mtenv
mtenv-main/local_dm_control_suite/quadruped.py
# Copyright 2019 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
19,110
36.108738
87
py
mtenv
mtenv-main/local_dm_control_suite/swimmer.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
8,432
36.314159
88
py
mtenv
mtenv-main/local_dm_control_suite/reacher.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
4,543
36.553719
83
py
mtenv
mtenv-main/local_dm_control_suite/pendulum.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
3,748
31.6
83
py
mtenv
mtenv-main/local_dm_control_suite/lqr_solver.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
4,910
32.408163
94
py
mtenv
mtenv-main/local_dm_control_suite/stacker.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
8,131
35.142222
87
py
mtenv
mtenv-main/local_dm_control_suite/cheetah.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
3,505
32.075472
80
py
mtenv
mtenv-main/local_dm_control_suite/__init__.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
4,853
27.892857
86
py
mtenv
mtenv-main/local_dm_control_suite/manipulator.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
12,051
35.521212
88
py
mtenv
mtenv-main/local_dm_control_suite/acrobot.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
4,670
34.386364
85
py
mtenv
mtenv-main/local_dm_control_suite/humanoid_CMU.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
7,074
35.096939
85
py
mtenv
mtenv-main/local_dm_control_suite/hopper.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
5,194
34.101351
87
py
mtenv
mtenv-main/local_dm_control_suite/common/__init__.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
1,387
32.047619
78
py
mtenv
mtenv-main/local_dm_control_suite/tests/loader_test.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
1,640
30.557692
79
py
mtenv
mtenv-main/local_dm_control_suite/tests/domains_test.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
12,919
39.375
88
py
mtenv
mtenv-main/local_dm_control_suite/tests/lqr_test.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
3,097
34.204545
87
py
mtenv
mtenv-main/local_dm_control_suite/wrappers/action_noise_test.py
# Copyright 2018 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
5,875
39.805556
86
py
mtenv
mtenv-main/local_dm_control_suite/wrappers/pixels.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
4,704
36.943548
85
py
mtenv
mtenv-main/local_dm_control_suite/wrappers/__init__.py
# Copyright 2018 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
742
42.705882
78
py
mtenv
mtenv-main/local_dm_control_suite/wrappers/action_noise.py
# Copyright 2018 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
2,891
36.076923
84
py
mtenv
mtenv-main/local_dm_control_suite/wrappers/pixels_test.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
4,549
32.455882
84
py
mtenv
mtenv-main/local_dm_control_suite/utils/parse_amc.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
8,977
28.728477
83
py
mtenv
mtenv-main/local_dm_control_suite/utils/parse_amc_test.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
2,358
33.188406
79
py
mtenv
mtenv-main/local_dm_control_suite/utils/randomizers.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
3,330
35.604396
82
py
mtenv
mtenv-main/local_dm_control_suite/utils/__init__.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
718
41.294118
78
py
mtenv
mtenv-main/local_dm_control_suite/utils/randomizers_test.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
6,331
34.573034
83
py
mtenv
mtenv-main/local_dm_control_suite/demos/mocap_demo.py
# Copyright 2017 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
2,633
28.266667
86
py
mtenv
mtenv-main/docs_src/source/conf.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup ...
2,375
33.434783
88
py
libzmq
libzmq-master/perf/generate_graphs.py
#!/usr/bin/python3 # # This script assumes that the set of CSV files produced by "generate_csv.sh" is provided as input # and that locally there is the "results" folder. # # results for TCP: INPUT_FILE_PUSHPULL_TCP_THROUGHPUT="results/pushpull_tcp_thr_results.csv" INPUT_FILE_REQREP_TCP_LATENCY="results/reqrep_tcp_lat...
2,542
33.364865
117
py
cwn
cwn-main/conftest.py
import pytest def pytest_addoption(parser): parser.addoption( "--runslow", action="store_true", default=False, help="run slow tests", ) parser.addoption( "--rundata", action="store_true", default=False, help="run tests using datasets", ) def pytest_configure(config): config.addin...
956
29.870968
89
py
cwn
cwn-main/definitions.py
import os ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
63
31
53
py
cwn
cwn-main/mp/cell_mp.py
""" Based on https://github.com/rusty1s/pytorch_geometric/blob/master/torch_geometric/nn/conv/message_passing.py MIT License Copyright (c) 2020 Matthias Fey <[email protected]> Copyright (c) 2021 The CWN Project Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this so...
26,998
48
110
py
cwn
cwn-main/mp/test_layers.py
import torch import torch.optim as optim from mp.layers import ( DummyCellularMessagePassing, CINConv, OrientedConv, InitReduceConv, EmbedVEWithReduce) from data.dummy_complexes import get_house_complex, get_molecular_complex from torch import nn from data.datasets.flow import load_flow_dataset def test_dummy_ce...
6,243
34.276836
96
py
cwn
cwn-main/mp/cell_mp_inspector.py
""" Based on https://github.com/rusty1s/pytorch_geometric/blob/76d61eaa9fc8702aa25f29dfaa5134a169d0f1f6/torch_geometric/nn/conv/utils/inspector.py MIT License Copyright (c) 2020 Matthias Fey <[email protected]> Copyright (c) 2021 The CWN Project Authors Permission is hereby granted, free of charge, to any ...
2,143
41.88
142
py
cwn
cwn-main/mp/ring_exp_models.py
import torch from mp.layers import SparseCINConv from mp.nn import get_nonlinearity, get_graph_norm from data.complex import ComplexBatch from torch.nn import Linear, Sequential from torch_geometric.nn import GINConv class RingSparseCIN(torch.nn.Module): """ A simple cellular version of GIN employed for Ring...
4,771
35.151515
102
py
cwn
cwn-main/mp/test_permutation.py
import torch from data.utils import compute_ring_2complex from data.perm_utils import permute_graph, generate_permutation_matrices from data.dummy_complexes import get_mol_testing_complex_list, convert_to_graph from data.complex import ComplexBatch from mp.models import SparseCIN def test_sparse_cin0_perm_invariance_...
1,983
52.621622
127
py
cwn
cwn-main/mp/molec_models.py
import torch import torch.nn.functional as F from torch.nn import Linear, Embedding, Sequential, BatchNorm1d as BN from torch_geometric.nn import JumpingKnowledge, GINEConv from mp.layers import InitReduceConv, EmbedVEWithReduce, OGBEmbedVEWithReduce, SparseCINConv, CINppConv from ogb.graphproppred.mol_encoder import ...
26,185
42.140033
106
py
cwn
cwn-main/mp/test_models.py
import torch import pytest import itertools from data.complex import ComplexBatch from data.dummy_complexes import get_testing_complex_list from mp.models import CIN0, EdgeCIN0, SparseCIN from data.data_loading import DataLoader, load_dataset def test_cin_model_with_batching(): """Check this runs without errors ...
9,019
37.712446
99
py
cwn
cwn-main/mp/layers.py
import torch from typing import Any, Callable, Optional from torch import Tensor from mp.cell_mp import CochainMessagePassing, CochainMessagePassingParams from torch_geometric.nn.inits import reset from torch.nn import Linear, Sequential, BatchNorm1d as BN, Identity from data.complex import Cochain from torch_scatter ...
26,386
43.422559
130
py
cwn
cwn-main/mp/nn.py
import torch import torch.nn.functional as F from torch_geometric.nn import global_mean_pool, global_add_pool from torch.nn import BatchNorm1d as BN, LayerNorm as LN, Identity def get_nonlinearity(nonlinearity, return_module=True): if nonlinearity == 'relu': module = torch.nn.ReLU function = F.rel...
2,030
32.295082
101
py
cwn
cwn-main/mp/models.py
import torch import torch.nn.functional as F from torch.nn import Linear, Sequential, BatchNorm1d as BN from torch_geometric.nn import JumpingKnowledge from mp.layers import ( CINConv, EdgeCINConv, SparseCINConv, CINppConv,DummyCellularMessagePassing, OrientedConv) from mp.nn import get_nonlinearity, get_pooling_f...
27,151
40.015106
102
py
cwn
cwn-main/mp/__init__.py
0
0
0
py
cwn
cwn-main/mp/test_orientation.py
import torch import numpy as np from data.datasets.flow import load_flow_dataset from mp.models import EdgeOrient, EdgeMPNN from mp.layers import OrientedConv from data.complex import CochainBatch from data.data_loading import DataLoader from data.datasets.flow_utils import build_cochain def generate_oriented_flow_p...
5,926
39.047297
107
py
cwn
cwn-main/mp/graph_models.py
""" Code based on https://github.com/rusty1s/pytorch_geometric/blob/master/benchmark/kernel/gin.py Copyright (c) 2020 Matthias Fey <[email protected]> Copyright (c) 2021 The CWN Project Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated docum...
10,168
37.086142
96
py
cwn
cwn-main/mp/test_molec_models.py
import torch import itertools import pytest from data.complex import ComplexBatch from data.dummy_complexes import get_testing_complex_list from mp.molec_models import EmbedSparseCIN, OGBEmbedSparseCIN, EmbedSparseCINNoRings, EmbedGIN from data.data_loading import DataLoader, load_dataset def test_zinc_sparse_cin0_m...
11,149
38.122807
102
py
cwn
cwn-main/mp/test_cell_mp.py
import pytest import torch from data.helper_test import check_edge_index_are_the_same, check_edge_attr_are_the_same from mp.cell_mp import CochainMessagePassing from torch_geometric.nn.conv import MessagePassing from data.dummy_complexes import (get_square_dot_complex, get_house_complex, ...
13,576
49.285185
180
py
cwn
cwn-main/data/test_dataset.py
import pytest import os from data.data_loading import load_graph_dataset from data.datasets import TUDataset, DummyMolecularDataset, DummyDataset from data.utils import compute_clique_complex_with_gudhi, compute_ring_2complex from data.helper_test import compare_complexes, compare_complexes_without_2feats from definit...
3,813
46.08642
109
py
cwn
cwn-main/data/perm_utils.py
import torch import numpy as np from scipy import sparse as sp from torch_geometric.data import Data def permute_graph(graph: Data, P: np.ndarray) -> Data: # TODO: support edge features and their permutation assert graph.edge_attr is None # Check validity of permutation matrix n = graph.x.size(0) ...
2,177
29.25
110
py
cwn
cwn-main/data/test_data.py
import torch from data.dummy_complexes import get_house_complex def test_up_and_down_feature_extraction_on_house_complex(): house_complex = get_house_complex() v_cochain_params = house_complex.get_cochain_params(dim=0) v_up_attr = v_cochain_params.kwargs['up_attr'] expected_v_up_attr = torch.tensor(...
2,318
41.163636
100
py
cwn
cwn-main/data/helper_test.py
import itertools import torch import networkx as nx from torch_geometric.utils import convert from torch_geometric.data import Data def check_edge_index_are_the_same(upper_index, edge_index): """Checks that two edge/cell indexes are the same.""" # These two tensors should have the same content but in differe...
8,463
41.532663
98
py
cwn
cwn-main/data/data_loading.py
""" Code is adapted from https://github.com/rusty1s/pytorch_geometric/blob/6442a6e287563b39dae9f5fcffc52cd780925f89/torch_geometric/data/dataloader.py Copyright (c) 2020 Matthias Fey <[email protected]> Copyright (c) 2021 The CWN Project Authors Permission is hereby granted, free of charge, to any person ob...
14,860
56.378378
146
py
cwn
cwn-main/data/tu_utils.py
""" Based on code from https://github.com/weihua916/powerful-gnns/blob/master/util.py MIT License Copyright (c) 2021 Weihua Hu Copyright (c) 2021 The CWN Project Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), ...
8,611
34.883333
119
py
cwn
cwn-main/data/utils.py
import graph_tool as gt import graph_tool.topology as top import numpy as np import torch import gudhi as gd import itertools import networkx as nx from tqdm import tqdm from data.complex import Cochain, Complex from typing import List, Dict, Optional, Union from torch import Tensor from torch_geometric.typing import ...
23,431
41.915751
120
py
cwn
cwn-main/data/complex.py
""" Copyright (c) 2020 Matthias Fey <[email protected]> Copyright (c) 2021 The CWN Project Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without ...
30,723
41.145405
110
py
cwn
cwn-main/data/test_parallel.py
import pytest from data.dummy_complexes import get_mol_testing_complex_list, convert_to_graph from data.utils import convert_graph_dataset_with_rings from data.test_dataset import compare_complexes @pytest.mark.slow def test_parallel_conversion_returns_same_order(): complexes = get_mol_testing_complex_list(...
686
35.157895
93
py
cwn
cwn-main/data/test_tu_utils.py
import pytest import os import numpy as np import torch import random from data.tu_utils import get_fold_indices, load_data, S2V_to_PyG from torch_geometric.utils import degree from definitions import ROOT_DIR @pytest.fixture def imdbbinary_graphs(): data, num_classes = load_data(os.path.join(ROOT_DIR, 'datasets'...
3,720
32.827273
111
py
cwn
cwn-main/data/test_batching.py
import torch import pytest import itertools from data.dummy_complexes import (get_house_complex, get_square_complex, get_pyramid_complex, get_square_dot_complex, get_kite_complex) from data.complex import ComplexBatch from data.dummy_complexes import get_testing_complex_list from data.data_loading import DataLoad...
46,797
43.065913
201
py
cwn
cwn-main/data/sr_utils.py
import networkx as nx import torch from torch_geometric.utils import to_undirected def load_sr_dataset(path): """Load the Strongly Regular Graph Dataset from the supplied path.""" nx_graphs = nx.read_graph6(path) graphs = list() for nx_graph in nx_graphs: n = nx_graph.number_of_nodes() ...
485
29.375
105
py
cwn
cwn-main/data/__init__.py
0
0
0
py
cwn
cwn-main/data/dummy_complexes.py
import torch from data.complex import Cochain, Complex from torch_geometric.data import Data # TODO: make the features for these dummy complexes disjoint to stress tests even more def convert_to_graph(complex): """Extracts the underlying graph of a cochain complex.""" assert 0 in complex.cochains assert ...
23,206
39.220104
168
py
cwn
cwn-main/data/parallel.py
from tqdm.auto import tqdm from joblib import Parallel class ProgressParallel(Parallel): """A helper class for adding tqdm progressbar to the joblib library.""" def __init__(self, use_tqdm=True, total=None, *args, **kwargs): self._use_tqdm = use_tqdm self._total = total super().__init_...
714
33.047619
79
py
cwn
cwn-main/data/test_utils.py
import torch from torch_geometric.data import Data from data.utils import compute_clique_complex_with_gudhi, compute_ring_2complex from data.utils import convert_graph_dataset_with_gudhi, convert_graph_dataset_with_rings from data.complex import ComplexBatch from data.dummy_complexes import convert_to_graph, get_testi...
31,625
48.883281
148
py
cwn
cwn-main/data/datasets/test_flow.py
import numpy as np import torch from scipy.spatial import Delaunay from data.datasets.flow_utils import load_flow_dataset, create_hole, is_inside_rectangle def test_create_hole(): # This seed contains some edge cases. np.random.seed(4) points = np.random.uniform(size=(400, 2)) tri = Delaunay(points) ...
2,416
36.184615
94
py
cwn
cwn-main/data/datasets/peptides_structural.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 2 21:37:42 2023 @author: renz """ import hashlib import os.path as osp import os import pickle import shutil import pandas as pd import torch from ogb.utils import smiles2graph from ogb.utils.torch_util import replace_numpy_with_torchtensor from ...
11,359
41.546816
134
py
cwn
cwn-main/data/datasets/peptides_functional.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 2 21:37:42 2023 @author: renz """ import hashlib import os.path as osp import os import pickle import shutil import pandas as pd import torch from ogb.utils import smiles2graph from ogb.utils.torch_util import replace_numpy_with_torchtensor from ...
10,424
39.564202
124
py
cwn
cwn-main/data/datasets/ocean.py
import pickle import os.path as osp from data.datasets import InMemoryComplexDataset from data.datasets.ocean_utils import load_ocean_dataset # TODO: Set up a cochain dataset structure or make complex dataset better support cochain-only data. # TODO: Refactor the dataset to use the latest storage formatting. class O...
2,602
34.175676
100
py
cwn
cwn-main/data/datasets/plot_ringtree_dataset.py
import networkx as nx import matplotlib.pyplot as plt from data.datasets.ring_utils import generate_ring_transfer_graph_dataset from torch_geometric.utils import convert def visualise_ringtree_dataset(): dataset = generate_ring_transfer_graph_dataset(nodes=10, samples=100, classes=5) data = dataset[0] g...
495
23.8
84
py
cwn
cwn-main/data/datasets/test_ringtransfer.py
import os.path as osp from data.datasets.ring_utils import generate_ring_transfer_graph_dataset from data.utils import convert_graph_dataset_with_rings from data.datasets import RingTransferDataset from definitions import ROOT_DIR def test_ringtree_dataset_generation(): dataset = generate_ring_transfer_graph_dat...
1,900
35.557692
95
py
cwn
cwn-main/data/datasets/cluster.py
import pickle from data.datasets import InMemoryComplexDataset from data.utils import convert_graph_dataset_with_gudhi from torch_geometric.datasets import GNNBenchmarkDataset class ClusterDataset(InMemoryComplexDataset): """This is the Cluster dataset from the Benchmarking GNNs paper. The dataset contains ...
3,283
41.102564
140
py
cwn
cwn-main/data/datasets/csl.py
import os.path as osp import numpy as np import torch from data.datasets import InMemoryComplexDataset from data.utils import convert_graph_dataset_with_rings from torch_geometric.datasets import GNNBenchmarkDataset from torch_geometric.utils import remove_self_loops class CSLDataset(InMemoryComplexDataset): """...
4,912
39.270492
127
py
cwn
cwn-main/data/datasets/flow.py
import pickle import os.path as osp from data.datasets import InMemoryComplexDataset from data.datasets.flow_utils import load_flow_dataset # TODO: Set up a cochain dataset structure or make complex dataset better support cochain-only data. # TODO: Make this dataset use the new storage system. class FlowDataset(InMe...
2,666
34.56
100
py
cwn
cwn-main/data/datasets/flow_utils.py
import numpy as np import random import torch import networkx as nx import itertools from scipy.spatial import Delaunay from scipy import sparse from data.complex import Cochain from data.parallel import ProgressParallel from joblib import delayed def is_inside_rectangle(x, rect): return rect[0, 0] <= x[0] <= re...
10,807
30.976331
89
py
cwn
cwn-main/data/datasets/sr.py
import os import torch import pickle from data.sr_utils import load_sr_dataset from data.utils import compute_clique_complex_with_gudhi, compute_ring_2complex from data.utils import convert_graph_dataset_with_rings, convert_graph_dataset_with_gudhi from data.datasets import InMemoryComplexDataset from definitions impo...
4,522
39.747748
107
py
cwn
cwn-main/data/datasets/ring_utils.py
import numpy as np import torch import random from torch_geometric.data import Data from sklearn.preprocessing import LabelBinarizer # TODO: Add a graph dataset for ring lookup. def generate_ring_lookup_graph(nodes): """This generates a dictionary lookup ring. No longer being used for now.""" # Assign all th...
3,276
30.509615
82
py
cwn
cwn-main/data/datasets/zinc.py
import torch import os.path as osp from data.utils import convert_graph_dataset_with_rings from data.datasets import InMemoryComplexDataset from torch_geometric.datasets import ZINC class ZincDataset(InMemoryComplexDataset): """This is ZINC from the Benchmarking GNNs paper. This is a graph regression task.""" ...
5,282
36.468085
91
py
cwn
cwn-main/data/datasets/dataset.py
""" The code is based on https://github.com/rusty1s/pytorch_geometric/blob/76d61eaa9fc8702aa25f29dfaa5134a169d0f1f6/torch_geometric/data/dataset.py#L19 and https://github.com/rusty1s/pytorch_geometric/blob/master/torch_geometric/data/in_memory_dataset.py Copyright (c) 2020 Matthias Fey <[email protected]> Co...
14,872
38.873995
147
py
cwn
cwn-main/data/datasets/test_zinc.py
import torch import os.path as osp import pytest from data.data_loading import load_dataset from data.helper_test import (check_edge_index_are_the_same, check_edge_attr_are_the_same, get_rings, get_complex_rings) from torch_geometric.datasets import ZINC ...
2,395
38.933333
107
py
cwn
cwn-main/data/datasets/ocean_utils.py
""" Based on - https://github.com/nglaze00/SCoNe_GCN/blob/master/ocean_drifters_data/buoy_data.py - https://github.com/nglaze00/SCoNe_GCN/blob/master/trajectory_analysis/synthetic_data_gen.py MIT License Copyright (c) 2021 Nicholas Glaze Copyright (c) 2021 The CWN Project Authors Permission is hereby granted, free o...
9,466
34.193309
135
py
cwn
cwn-main/data/datasets/tu.py
import os import torch import pickle import numpy as np from definitions import ROOT_DIR from data.tu_utils import load_data, S2V_to_PyG, get_fold_indices from data.utils import convert_graph_dataset_with_gudhi, convert_graph_dataset_with_rings from data.datasets import InMemoryComplexDataset def load_tu_graph_datas...
6,539
49.307692
110
py
cwn
cwn-main/data/datasets/plot_flow_dataset.py
import seaborn as sns import matplotlib.pyplot as plt import os from data.datasets import FlowDataset from definitions import ROOT_DIR sns.set_style('white') sns.color_palette("tab10") def plot_arrow(p1, p2, color='red'): plt.arrow(p1[0], p1[1], p2[0] - p1[0], p2[1] - p1[1], color=color, shape='full', l...
2,723
33.05
94
py
cwn
cwn-main/data/datasets/ogb.py
import torch import os.path as osp from data.utils import convert_graph_dataset_with_rings from data.datasets import InMemoryComplexDataset from ogb.graphproppred import PygGraphPropPredDataset class OGBDataset(InMemoryComplexDataset): """This is OGB graph-property prediction. This are graph-wise classification ...
4,176
42.061856
97
py
cwn
cwn-main/data/datasets/ringlookup.py
import torch import os.path as osp from data.datasets import InMemoryComplexDataset from data.datasets.ring_utils import generate_ringlookup_graph_dataset from data.utils import convert_graph_dataset_with_rings class RingLookupDataset(InMemoryComplexDataset): """A dataset where the task is to perform dictionary ...
3,214
32.842105
98
py
cwn
cwn-main/data/datasets/test_ocean.py
import torch import pytest from data.datasets.ocean_utils import load_ocean_dataset @pytest.mark.data def test_ocean_dataset_generation(): train, test, _ = load_ocean_dataset() assert len(train) == 160 assert len(test) == 40 for cochain in train + test: # checks the upper/lower orientation fe...
1,247
43.571429
94
py
cwn
cwn-main/data/datasets/ringtransfer.py
import torch import os.path as osp from data.datasets import InMemoryComplexDataset from data.datasets.ring_utils import generate_ring_transfer_graph_dataset from data.utils import convert_graph_dataset_with_rings class RingTransferDataset(InMemoryComplexDataset): """A dataset where the task is to transfer featu...
3,322
32.908163
92
py
cwn
cwn-main/data/datasets/__init__.py
from data.datasets.dataset import ComplexDataset, InMemoryComplexDataset from data.datasets.sr import SRDataset, load_sr_graph_dataset from data.datasets.cluster import ClusterDataset from data.datasets.tu import TUDataset, load_tu_graph_dataset from data.datasets.flow import FlowDataset from data.datasets.ocean import...
941
57.875
97
py
cwn
cwn-main/data/datasets/dummy.py
import torch from data.datasets import InMemoryComplexDataset from data.dummy_complexes import get_testing_complex_list, get_mol_testing_complex_list class DummyDataset(InMemoryComplexDataset): """A dummy dataset using a list of hand-crafted cell complexes with many edge cases.""" def __init__(self, root): ...
3,221
34.021739
101
py
cwn
cwn-main/exp/parser.py
import os import time import argparse from definitions import ROOT_DIR def get_parser(): parser = argparse.ArgumentParser(description='CWN experiment.') parser.add_argument('--seed', type=int, default=43, help='random seed to set (default: 43, i.e. the non-meaning of life))') pars...
11,349
59.695187
126
py