repo stringlengths 1 99 | file stringlengths 13 215 | code stringlengths 12 59.2M | file_length int64 12 59.2M | avg_line_length float64 3.82 1.48M | max_line_length int64 12 2.51M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-dgl-uvagpu-reddit.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from load_graph import load_reddit, load_ogb, inductive_split, load_ppi, load_flickr, load_yelp
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(n... | 5,185 | 36.854015 | 136 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/main_pyg_ppi_sage.py | import os
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_sparse import SparseTensor
from torch_geometric.nn import SAGEConv
from sklearn.metrics import f1_score
# from torch_geometric.datasets import Reddit, Reddit2, Flickr, Yelp
from create_pyg import PPI
from codecarbon ... | 4,593 | 32.779412 | 142 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/main_dgl_yelp_sage_nn.py | import os
import argparse
import dgl
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgl.nn.pytorch import SAGEConv
from sklearn.metrics import f1_score
from load_graph import load_yelp
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(nn.Module):
... | 5,172 | 32.374194 | 142 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-dgl-cpugpu-ppi.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from load_graph import load_reddit, load_ogb, inductive_split, load_ppi, load_flickr, load_yelp
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(n... | 5,251 | 36.514286 | 136 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/main_pyg_product_sage.py | import os
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_sparse import SparseTensor
from torch_geometric.nn import SAGEConv
from sklearn.metrics import f1_score
from torch_geometric.utils import to_undirected
from ogb.nodeproppred import PygNodePropPredDataset, Evaluator
f... | 4,566 | 32.335766 | 142 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-dgl-uvagpu-arxiv.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from load_graph import load_reddit, load_ogb, inductive_split, load_ppi, load_flickr, load_yelp
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(n... | 5,133 | 36.75 | 136 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-pyg-cpu-arxiv.py | import os
import torch
import torch.nn.functional as F
# from torch_geometric.datasets import Reddit, Flickr, Yelp
from torch_geometric.loader import NeighborSampler
from torch_geometric.nn import SAGEConv
from sklearn.metrics import f1_score
from torch_geometric.utils import to_undirected
from ogb.nodeproppred import ... | 4,237 | 31.852713 | 132 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/main_pyg_flickr_sage.py | import os
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_sparse import SparseTensor
from torch_geometric.nn import SAGEConv
from sklearn.metrics import f1_score
from torch_geometric.datasets import Reddit, Reddit2, Flickr, Yelp
from codecarbon import EmissionsTracker
from ... | 4,533 | 32.835821 | 142 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-pyg-cpu-ppi.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.loader import NeighborSampler
from torch_geometric.nn import SAGEConv
from sklearn.metrics import f1_score
from create_pyg import PPI
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class G... | 3,756 | 30.571429 | 132 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-dgl-cpu-ppi.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from load_graph import load_reddit, load_ogb, inductive_split, load_ppi, load_flickr, load_yelp
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(n... | 5,308 | 35.613793 | 136 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-dgl-cpugpu-yelp.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from load_graph import load_reddit, load_ogb, inductive_split, load_ppi, load_flickr, load_yelp
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(n... | 5,254 | 36.535714 | 136 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-pyg-cpu-flickr.py | import os
import torch
import torch.nn.functional as F
from torch_geometric.datasets import Reddit, Flickr, Yelp
from torch_geometric.loader import NeighborSampler
from torch_geometric.nn import SAGEConv
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger... | 3,758 | 31.128205 | 132 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-dgl-cpu-products.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from load_graph import load_reddit, load_ogb, inductive_split, load_ppi, load_flickr, load_yelp
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(n... | 5,260 | 35.79021 | 136 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-dgl-cpu-reddit.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from load_graph import load_reddit, load_ogb, inductive_split, load_ppi, load_flickr, load_yelp
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(n... | 5,225 | 36.328571 | 136 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-pyg-cpugpu-flickr.py | import os
import torch
import torch.nn.functional as F
from torch_geometric.datasets import Reddit, Flickr, Yelp
from torch_geometric.loader import NeighborSampler
from torch_geometric.nn import SAGEConv
from sklearn.metrics import f1_score
# from ogb.nodeproppred import PygNodePropPredDataset, Evaluator
# from create_... | 3,862 | 31.462185 | 132 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-dgl-gpu-ppi.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from load_graph import load_reddit, load_ogb, inductive_split, load_ppi, load_flickr, load_yelp
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(n... | 5,232 | 35.852113 | 136 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/main_dgl_reddit_sage_nn.py | import os
import argparse
import dgl
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgl.nn.pytorch import SAGEConv
from load_graph import load_reddit
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(nn.Module)... | 5,409 | 33.458599 | 142 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-pyg-cpu-reddit.py | import os
import torch
import torch.nn.functional as F
from torch_geometric.datasets import Reddit, Flickr, Yelp
from torch_geometric.loader import NeighborSampler
from torch_geometric.nn import SAGEConv
from codecarbon import EmissionsTracker
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker... | 3,666 | 30.886957 | 132 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/create_pyg.py | import json
import os
import os.path as osp
from typing import Callable, List, Optional
import numpy as np
import scipy.sparse as sp
import torch
from torch_geometric.data import Data, InMemoryDataset, download_url
class PPI(InMemoryDataset):
def __init__(self, root: str, transform: Optional[Callable] = None,
... | 2,745 | 35.131579 | 79 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-pyg-cpu-yelp.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.datasets import Reddit, Flickr, Yelp
from torch_geometric.loader import NeighborSampler
from torch_geometric.nn import SAGEConv
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logge... | 3,803 | 29.926829 | 132 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-dgl-cpugpu-flickr.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from load_graph import load_reddit, load_ogb, inductive_split, load_ppi, load_flickr, load_yelp
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(n... | 5,170 | 36.744526 | 136 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-dgl-uvagpu-yelp.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from load_graph import load_reddit, load_ogb, inductive_split, load_ppi, load_flickr, load_yelp
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(n... | 5,216 | 36.532374 | 136 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/ns-sage-dgl-gpu-products.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from load_graph import load_reddit, load_ogb, inductive_split, load_ppi, load_flickr, load_yelp
from sklearn.metrics import f1_score
from codecarbon import EmissionsTracker
from energy_logger import energy_logger
class GraphSAGE(n... | 5,183 | 36.294964 | 136 | py |
GNN-Benchmark | GNN-Benchmark-main/code/GraphSAGE/load_graph.py | import dgl
import torch as th
def load_reddit():
from dgl.data import RedditDataset
# load reddit data
data = RedditDataset()
g = data[0]
# g.ndata['features'] = g.ndata['feat']
# g.ndata['labels'] = g.ndata['label']
return g, data.num_classes
def load_ppi():
from create_dgl import P... | 3,083 | 29.235294 | 101 | py |
SGM | SGM-master/lr_scheduler.py | import math
from bisect import bisect_right
from torch.optim.optimizer import Optimizer
class _LRScheduler(object):
def __init__(self, optimizer, last_epoch=-1):
if not isinstance(optimizer, Optimizer):
raise TypeError('{} is not an Optimizer'.format(
type(optimizer).__name__))... | 13,934 | 41.355623 | 94 | py |
SGM | SGM-master/predict.py | import torch
import torch.utils.data
import os
import argparse
import pickle
import codecs
import json
import random
import numpy as np
import opts
import models
import utils
parser = argparse.ArgumentParser(description='predict.py')
opts.model_opts(parser)
parser.add_argument('-data', type=st... | 4,095 | 28.89781 | 111 | py |
SGM | SGM-master/train.py | import torch
import torch.utils.data
import lr_scheduler as L
import os
import argparse
import pickle
import time
import random
import numpy as np
from collections import OrderedDict
import opts
import models
import utils
import codecs
import json
parser = argparse.ArgumentParser(description='train.py')
opts.model_... | 10,956 | 33.784127 | 115 | py |
SGM | SGM-master/models/optims.py | import torch.optim as optim
from torch.nn.utils import clip_grad_norm_
class Optim(object):
def set_parameters(self, params):
self.params = list(params) # careful: params may be a generator
if self.method == 'sgd':
self.optimizer = optim.SGD(self.params, lr=self.lr)
elif self... | 1,773 | 35.958333 | 102 | py |
SGM | SGM-master/models/seq2seq.py | import torch
import torch.nn as nn
import utils
import models
class seq2seq(nn.Module):
def __init__(self, config, use_attention=True, encoder=None, decoder=None):
super(seq2seq, self).__init__()
if encoder is not None:
self.encoder = encoder
else:
self.encoder = ... | 6,452 | 32.092308 | 107 | py |
SGM | SGM-master/models/beam.py | import torch
import utils
class Beam(object):
def __init__(self, size, n_best=1, cuda=True, length_norm=False, minimum_length=0):
self.size = size
self.tt = torch.cuda if cuda else torch
# The score for each translation on the beam.
self.scores = self.tt.FloatTensor(size).zer... | 5,626 | 33.950311 | 87 | py |
SGM | SGM-master/models/rnn.py | import torch
import torch.nn as nn
import torch.nn.init as init
from torch.nn.utils.rnn import pack_padded_sequence as pack
from torch.nn.utils.rnn import pad_packed_sequence as unpack
import models
class rnn_encoder(nn.Module):
def __init__(self, config, embedding=None):
super(rnn_encoder, self).__init_... | 6,219 | 37.159509 | 117 | py |
SGM | SGM-master/models/attention.py | import torch
import torch.nn as nn
import torch.nn.init as init
class luong_attention(nn.Module):
def __init__(self, hidden_size, emb_size, pool_size=0):
super(luong_attention, self).__init__()
self.hidden_size, self.emb_size, self.pool_size = hidden_size, emb_size, pool_size
self.linear_... | 4,034 | 39.757576 | 109 | py |
SGM | SGM-master/utils/dict_helper.py | import torch
from collections import OrderedDict
PAD = 0
UNK = 1
BOS = 2
EOS = 3
PAD_WORD = '<blank>'
UNK_WORD = '<unk> '
BOS_WORD = '<s>'
EOS_WORD = '</s>'
class Dict(object):
def __init__(self, data=None, lower=True):
self.idxToLabel = {}
self.labelToIdx = {}
self.frequencies = {}
... | 5,421 | 27.093264 | 91 | py |
SGM | SGM-master/utils/data_helper.py | import linecache
import torch
import torch.utils.data as torch_data
from random import Random
import utils
num_samples = 1
class MonoDataset(torch_data.Dataset):
def __init__(self, infos, indexes=None):
self.srcF = infos['srcF']
self.original_srcF = infos['original_srcF']
self.length = ... | 5,148 | 32.00641 | 109 | py |
epigraf | epigraf-main/src/legacy.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 16,607 | 50.101538 | 154 | py |
epigraf | epigraf-main/src/train.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 15,526 | 49.576547 | 222 | py |
epigraf | epigraf-main/src/training/networks_epigraf.py | import math
from typing import Callable, Dict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from src.torch_utils import misc
from src.torch_utils import persistence
from omegaconf import DictConfig
from src.training.networks_stylegan2 import SynthesisBlock
from src.training.net... | 26,228 | 54.687898 | 200 | py |
epigraf | epigraf-main/src/training/inference_utils.py | import os
from typing import List, Optional
import torch
import torchvision as tv
from omegaconf import DictConfig
import PIL.Image
from tqdm import tqdm
import numpy as np
from src import dnnlib
from src.training.rendering import sample_camera_angles
#----------------------------------------------------------------... | 7,584 | 52.415493 | 153 | py |
epigraf | epigraf-main/src/training/loss.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 10,576 | 61.217647 | 187 | py |
epigraf | epigraf-main/src/training/augment.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 27,024 | 59.867117 | 366 | py |
epigraf | epigraf-main/src/training/dataset.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 11,302 | 36.551495 | 158 | py |
epigraf | epigraf-main/src/training/layers.py | from typing import Tuple
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from src.torch_utils import misc
from src.torch_utils import persistence
from src.torch_utils.ops import conv2d_resample
from src.torch_utils.ops import upfirdn2d
from src.torch_utils.ops import bias_act
#---... | 17,866 | 49.903134 | 170 | py |
epigraf | epigraf-main/src/training/networks_inr_gan.py | """
A better (INR-GAN-based) NeRF architecture
Based on "Adversarial Generation of Continuous Images"
"""
from typing import Dict
import numpy as np
import torch
import torch.nn as nn
from omegaconf import DictConfig
from src import dnnlib
from src.torch_utils import misc
from src.torch_utils import persistence
from s... | 22,953 | 48.9 | 190 | py |
epigraf | epigraf-main/src/training/training_utils.py | from typing import Tuple, Dict, Callable, Any, List
import torch
import torch.nn.functional as F
import numpy as np
#----------------------------------------------------------------------------
def linear_schedule(step: int, val_start: float, val_end: float, period: int) -> float:
"""
Returns the current valu... | 9,710 | 46.140777 | 187 | py |
epigraf | epigraf-main/src/training/networks_discriminator.py | from typing import Dict, List
import numpy as np
import torch
from omegaconf import DictConfig
from src.torch_utils import misc
from src.torch_utils import persistence
from src.torch_utils.ops import upfirdn2d
from src.training.layers import (
FullyConnectedLayer,
MappingNetwork,
Conv2dLayer,
ScalarEnc... | 14,855 | 49.703072 | 183 | py |
epigraf | epigraf-main/src/training/training_loop.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 31,460 | 54.880995 | 186 | py |
epigraf | epigraf-main/src/training/rendering.py | """
Volumetric rendering utils from pi-GAN generator
Adapted from https://github.com/marcoamonteiro/pi-GAN
"""
import math
import random
from typing import Tuple, Dict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from omegaconf import DictConfig
from src.torch_utils import mi... | 22,929 | 49.175055 | 205 | py |
epigraf | epigraf-main/src/training/networks_stylegan2.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 19,821 | 50.754569 | 159 | py |
epigraf | epigraf-main/src/training/networks_stylegan3.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 21,755 | 50.554502 | 141 | py |
epigraf | epigraf-main/src/torch_utils/custom_ops.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 6,666 | 41.196203 | 146 | py |
epigraf | epigraf-main/src/torch_utils/training_stats.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 10,743 | 38.94052 | 118 | py |
epigraf | epigraf-main/src/torch_utils/persistence.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 9,765 | 37.753968 | 144 | py |
epigraf | epigraf-main/src/torch_utils/misc.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 12,011 | 41.9 | 133 | py |
epigraf | epigraf-main/src/torch_utils/ops/bias_act.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 9,848 | 45.9 | 185 | py |
epigraf | epigraf-main/src/torch_utils/ops/grid_sample_gradfix.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 3,398 | 39.951807 | 132 | py |
epigraf | epigraf-main/src/torch_utils/ops/conv2d_gradfix.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 7,756 | 43.83815 | 261 | py |
epigraf | epigraf-main/src/torch_utils/ops/upfirdn2d.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 16,392 | 41.033333 | 120 | py |
epigraf | epigraf-main/src/torch_utils/ops/filtered_lrelu.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 12,884 | 45.854545 | 164 | py |
epigraf | epigraf-main/src/torch_utils/ops/conv2d_resample.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 6,765 | 45.986111 | 130 | py |
epigraf | epigraf-main/src/torch_utils/ops/fma.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 2,047 | 32.57377 | 105 | py |
epigraf | epigraf-main/src/infra/launch.py | """
Run a __reproducible__ experiment on __allocated__ resources
It submits a slurm job(s) with the given hyperparams which will then execute `slurm_job.py`
This is the main entry-point
"""
import os
import subprocess
import re
import hydra
from omegaconf import DictConfig, OmegaConf
from pathlib import Path
from sr... | 5,382 | 41.385827 | 205 | py |
epigraf | epigraf-main/src/metrics/metric_utils.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 13,023 | 42.413333 | 167 | py |
epigraf | epigraf-main/src/metrics/perceptual_path_length.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 5,266 | 40.801587 | 131 | py |
epigraf | epigraf-main/src/metrics/metric_main.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 5,602 | 36.353333 | 147 | py |
epigraf | epigraf-main/src/metrics/precision_recall.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 3,654 | 57.015873 | 159 | py |
epigraf | epigraf-main/scripts/inference.py | """
Generates a multi-view video of a sample from pi-GAN
Adapted from Adapted from https://github.com/marcoamonteiro/pi-GAN
"""
import sys; sys.path.extend(['.'])
import os
import re
from typing import List, Union, Optional
import hydra
import torch
import numpy as np
from omegaconf import DictConfig
import torchvisi... | 18,854 | 63.132653 | 163 | py |
epigraf | epigraf-main/scripts/utils.py | import os
import re
import json
import shutil
import random
import itertools
import contextlib
import zipfile
from typing import List, Dict, Tuple
import click
import joblib
from omegaconf import DictConfig
import numpy as np
from PIL import Image
import torch
import torchvision.transforms.functional as TVF
from torch... | 9,641 | 40.381974 | 153 | py |
epigraf | epigraf-main/scripts/extract_geometry.py | import sys; sys.path.extend(['.'])
from omegaconf import DictConfig
# from ast import DictComp
# import plyfile
# import argparse
import torch
import numpy as np
# import skimage.measure
# import scipy
import os
import hydra
from tqdm import tqdm
from scripts.utils import load_generator, set_seed
from scripts.inferenc... | 3,339 | 49.606061 | 133 | py |
epigraf | epigraf-main/scripts/calc_metrics.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 6,133 | 38.574194 | 128 | py |
epigraf | epigraf-main/scripts/testing/fit_image_inr.py | """
A debugging script for INR fitting
"""
import torch
from torch.optim import Adam
from PIL import Image
import torchvision.transforms.functional as TVF
from tqdm import tqdm
import numpy as np
from src.dnnlib import EasyDict
from src.training.networks_inr_gan import SynthesisNetwork
cfg = EasyDict({
"output_c... | 1,939 | 29.793651 | 103 | py |
epigraf | epigraf-main/scripts/testing/render_init.py | """
This script computes imgs/sec for a generator in the eval mode
for different batch sizes
"""
import sys; sys.path.extend(['..', '.', 'src'])
import numpy as np
import torch
import torch.nn as nn
import hydra
from omegaconf import DictConfig
from torchvision import utils
import torchvision.transforms.functional as ... | 3,249 | 40.139241 | 140 | py |
epigraf | epigraf-main/scripts/testing/profile_model.py | """
This script computes imgs/sec for a generator for different batch sizes
"""
import sys; sys.path.extend(['..', '.', 'src'])
import time
import numpy as np
import torch
import torch.nn as nn
import hydra
from hydra.experimental import initialize
from omegaconf import DictConfig, OmegaConf
from tqdm import tqdm
impo... | 5,269 | 40.171875 | 158 | py |
STINet-Space-time-Video-Super-resolution | STINet-Space-time-Video-Super-resolution-main/base_networks.py | import torch
import math
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
class DenseBlock(nn.Module):
def __init__(self, input_size, output_size, bias=True, activation='relu', norm='batch'):
super(DenseBlock, self).__init__()
self.fc = nn.Linear(input_size, output... | 32,626 | 38.74056 | 120 | py |
STINet-Space-time-Video-Super-resolution | STINet-Space-time-Video-Super-resolution-main/utils.py | import torch
from torch.autograd import Variable
import torchvision.transforms as transforms
from torch import mm
def norm(img, vgg=False):
if vgg:
# normalize for pre-trained vgg model
# https://github.com/pytorch/examples/blob/42e5b996718797e45c46a25c55b031e6768f8440/imagenet/main.py#L89-L101
... | 1,556 | 32.12766 | 117 | py |
STINet-Space-time-Video-Super-resolution | STINet-Space-time-Video-Super-resolution-main/autoencoder_v4.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class UNet(nn.Module):
def __init__(self, in_channels, out_classes):
super(UNet, self).__init__()
self.inc = inconv(in_channels, 64)
self.down1 = down(64, 128)
self.down2 = down(128, 256)
self.down3 = down(25... | 3,389 | 28.224138 | 122 | py |
STINet-Space-time-Video-Super-resolution | STINet-Space-time-Video-Super-resolution-main/net_STINet.py | import os
import torch.nn as nn
import torch.optim as optim
from base_networks import *
from torchvision.transforms import *
import torch.nn.functional as F
from dbpn import Net as DBPN
import torch
import dgl
import dgl.nn as dglnn
from DCNv2.dcn_v2 import DCN_sep
import numpy as np
def sigmoid(x):
return 1.0 / (... | 14,367 | 44.468354 | 116 | py |
STINet-Space-time-Video-Super-resolution | STINet-Space-time-Video-Super-resolution-main/main_STINet.py | import argparse
from math import log10
import os
import torch
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torchvision import models
from net_STINet import Net as STINet,FeatureExtractor
from data_... | 8,408 | 37.751152 | 117 | py |
STINet-Space-time-Video-Super-resolution | STINet-Space-time-Video-Super-resolution-main/dbpn.py | import os
import torch.nn as nn
import torch.optim as optim
from base_networks import *
from torchvision.transforms import *
class Net(nn.Module):
def __init__(self, num_channels, base_filter, feat, num_stages, scale_factor):
super(Net, self).__init__()
if scale_factor == 2:
kernel = ... | 2,906 | 32.413793 | 106 | py |
STINet-Space-time-Video-Super-resolution | STINet-Space-time-Video-Super-resolution-main/data_STINet.py | from torchvision.transforms import Compose, ToTensor, Normalize
from dataset_STINet import *
def transform():
return Compose([
ToTensor(),
Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
##LOADER TRAINING
def get_training_set(data_dir, upscale_facto... | 464 | 26.352941 | 106 | py |
STINet-Space-time-Video-Super-resolution | STINet-Space-time-Video-Super-resolution-main/dataset_STINet.py | import torch.utils.data as data
import torch
import numpy as np
import os
from os.path import join
from PIL import Image, ImageOps
import random
import cv2
max_flow = 150.0
np.random.seed(1)
def load_img(filepath, scale):
list = os.listdir(filepath)
list.sort()
h_random = int(np.random.uniform(0, 1) * 64)... | 4,606 | 42.87619 | 103 | py |
STINet-Space-time-Video-Super-resolution | STINet-Space-time-Video-Super-resolution-main/DCNv2/test.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import time
import torch
import torch.nn as nn
from torch.autograd import gradcheck
from dcn_v2 import dcn_v2_conv, DCNv2, DCN
from dcn_v2 import dcn_v2_pooling, DCNv2Pooling, DCNPooling
... | 8,506 | 30.391144 | 81 | py |
STINet-Space-time-Video-Super-resolution | STINet-Space-time-Video-Super-resolution-main/DCNv2/setup.py | #!/usr/bin/env python
import os
import glob
import torch
from torch.utils.cpp_extension import CUDA_HOME
from torch.utils.cpp_extension import CppExtension
from torch.utils.cpp_extension import CUDAExtension
from setuptools import find_packages
from setuptools import setup
requirements = ["torch", "torchvision"]
... | 2,001 | 27.197183 | 73 | py |
STINet-Space-time-Video-Super-resolution | STINet-Space-time-Video-Super-resolution-main/DCNv2/dcn_v2.py | #!/usr/bin/env python
import math
import logging
import torch
from torch import nn
from torch.autograd import Function
from torch.nn.modules.utils import _pair
from torch.autograd.function import once_differentiable
import _ext as _backend
logger = logging.getLogger('base')
class _DCNv2(Function):
@staticmethod... | 11,581 | 42.70566 | 100 | py |
PEPCRL-MVP | PEPCRL-MVP-master/settings.py | import argparse
params = {
"exp_name":"PEPCRL-MVP",
"Episode": 100000, # 总的训练轮数
"max_steps": 800, # 单次仿真最大步数****
"test_episodes": 8, # 测试时执行的轮数****
"memory_capacity": 5, # 经验池保存回合数/agent_num
"train_set_epoch": 1, ... | 4,015 | 34.22807 | 76 | py |
PEPCRL-MVP | PEPCRL-MVP-master/Muti_Agent.py | import numpy as np
from prioritization_network import prioritization_net
from DQN_agent import DQN
import torch
import os
import torch.optim as optim
from copy import deepcopy as dc
from env.utils import calculate_dis
from buffer import buffer
from torch.distributions import Normal, Categorical
import torch.nn.function... | 12,198 | 45.561069 | 211 | py |
PEPCRL-MVP | PEPCRL-MVP-master/prioritization_net_buffer.py | import numpy as np
import random
import torch
from copy import deepcopy as dc
class Prioritization_Net_Buffer():
def __init__(self,params):
self.params=params
self.evaluate_net_memory_pool = []
#[{"actor_param_input","critc_param_input","ego_pos_input","eva_pos_input","reward_input","action_... | 3,144 | 37.82716 | 136 | py |
PEPCRL-MVP | PEPCRL-MVP-master/prioritization_network.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Normal, Categorical
import numpy as np
from copy import deepcopy as dc
class prioritization_net(nn.Module):
def __init__(self,num_param,num_pos,num_evader,max_steps):
super(prioriti... | 2,808 | 34.556962 | 119 | py |
PEPCRL-MVP | PEPCRL-MVP-master/DQN_Networks.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Normal, Categorical
from copy import deepcopy as dc
import numpy as np
import csv
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class DQN_net(nn.Module):
def __init_... | 2,942 | 42.925373 | 187 | py |
PEPCRL-MVP | PEPCRL-MVP-master/DQN_agent.py | import numpy as np
import os
from DQN_Networks import DQN_net
import random
import torch.optim as optim
import torch
from copy import deepcopy as dc
from torch.distributions import Normal, Categorical
from env.utils import calculate_dis
import torch.nn as nn
from torch.utils.data.sampler import BatchSampler, SubsetRand... | 8,631 | 49.186047 | 167 | py |
FewShotCellSegmentation | FewShotCellSegmentation-master/Code/Supervised_Learning.py | import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import torch,torchvision
import torch.optim as optim
from torch.utils.data import DataLoader
from Code import Datasets
from WorkSpace import *
from numpy import Inf
import pickle
import torch.nn as nn
from Code impor... | 14,848 | 45.258567 | 154 | py |
FewShotCellSegmentation | FewShotCellSegmentation-master/Code/Evaluation_main.py | """
Usage Instructions:
To evaluate meta-trained models
ex:
python Evaluation_main.py --lr-method 'Meta_Learning' --architect 'FCRN' --target 'TNBC' --eval-meta-train-losses 'BCE' --switchaffine True --num-shots 1 3 5 7 10 --selections 1 2 3 4 5 6 7 8 9 10 --statedictepochs 300 --finetune-lr 0.0001 --finetune-epochs 2... | 5,611 | 46.559322 | 315 | py |
FewShotCellSegmentation | FewShotCellSegmentation-master/Code/Meta_Learning.py | import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from WorkSpace import *
import torch
import torch.optim as optim
from Code import Reptile
from torch.utils.tensorboard import SummaryWriter
class Meta_Learning():
def __init__(self, hyperparams=None, online_cro... | 6,093 | 48.145161 | 138 | py |
FewShotCellSegmentation | FewShotCellSegmentation-master/Code/Evaluation.py | from WorkSpace import *
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import time
import pickle
from Code import Models, Datasets,Results
import logging
import pandas as pd
from torch.utils.tensorboard import SummaryWriter
import math
import numpy as np
import os... | 29,709 | 50.759582 | 171 | py |
FewShotCellSegmentation | FewShotCellSegmentation-master/Code/Datasets.py | from PIL import Image,ImageChops
import torchvision.transforms as transforms
from torch.utils.data import DataLoader,Dataset,SubsetRandomSampler
import os
import torch
import numpy as np
import pickle
import matplotlib.pyplot as plt
import random
class Cell_Segmentation_Task():
def __init__(self, root_dir,datase... | 7,770 | 46.674847 | 150 | py |
FewShotCellSegmentation | FewShotCellSegmentation-master/Code/Models.py | import torch.nn as nn
import torch.nn.init as init
import torch
def double_conv(in_channels, out_channels,affine):
return nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.BatchNorm2d(out_channels,affine=affine),
nn.ReLU(inplace=True),
nn.Conv2d(out_channels, out... | 5,206 | 31.748428 | 98 | py |
FewShotCellSegmentation | FewShotCellSegmentation-master/Code/Reptile.py | import torch
import torch.nn as nn
import torch.optim as optim
import time
import numpy as np
from Code import Datasets,Models
import torchvision
import torch.nn.functional as F
import os
class HLoss(nn.Module):
def __init__(self):
super(HLoss, self).__init__()
def forward(self, x):
b = -1*tor... | 13,534 | 42.105096 | 164 | py |
RMPCDMD | RMPCDMD-master/doc/conf.py | # -*- coding: utf-8 -*-
#
# RMPCDMD documentation build configuration file, created by
# sphinx-quickstart on Wed May 4 12:33:14 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... | 10,397 | 30.798165 | 87 | py |
lammps-develop | lammps-develop/examples/mliap/mliap_pytorch_Ta06A.py | # Demonstrate how to load a model from the python side.
# This is essentially the same as in.mliap.pytorch.Ta06A
# except that python is the driving program, and lammps
# is in library mode.
before_loading =\
"""# Demonstrate MLIAP/PyTorch interface to linear SNAP potential
# Initialize simulation
variable nsteps in... | 2,751 | 23.792793 | 160 | py |
lammps-develop | lammps-develop/examples/mliap/convert_mliap_Ta06A.py | import sys
import numpy as np
import torch
# torch.nn.modules useful for defining a MLIAPPY model.
from lammps.mliap.pytorch import TorchWrapper, IgnoreElems
# Read coefficients
coeffs = np.genfromtxt("Ta06A.mliap.model",skip_header=6)
# Write coefficients to a pytorch linear model
bias = coeffs[0]
weights = coeffs[... | 874 | 31.407407 | 84 | py |
lammps-develop | lammps-develop/examples/mliap/mliap_pytorch_Ta06A_kokkos.py | # Demonstrate how to load a model from the python side.
# This is essentially the same as in.mliap.pytorch.Ta06A
# except that python is the driving program, and lammps
# is in library mode.
before_loading =\
"""# Demonstrate MLIAP/PyTorch interface to linear SNAP potential
# Initialize simulation
variable nsteps in... | 2,851 | 24.693694 | 160 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.