version
stringclasses
24 values
code
stringlengths
396
135k
apis
list
full_version
stringlengths
1
6
repo_name
stringlengths
6
64
hexsha
stringlengths
40
40
1.5
import abc from typing import List, Tuple, Dict, Set, Union import numpy as np import torch.nn as nn import torch import torch.nn.functional as F from ..classifiers import CNN1DFeaturizer, GRUFeaturizer, BasicFeaturizer, TransformerFeaturizer from .Fasttext1DCNN import Fasttext1DCNNModel from transformers import AutoMo...
[ "torch.tensor" ]
1.5.0
faizanahemad/facebook-hateful-memes
1f7febf65f5fc4ed4aeb476d5383437f677fbc19
1.7
import argparse import logging import math import os import random import time from copy import deepcopy from pathlib import Path from threading import Thread import numpy as np import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.optim.lr_sche...
[ "torch.cuda.manual_seed", "torch.cuda.amp.autocast", "torch.cuda.is_available", "torch.load", "torch.nn.DataParallel", "torch.nn.SyncBatchNorm.convert_sync_batchnorm", "torch.distributed.init_process_group", "torch.manual_seed", "torch.tensor", "torch.utils.tensorboard.SummaryWriter", "torch.dis...
1.7.0
PJunhyuk/2021AICompetition-03
dbeea7dec3f009f1f1485984dcdfa54eb6b4f75e
1.6
import os import csv import time import wandb import numpy as np import pandas as pd import seaborn as sns import pytorch_lightning as pl import matplotlib.pyplot as plt from os.path import join from pathlib import Path from pprint import pprint from config import setSeed, getConfig from collections import Counter, de...
[ "torch.from_numpy", "torch.nn.Parameter", "torch.utils.data.DataLoader" ]
1.6.0
imatge-upc/pixelcoordEDL
353632feed6ac8c93758c1a2a1b7a477e7ff053c
1.7
# -*- coding: utf-8 -*- import torch import torch.nn as nn class ScalarMix(nn.Module): def __init__(self, n_layers, dropout=0): super(ScalarMix, self).__init__() self.n_layers = n_layers self.dropout = dropout self.weights = nn.Parameter(torch.zeros(n_layers)) self.gamm...
[ "torch.zeros", "torch.nn.Dropout", "torch.tensor" ]
1.7.1
njzr/DadmaTools
b26ad8aa834f642d49bd120bd7cf1fdf40741be1
1.0
import torch import unittest import qtorch from qtorch.quant import block_quantize, fixed_point_quantize, float_quantize from qtorch import FixedPoint, BlockFloatingPoint, FloatingPoint class TestDevice(unittest.TestCase): """ invariant: cuda and cpp implementation should behave the same """ def er...
[ "torch.rand", "torch.linspace" ]
1.0.0
drcut/QPyTorch
63c293178e8ce9e6e5b218dee96536e9c4ad1e5c
1.1
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch import pycocotools.mask as mask_utils # transpose FLIP_LEFT_RIGHT = 0 FLIP_TOP_BOTTOM = 1 class Mask(object): """ This class is unfinished and not meant for use yet It is supposed to contain the mask for an object as ...
[ "torch.as_tensor", "torch.from_numpy" ]
1.1.0
Loranet-Technologies/traffic-analysis
e1e50b6c36b3da6279678c679500a8cf4e62ccef
1.0
import copy import json import math import numpy as np import os import pathlib import sklearn.metrics import torch import tqdm import models #here = pathlib.Path(__file__).resolve().parent here = pathlib.Path("/dfs/scratch1/ksaab/ncde_results") def _add_weight_regularisation(loss_fn, regularise_parameters, scaling=...
[ "torch.zeros", "torch.cat", "torch.no_grad", "torch.cuda.reset_max_memory_allocated", "torch.cuda.memory_allocated", "torch.cuda.max_memory_allocated", "torch.tensor", "torch.optim.lr_scheduler.ReduceLROnPlateau", "torch.nn.BCEWithLogitsLoss", "torch.argmax" ]
1.0.0
khaledsaab/NeuralCDE
559d9d6fdb137afd14965725ea4845cf31e9235c
0.4
import torch import numpy as np from utilities.data_structures.Replay_Buffer import Replay_Buffer from utilities.Utility_Functions import abstract @abstract class HER_Base(object): """Contains methods needed to turn an algorithm into a hindsight experience replay (HER) algorithm""" def __init__(self, buffer_si...
[ "torch.cat" ]
0.4.1
p-christ/Deep-Reinforcement-Learning-PyTorch-Algorithms
135d3e2e06bbde2868047d738e3fc2d73fd8cc93
0.4
import torch from torch import optim from agents.Base_Agent import Base_Agent from agents.DQN_agents.DDQN import DDQN class Dueling_DDQN(DDQN): """A dueling double DQN agent as described in the paper http://proceedings.mlr.press/v48/wangf16.pdf""" agent_name = "Dueling DDQN" def __init__(self, config): ...
[ "torch.no_grad", "torch.mean", "torch.from_numpy" ]
0.4.1
p-christ/Deep-Reinforcement-Learning-PyTorch-Algorithms
135d3e2e06bbde2868047d738e3fc2d73fd8cc93
1.7
""" A torch implement for U-Net. * see: U-Net: Convolutional Networks for Biomedical Image Segmentation * author: JamzumSum * create: 2021-1-11 """ from functools import partial import torch import torch.nn as nn import torch.nn.functional as F from common.layers import BlurPool, MaxBlurPool2d, Swish from common.supp...
[ "torch.cat", "torch.nn.Identity", "torch.relu", "torch.nn.Sigmoid", "torch.nn.Tanh", "torch.nn.ConvTranspose2d", "torch.nn.Upsample", "torch.nn.Conv2d", "torch.nn.Sequential.__init__", "torch.nn.functional.pad", "torch.nn.Sequential.forward" ]
1.7
JamzumSum/yNet
78506738e64321cfd26f0af70a62dd2119948e39
1.6
import os import torch import argparse from configs import args from data import make_data_loader from model import bulid_MGN_resnet from processor import inference def test(args): print('Start Testing ------') train_loader, val_loader, class_num, _, _, num_query = make_data_loader(args) device = torch.d...
[ "torch.device" ]
1.6.0
WangTaoAs/MGN_ReID
916244c39b57b8068c34a7bfa1803781193bb554
1.10
# import from src.project_parameters import ProjectParameters from src.model import create_model import torch from DeepLearningTemplate.data_preparation import parse_transforms, AudioLoader from DeepLearningTemplate.predict import AudioPredictDataset from typing import TypeVar, Any T_co = TypeVar('T_co', covariant=True...
[ "torch.no_grad", "torch.cuda.is_available", "torch.utils.data.DataLoader" ]
1.10.1
fastyangmh/AudioGANomaly
d877f050606765b17bb6755bd70277857326b5e1
1.5
#!/usr/bin/env python3 """Training module for DCGAN.""" import argparse import logging logging.root.setLevel(logging.INFO) import os from typing import Any, Dict, List, Tuple import model import utils import math import numpy as np import torch import torch.cuda import torch.nn as nn import torch.optim as optim impor...
[ "torch.device", "torch.mul", "torch.no_grad", "torch.full", "torch.utils.data.DataLoader", "torch.nn.BCELoss", "torch.load", "torch.randn" ]
1.5.0
Cam2337/RecycleNet-DCGAN
a6691d1e3e03e286192a1791fd323bd2f442ad9f
1.2
import torch import torch.nn as nn import math __all__ = ['pyramidnet272'] def conv3x3(in_planes, out_planes, stride=1): "3x3 convolution with padding" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) def calc_prob(curr_layer, to...
[ "torch.nn.Linear", "torch.zeros", "torch.cat", "torch.nn.Sequential", "torch.nn.AvgPool2d", "torch.nn.BatchNorm2d", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.nn.ZeroPad2d" ]
1.2.0
AllenChen1998/QueryNet
1ab74d7f4cc9d25af30abe0631581cf7be81a07f
3
# -*- coding: utf-8 -*- # # Copyright (C) 2019 Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG), # acting on behalf of its Max Planck Institute for Intelligent Systems and the # Max Planck Institute for Biological Cybernetics. All rights reserved. # # Max-Planck-Gesellschaft zur Förderung der Wissens...
[ "torch.zeros", "torch.isnan", "torch.optim.Adam", "torch.nn.SmoothL1Loss", "torch.pow" ]
3
zephyr-fun/human_body_prior
35571fe16fddca39553398f6b3eb6d18a23c985b
0.3
import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F from classifier import SimpleClassifier class _netG(nn.Module): def __init__(self, args): super(_netG, self).__init__() self.ninp = args.ninp self.nhid = args.nhid self.nlayers = ...
[ "torch.nn.Linear", "torch.zeros", "torch.max", "torch.nn.init.xavier_uniform", "torch.autograd.Variable", "torch.nn.functional.dropout", "torch.FloatTensor", "torch.nn.functional.log_softmax", "torch.unsqueeze", "torch.multinomial", "torch.LongTensor", "torch.div", "torch.exp", "torch.sort...
0.3.1
Unmesh-Kumar/DMRM
f1c24049bd527c9dcc5ab6e6727dfa6c8e794c02
1.7
""" This code is from batra-mlp-lab's repository. https://github.com/batra-mlp-lab/visdial-challenge-starter-pytorch """ import torch from torch import nn class GenerativeDecoder(nn.Module): def __init__(self, config, vocabulary): super().__init__() self.config = config self.word_embed =...
[ "torch.nn.LogSoftmax", "torch.nn.Dropout", "torch.nn.LSTM", "torch.zeros_like", "torch.sum" ]
1.7.0
gicheonkang/sglkt-visdial
b2927e8bc8e45c2d2a2a76fbf75a15f8ecb78b88
1.7
import torch def initialize_model_weights(model, initialization="he", lstm_initialization="he"): if initialization == "he": print("kaiming normal initialization.") elif initialization == "xavier": print("xavier normal initialization.") else: print("default initialization, no changes...
[ "torch.nn.init.kaiming_normal_", "torch.nn.init.xavier_normal_" ]
1.7.0
gicheonkang/sglkt-visdial
b2927e8bc8e45c2d2a2a76fbf75a15f8ecb78b88
1.7
""" Reasoning Visual Dialog with Sparse Graph Learning and Knowledge Transfer Gi-Cheon Kang, Junseok Park, Hwaran Lee, Byoung-Tak Zhang, Jin-Hwa Kim https://arxiv.org/abs/2004.06698 """ import numpy as np import torch, math import torch.nn as nn import torch.nn.functional as F from .net_utils import MLP from torch.auto...
[ "torch.nn.Linear", "torch.nn.functional.normalize", "torch.nn.LogSoftmax", "torch.nn.functional.softmax", "torch.zeros_like" ]
1.7.0
gicheonkang/sglkt-visdial
b2927e8bc8e45c2d2a2a76fbf75a15f8ecb78b88
1.4
import glob import itertools import numpy as np import os import pickle import torch from collections import defaultdict # Project imports from core.setup import setup_config, setup_arg_parser from probabilistic_inference.inference_utils import get_inference_output_dir def get_clean_results_dict(config_names, ...
[ "torch.zeros", "torch.cat", "torch.distributions.Categorical", "torch.nn.MSELoss", "torch.stack", "torch.norm", "torch.distributions.Bernoulli", "torch.eye", "torch.full", "torch.load" ]
1.4.0
jskhu/probdet-1
b8bda3bd7cdd573aa9f70a62453d147664211af6
1.3
import os import skimage import torch from warnings import warn from .model_io import get_model from .transform import process_aug_dict from .datagen import InferenceTiler from ..raster.image import stitch_images from ..utils.core import get_data_paths class Inferer(object): """Object for training `solaris` model...
[ "torch.device", "torch.no_grad", "torch.cuda.is_available", "torch.from_numpy" ]
1.3.1
fractalsproject/solaris
ac1facb1daa661ddf6ab1ff13dba36ff88ef1c0f
1.5
import collections import logging import torch import copy import random import numpy as np from sklearn.svm import NuSVR from sklearn.linear_model import BayesianRidge from sklearn.ensemble import RandomForestRegressor import time from sklearn.model_selection import cross_val_score, train_test_split from scipy import...
[ "torch.nn.ModuleList", "torch.nn.Module" ]
1.5.0
automl/nas-bench-x11
ebf64ce3c30cc2ad0909508b5e25652011179956
1.4
import os import gym import torch import pprint import argparse import numpy as np from torch.utils.tensorboard import SummaryWriter from tianshou.utils import BasicLogger from tianshou.env import DummyVectorEnv from tianshou.utils.net.common import Net from tianshou.data import Collector, VectorReplayBuffer from tian...
[ "torch.manual_seed", "torch.cuda.is_available", "torch.utils.tensorboard.SummaryWriter", "torch.set_num_threads" ]
1.4.0
ultmaster/tianshou
3ac67d9974b6bd3e3d7feac7738ca6de33b317c7
1.4
#!/usr/bin/env python3 import os import gym import torch import datetime import argparse import numpy as np from torch import nn from torch.optim.lr_scheduler import LambdaLR from torch.utils.tensorboard import SummaryWriter from torch.distributions import Independent, Normal from tianshou.policy import PGPolicy from...
[ "torch.nn.init.constant_", "torch.distributions.Normal", "torch.manual_seed", "torch.cuda.is_available", "torch.optim.lr_scheduler.LambdaLR", "torch.nn.init.zeros_", "torch.utils.tensorboard.SummaryWriter" ]
1.4.0
ultmaster/tianshou
3ac67d9974b6bd3e3d7feac7738ca6de33b317c7
1.4
import torch from torch import nn from torch.nn import functional as F from torch.autograd import Variable import torch.utils.data import torch.utils.data.distributed import numpy as np import pdb kernel_size = 5 class Discriminator(nn.Module): """ Known to work well as a GAN discriminator ""...
[ "torch.nn.Linear", "torch.nn.AdaptiveAvgPool2d", "torch.nn.MaxPool2d", "torch.nn.Sequential", "torch.nn.init.constant_", "torch.nn.init.kaiming_normal_", "torch.nn.GroupNorm", "torch.nn.Conv2d", "torch.nn.InstanceNorm2d", "torch.nn.functional.relu" ]
1.4.0
sbhadra2020/fastMRI
a2b25fed53621c5d5c648993af13971b2d365fc3
1.7
# coding=utf-8 # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # 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 re...
[ "torch.nn.Dropout" ]
1.7.0
thu-pacman/AIPerf-MoE
fda4f381b4b974721b187cece968dd7bc96a81f4
1.7
# coding=utf-8 # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # 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 re...
[ "torch.distributed.get_world_size", "torch.cuda.synchronize", "torch.distributed.is_initialized", "torch.distributed.get_rank", "torch.utils.tensorboard.SummaryWriter" ]
1.7.0
thu-pacman/AIPerf-MoE
fda4f381b4b974721b187cece968dd7bc96a81f4
1.6
# Copyright The PyTorch Lightning team. # # 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...
[ "torch.tensor", "torch.load" ]
1.6
Aiden-Jeon/pytorch-lightning
963c26764682fa4cf64c93c5a7572ae0040e9c32
1.4
from collections import namedtuple from functools import partial import pytest import torch from skimage.metrics import structural_similarity from pytorch_lightning.metrics.functional import ssim from pytorch_lightning.metrics.regression import SSIM from tests.metrics.utils import BATCH_SIZE, MetricTester, NUM_BATCHE...
[ "torch.manual_seed", "torch.rand" ]
1.4
prajakta0111/pytorch-lightning
3df02b880a6d145ff0aca24ea429c12c0d8f1181
1.4
# Copyright The PyTorch Lightning team. # # 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...
[ "torch.zeros", "torch.cat" ]
1.4
prajakta0111/pytorch-lightning
3df02b880a6d145ff0aca24ea429c12c0d8f1181
1.4
import pytest import torch from pytorch_lightning.metrics.utils import class_reduce, reduce def test_reduce(): start_tensor = torch.rand(50, 40, 30) assert torch.allclose(reduce(start_tensor, 'elementwise_mean'), torch.mean(start_tensor)) assert torch.allclose(reduce(start_tensor, 'sum'), torch.sum(star...
[ "torch.rand", "torch.randint", "torch.mean", "torch.sum" ]
1.4
prajakta0111/pytorch-lightning
3df02b880a6d145ff0aca24ea429c12c0d8f1181
1.4
# Copyright The PyTorch Lightning team. # # 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...
[ "torch.nn.Linear", "torch.device", "torch.load" ]
1.4
prajakta0111/pytorch-lightning
3df02b880a6d145ff0aca24ea429c12c0d8f1181
1.0
# merges the output of the main transfer_model script import torch from pathlib import Path import pickle from scipy.spatial.transform import Rotation as R KEYS = [ "transl", "global_orient", "body_pose", "betas", "left_hand_pose", "right_hand_pose", "jaw_pose", "leye_pose", "reye_pose", "expression", "vertices", "jo...
[ "torch.cat" ]
1.0.1
gngdb/smplx
ba72def2038712784458a91f94371de6550d7e65
1.6
import torch from ..distances import CosineSimilarity from ..utils import common_functions as c_f from .generic_pair_loss import GenericPairLoss class NTXentLoss(GenericPairLoss): def __init__(self, temperature=0.07, **kwargs): super().__init__(mat_based_loss=False, **kwargs) self.temperature = t...
[ "torch.exp", "torch.max" ]
1.6.0
keshav47/pytorch-metric-learning
501e4cb5e56c56d09413c98a93039669abc2232b
1.9
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import os class Linear_QNet(nn.Module): def __init__(self, input_size, hidden_size, hidden_size2, output_size): # feed forward neural network super().__init__() self.linear1 = nn.Linear(input_size, hidden_size) self...
[ "torch.nn.Linear", "torch.nn.MSELoss", "torch.save", "torch.unsqueeze", "torch.tensor", "torch.load", "torch.argmax" ]
1.9.0
Chicco94/breakout-Q-learning
dfb7c1d18c4472f21828f1163641817b6f44d726
0.4
from torch.utils.data import Subset from PIL import Image from torchvision.datasets import MNIST from base.torchvision_dataset import TorchvisionDataset from .preprocessing import get_target_label_idx, global_contrast_normalization import torchvision.transforms as transforms MNIST.resources = [ ('https://...
[ "torch.utils.data.Subset" ]
0.4.1
Pangoraw/Deep-SVDD-PyTorch
806f7099cea2013a87ebb32f30a6f4c9595ebbeb
1.7
import torch import torch.nn as nn from torch.nn import Module as Module import timm from torch.nn import Parameter import torch.nn.functional as F class AngleSimpleLinear(nn.Module): """Computes cos of angles between input vectors and weights vectors""" def __init__(self, in_features, out_features): ...
[ "torch.nn.functional.normalize", "torch.nn.Identity", "torch.nn.PReLU", "torch.t", "torch.Tensor" ]
1.7
kprokofi/ML_Decoder
c01c50e0165e607afbebd8d615708ef9c084dd5b
1.2
import logging from typing import Any, Dict, List, Optional import torch from torch.nn.functional import nll_loss, binary_cross_entropy_with_logits, sigmoid from allennlp.common.checks import check_dimensions_match from allennlp.data import Vocabulary from allennlp.models.model import Model from allennlp.models.readi...
[ "torch.nn.Linear", "torch.nn.functional.binary_cross_entropy_with_logits", "torch.cat", "torch.nn.Dropout", "torch.sigmoid", "torch.ones_like", "torch.zeros_like" ]
1.2.0
flyinslowly/flyinnlp
328e45d2952da6cdebbc1cccbb6a0aa9972859df
1.6
import os import argparse import multiprocessing from pathlib import Path from PIL import Image import torch from torchvision import models, transforms from torch.utils.data import DataLoader, Dataset from byol_pytorch import BYOL import pytorch_lightning as pl # test model, a resnet 50 resnet = models.resnet50(pre...
[ "torch.utils.data.DataLoader" ]
1.6
kshen6/byol-pytorch
49e303adf89ed3d990025262fd30226a00a98d45
1.6
import torch from mimic.evaluation.divergence_measures.kl_div import calc_entropy_gauss from mimic.evaluation.divergence_measures.kl_div import calc_kl_divergence from mimic.evaluation.divergence_measures.kl_div import calc_kl_divergence_lb_gauss_mixture from mimic.evaluation.divergence_measures.kl_div import calc_kl_...
[ "torch.zeros", "torch.log", "torch.Tensor", "torch.exp", "torch.sum" ]
1.6.0
Jimmy2027/MoPoE-MIMIC
d167719b0dc7ba002b7421eb82a83e47d2437795
1.8
import os from os.path import exists, join from pathlib import Path from typing import Optional, Tuple from pytorch_lightning import LightningDataModule from torch.utils.data import ConcatDataset, DataLoader, Dataset, random_split from src.datamodules.datasets.musdb import MusdbTrainDataset, MusdbValidDataset class...
[ "torch.utils.data.DataLoader" ]
1.8.1
kuielab/mdx-net
bbd46dbf2ceb26c3fbfbe412b5159bce2366c9c0
1.3
# Copyright The PyTorch Lightning team. # # 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...
[ "torch.cat", "torch.randint", "torch.tensor", "torch.randn" ]
1.3.1
gagan3012/metrics
5a2388ccaa97cc3608b1fa28879f77436434a6d6
1.8
import scipy from torch.nn import Dropout, CrossEntropyLoss from code.abstract.abstract_torch_module import AbstractTorchModule import torch import numpy as np from code.gnns.qa_gnn import QaGNN from code.utils.evaluation.choice_model_output import ChoiceModelOutput from code.utils.torch_utils.xavier_linear import Xa...
[ "torch.cat", "torch.nn.LSTM", "torch.LongTensor", "torch.nn.CrossEntropyLoss", "torch.FloatTensor", "torch.zeros_like", "torch.max", "torch.nn.Tanh", "torch.nn.Dropout", "torch.arange", "torch.softmax", "torch.ones_like" ]
1.8.1
S-Eggers/GraphMask
9e431a541279801ec46a5b38ed57b2033f795240
1.6
import sys import os sys.path.append(os.path.abspath("..")) import cv2 import math import torch import kornia import numpy as np import torch.nn as nn from numpy.fft import fft2, ifft2, fftshift import torch.nn.functional as F from torch.autograd import Variable from torchvision import transforms, utils import matplot...
[ "torch.rfft", "torch.sqrt", "torch.einsum", "torch.FloatTensor", "torch.linspace", "torch.from_numpy", "torch.ifft" ]
1.6.0
wrld/PRoGAN
ef28d4b91b76dd7f9e7d466b007826491bce5080
1.8
import logging import warnings from collections.abc import Iterable as IterableClass from functools import partial from typing import Dict, Iterable, List, Optional, Sequence, Tuple, TypeVar, Union import numpy as np import pandas as pd import torch from anndata import AnnData from scvi import REGISTRY_KEYS from scvi...
[ "torch.cat", "torch.stack", "torch.distributions.Bernoulli", "torch.exp", "torch.sigmoid", "torch.zeros_like", "torch.nn.functional.normalize", "torch.distributions.Gamma", "torch.no_grad", "torch.ones_like", "torch.mean" ]
1.8.0
Semih-Kurt/scvi-tools
1bea2af8cc99e11d55a6925f09d978de5f6994fb
1.8
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import torch from torch.utils.data import Dataset import torchvision.transforms as transforms import numpy as np from nni.compression.pytorch.utils.counter import count_flops_params from mobilenet import MobileNet from mobilenet_v2 imp...
[ "torch.nn.Linear", "torch.rand", "torch.from_numpy", "torch.load", "torch.hub.load" ]
1.8.1
xiaowu0162/mobilenet_compression
a04fa087ac84b0918fb49ef77bf8439d02cbcf1f
1.4
import time from collections import OrderedDict import numpy as np import pandas as pd import torch from torch.utils.data import DataLoader import logging from tqdm import tqdm from neuralprophet import configure from neuralprophet import time_net from neuralprophet import time_dataset from neuralprophet import df_ut...
[ "torch.zeros", "torch.cos", "torch.no_grad", "torch.utils.data.DataLoader", "torch.ones_like", "torch.zeros_like", "torch.sum" ]
1.4.0
ssattari/neural_prophet
e121234d2f64d2b81f9c53f52b30d21a2cf1c6e0
1.4
#!/usr/bin/env python import logging import os import sys from typing import Union import fire import pyarrow from sentence_transformers.models import Pooling, Transformer from smart_open import open from tqdm import tqdm from sentence_transformers import SentenceTransformer, losses import torch from torch.utils.data...
[ "torch.utils.data.DataLoader" ]
1.4.0
malteos/aspect-document-embeddings
0836ea54a9192dbc2b01bb212c7521668bb398af
0.4
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class RCNN(nn.Module): def __init__(self, vocab_size, embed_dim, output_dim, hidden_dim, num_layers, dropout, weight): super(RCNN, self).__init__() self.embedding = nn.Embedding(vocab_size, e...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.cat", "torch.nn.LSTM", "torch.from_numpy", "torch.nn.Embedding" ]
0.4.0
czhongyu/information-extraction
6cf9905bed5ee9c33706854cd6ceae04194aa5e4
1.5
# Copyright 2020 - 2021 MONAI Consortium # 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 in wri...
[ "torch.nn.Linear", "torch.nn.functional.avg_pool3d", "torch.cat", "torch.nn.Sequential", "torch.nn.ReLU", "torch.as_tensor" ]
1.5
albarqounilab/MONAI
d4d173362b71a9af6c5414db591994f799e4fd2c
1.5
# Copyright 2020 - 2021 MONAI Consortium # 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 in wri...
[ "torch.tensor" ]
1.5
albarqounilab/MONAI
bb0b307d68021a243011a58fd82a1d275f00a51a
1.8
# Copyright (c) 2019 Horizon Robotics. All Rights Reserved. # # 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 applicab...
[ "torch.isfinite", "torch.max" ]
1.8.1
www2171668/alf
6e3731fc559d3b4e6b5b9ed6251fff728a560d64
1.8
# Copyright (c) 2019 Horizon Robotics. All Rights Reserved. # # 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 applicab...
[ "torch.var", "torch.sqrt", "torch.clamp", "torch.tensor" ]
1.8.1
www2171668/alf
6e3731fc559d3b4e6b5b9ed6251fff728a560d64
1.8
# Copyright (c) 2020 Horizon Robotics and ALF Contributors. All Rights Reserved. # # 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...
[ "torch.rand", "torch.cat", "torch.nonzero", "torch.min", "torch.arange", "torch.gather", "torch.manual_seed", "torch.all", "torch.tensor", "torch.ones_like", "torch.allclose", "torch.equal", "torch.where" ]
1.8.1
www2171668/alf
6e3731fc559d3b4e6b5b9ed6251fff728a560d64
1.8
# Copyright (c) 2020 Horizon Robotics and ALF Contributors. All Rights Reserved. # # 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...
[ "torch.typename", "torch.matmul", "torch.eye", "torch.ones_like", "torch.exp", "torch.sum" ]
1.8.1
www2171668/alf
6e3731fc559d3b4e6b5b9ed6251fff728a560d64
1.4
import numpy as np import cv2 import torch import os import sys import random import torch.nn as nn import torch.utils.data as tdata import glob from matplotlib import pyplot as plt sys.path.append(".") from visualizer_dataloader import thermaldataset def visualize(data_sample): data = data_sample['data'] label = ...
[ "torch.utils.data.DataLoader" ]
1.4.0
shub659/StressNet-Detecting-stress-from-thermal-videos
89a06014ba2c456482d1d427cbac0171e477492a
1.3
# Copyright The PyTorch Lightning team. # # 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...
[ "torch.tensor", "torch.argmax" ]
1.3.1
stancld/metrics
d35c3b5cff21e68e6620ebfc9a84e60dc4559e92
1.1
from torch.utils.data import Subset from PIL import Image from torchvision.datasets import MNIST from base.torchvision_dataset import TorchvisionDataset from .preprocessing import create_semisupervised_setting import torch import torchvision.transforms as transforms import random import numpy as np class MNIST_Datas...
[ "torch.utils.data.Subset", "torch.zeros_like", "torch.from_numpy" ]
1.1.0
kevinwss/Deep-SAD-Baseline
b704725cc44ab5e7aa9bb09503a4c5f244fa907b
1.0
# MIT License # # Copyright (c) 2020 The Google AI Language Team Authors, The HuggingFace Inc. team and github/lonePatient # # 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 restricti...
[ "torch.nn.Linear", "torch.zeros", "torch.nn.Dropout", "torch.nn.MSELoss", "torch.arange", "torch.nn.CrossEntropyLoss", "torch.from_numpy", "torch.ones", "torch.tensor", "torch.nn.BCEWithLogitsLoss", "torch.nn.functional.softmax", "torch.tanh", "torch.nn.functional.pad", "torch.matmul", "...
1.0
Knarik1/transformers
c2a7d7280250addae38a49c31a57ddd897be2065
1.1
import numpy as np import pytest import scipy import torch import torch.testing from rllib.dataset.datatypes import Observation from rllib.dataset.utilities import stack_list_of_tuples from rllib.util.value_estimation import discount_cumsum, discount_sum, mc_return class TestDiscountedCumSum(object): @pytest.fix...
[ "torch.get_default_dtype", "torch.tensor", "torch.testing.assert_allclose" ]
1.1.1
4kubo/rllib
4f9f5f49916c7681675305b6c9a276b9e88c5e22
1.9
"""Multi-microphone components. This library contains functions for multi-microphone signal processing. Example ------- >>> import torch >>> >>> from speechbrain.dataio.dataio import read_audio >>> from speechbrain.processing.features import STFT, ISTFT >>> from speechbrain.processing.multi_mic import Covariance >>> ...
[ "torch.cat", "torch.stack", "torch.triu_indices", "torch.fft.irfft", "torch.LongTensor", "torch.sum", "torch.reshape", "torch.sqrt", "torch.gather", "torch.FloatTensor", "torch.irfft", "torch.div", "torch.zeros", "torch.cos", "torch.max", "torch.fmod", "torch.complex", "torch.matmu...
1.9.0
Chaanks/speechbrain
6447bde54f6e3fb07fdb934ab535f17cadfbad53
0.4
import random import torch class ImagePool(): """This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators. """ def __init__(self, pool_...
[ "torch.cat", "torch.unsqueeze" ]
0.4.1
szWingLee/pytorch-CycleGAN-and-pix2pix
6127c7ad361ff5545beb14a8b814cb81cf369f35
1.1
""" Copyright (c) Microsoft Corporation. Licensed under the MIT license. UNITER for ITM model """ from collections import defaultdict import torch from torch import nn from torch.nn import functional as F #from apex.normalization.fused_layer_norm import FusedLayerNorm as LayerNorm from torch.nn import LayerNorm from...
[ "torch.nn.Linear", "torch.sigmoid", "torch.nn.functional.binary_cross_entropy_with_logits", "torch.clamp" ]
1.1.0
david-yoon/UMIC
0dfab17d826e65ae3cb112e3da300772b168776f
1.2
#!/usr/bin/python3 from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import json import logging import os import re import random import numpy as np import torch from torch.utils.data import DataLoader from model import KGEModel from datal...
[ "torch.load" ]
1.2.0
BU-Lisp/ogb
882786c0b71f5c836275c03b8554ad919bfe34e4
1.2
import torch from torch_geometric.data import DataLoader import torch.optim as optim import torch.nn.functional as F from torchvision import transforms from gnn import GNN from tqdm import tqdm import argparse import time import numpy as np import pandas as pd import os ### importing OGB from ogb.graphproppred import...
[ "torch.device", "torch.cat", "torch.argmax", "torch.save", "torch.no_grad", "torch.cuda.is_available", "torch.nn.CrossEntropyLoss" ]
1.2.0
BU-Lisp/ogb
1d6dde8080261931bc6ce2491e9149298af1ea98
1.7
# -*- coding:utf-8 -*- """ Utilities to handel graph data """ import os import dgl import pickle import numpy as np import torch as th from ogb.nodeproppred import DglNodePropPredDataset def load_dgl_graph(base_path): """ 读取预处理的Graph,Feature和Label文件,并构建相应的数据供训练代码使用。 :param base_path: :return: ...
[ "torch.from_numpy" ]
1.7.1
ytchx1999/MAXP_DGL_Graph
01ea0dc3e6f957b8c7a9b6958df02559f1866b32
1.1
from typing import List, Callable, Tuple, Dict import warnings import torch import ipdb from allennlp.common.checks import ConfigurationError StateType = Dict[str, torch.Tensor] # pylint: disable=invalid-name StepFunctionType = Callable[[torch.Tensor, StateType], Tuple[torch.Tensor, StateType]] # pylint: disable=...
[ "torch.isfinite", "torch.where" ]
1.1.0
wangzhen263/allennlp
309b2b572aeb0677511b4f972281ac265d7477a9
1.4
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Transform, constraints from pyro.distributions.conditional import ConditionalTransformModule from pyro.distributions.t...
[ "torch.Tensor", "torch.nn.functional.softplus" ]
1.4.0
akern40/pyro
8633b7136946ab2ae2e16062503fe51c2aac8c38
1.0
import argparse import time import logging from datetime import datetime try: from apex import amp from apex.parallel import DistributedDataParallel as DDP from apex.parallel import convert_syncbn_model has_apex = True except ImportError: from torch.nn.parallel import DistributedDataParallel as DD...
[ "torch.distributed.get_world_size", "torch.cuda.synchronize", "torch.nn.SyncBatchNorm.convert_sync_batchnorm", "torch.distributed.init_process_group", "torch.no_grad", "torch.nn.parallel.DistributedDataParallel", "torch.manual_seed", "torch.cuda.set_device", "torch.distributed.get_rank", "torch.nn...
1.0
woffett/pytorch-image-models
d6ac5bbc481271efecee8bc8756caa864a253fdd
1.1
import numpy as np import torch import torch.nn as nn import matplotlib.pyplot as plt import copy import math from pcdet.ops.iou3d_nms.iou3d_nms_utils import boxes_iou3d_gpu from pcdet.models.dense_heads.utils import _sigmoid from ...utils import box_coder_utils, common_utils from pcdet.utils import matcher from pcd...
[ "torch.cat", "torch.stack", "torch.nn.ModuleList", "torch.arange", "torch.no_grad", "torch.nn.BatchNorm2d", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.topk" ]
1.1
ocNflag/point2seq
710686f576b3df5469a06c66860758b25f852dbd
1.10
import torch from torch import nn from pytti.Image.differentiable_image import DifferentiableImage class EMAImage(DifferentiableImage): """ Base class for differentiable images with Exponential Moving Average filtering Based on code by Katherine Crowson """ def __init__(self, width, height, tenso...
[ "torch.no_grad", "torch.nn.Parameter", "torch.tensor", "torch.ones_like", "torch.zeros_like" ]
1.10.1
wizardhead/pytti-core
6030f6154ad7d17b93cf76e2d42905d4231a0abd
1.7
import torch import torch.nn as nn import torch.nn.functional as F from models.ResNet50Encoder import Bottleneck class DeepLabClassificationHead(nn.Module): def __init__(self, num_classes): super().__init__() self.aspp = ASPP(2048, 256) self.low_level_feature_reducer = nn.Sequential( ...
[ "torch.nn.Linear", "torch.cat", "torch.nn.BatchNorm2d", "torch.nn.ReLU", "torch.nn.Upsample", "torch.nn.Conv2d", "torch.nn.AdaptiveAvgPool2d", "torch.nn.Flatten" ]
1.7.0
allenai/ViRB
fbe1c42571ce0994b1e41bc4bdf88cf9658ae48b
1.4
import geoopt import torch import pytest @pytest.mark.parametrize( "line_search_params", [dict(), dict(c1=1e-3, c2=0.99), dict(amax=1, amin=1e-12), dict(stabilize=10)], ) @pytest.mark.parametrize("batch_size", [None, 1, 16]) @pytest.mark.parametrize("line_search_method", ["armijo", "wolfe"]) @pytest.mark.para...
[ "torch.manual_seed", "torch.no_grad", "torch.randn" ]
1.4.0
tao-harald/geoopt
d6fea4d44f146877c5a430e9fd6ba0fb7e821b92
1.9
"""Copyright (c) 2018, Haavard Kvamme 2021, Schrod Stefan""" import numpy as np from torch import nn class DenseVanillaBlock(nn.Module): def __init__(self, in_features, out_features, bias=True, batch_norm=True, dropout=0., activation=nn.ReLU, w_init_=lambda w: nn.init.kaiming_no...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.nn.Sequential", "torch.nn.init.kaiming_normal_", "torch.nn.BatchNorm1d" ]
1.9.1
sschrod/BITES
64c76feebd8b0869e74938f79d93b1946dcf88b5
1.7
import os import numpy as np import pandas as pd import torch import torchvision import tqdm from PIL import Image from matplotlib import pyplot as plt from torch.utils.data import Dataset from torchvision import transforms class Flowers(Dataset): def __init__(self, root, train=True, download=False, transform=No...
[ "torch.utils.data.DataLoader", "torch.tensor" ]
1.7
caisarl76/TADE-AgnosticLT
8a23f6609622dd30feb22101067e644666810400
1.9
# Copyright 2021 Dakewe Biotech Corporation. All Rights Reserved. # 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...
[ "torch.utils.data.DataLoader" ]
1.9.0
peaceofmind123/esrgan_modified
33a0f2478185eff90a7233b968b7901f7cf3a04a
1.5
"""Extra generative modeling benchmark datasets not provided by PyTorch.""" import os import urllib import PIL import numpy as np import torch from torch.utils import data from torchvision.datasets import utils from torchvision.datasets import vision def _read_image_file(path, shape): with open(path, 'rb') as f: ...
[ "torch.save", "torch.from_numpy" ]
1.5.1
eyalbetzalel/pytorch-generative-1
d491fa0a8ab37ad3b8aa1092b24ff7d863c9fbd8
1.0
# ***************************************************************************** # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions...
[ "torch.cuda.manual_seed", "torch.arange", "torch.max", "torch.manual_seed", "torch.utils.data.DataLoader", "torch.utils.data.distributed.DistributedSampler", "torch.load" ]
1.0
dodohow1011/waveglow
53d9883a73f7f0569b25eb665788ca59368f9413
1.8
import math import random import torch class KMeans: """Test""" def __init__(self, k: int, distance_fn=None, dim_size: int = 2, nstart: int = 2): # TODO use nstart assert distance_fn is not None, "please provide a distance function" self._params = torch.empty(k, dim_size, dtype=torc...
[ "torch.zeros", "torch.empty", "torch.argmin" ]
1.8.1
mdornseif/fastface
72772db1fae4af17e829cd5479c4848fe5eb8948
1.9
#!/usr/bin/env python3 import torch from torch.fft import fft, ifft from ..utils import broadcasting def toeplitz(toeplitz_column, toeplitz_row): """ Constructs tensor version of toeplitz matrix from column vector Args: - toeplitz_column (vector n) - column of toeplitz matrix - toeplitz_...
[ "torch.zeros", "torch.fft.ifft", "torch.fft.fft", "torch.zeros_like", "torch.equal", "torch.flip" ]
1.9
llguo95/gpytorch
1fa69935104565c377ce95d2c581c9eedfb55817
1.9
#!/usr/bin/env python3 import torch from ..utils.broadcasting import _pad_with_singletons from ..utils.getitem import _noop_index from .block_lazy_tensor import BlockLazyTensor class SumBatchLazyTensor(BlockLazyTensor): """ Represents a lazy tensor that is actually the sum of several lazy tensors blocks. ...
[ "torch.Size" ]
1.9
llguo95/gpytorch
1fa69935104565c377ce95d2c581c9eedfb55817
1.10
import os import torch import colossalai def ensure_divisibility(numerator, denominator): """Ensure that numerator is divisible by the denominator.""" assert numerator % denominator == 0, '{} is not divisible by {}'.format(numerator, denominator) def set_missing_distributed_environ(key, value): if key ...
[ "torch.distributed.is_initialized" ]
1.10
hpcaitech/FastFold
a65d5009279ef84c1518081344db5c02213c387a
1.4
import math from typing import List, Optional, Tuple import torch __all__ = ["Emformer"] def _lengths_to_padding_mask(lengths: torch.Tensor) -> torch.Tensor: batch_size = lengths.shape[0] max_length = int(torch.max(lengths).item()) padding_mask = torch.arange( max_length, device=lengths.device,...
[ "torch.nn.Linear", "torch.zeros", "torch.cat", "torch.nn.Dropout", "torch.nn.AvgPool1d", "torch.nn.LayerNorm", "torch.arange", "torch.max", "torch.nn.SiLU", "torch.nn.init.xavier_uniform_", "torch.bmm", "torch.clamp", "torch.nn.ReLU", "torch.ones", "torch.empty", "torch.nn.functional.s...
1.4.0
videodanchik/audio
c22962d125e929dd8d4c171e76f5aa48baac3d49
1.3
#!/usr/bin/env python3 import os import sys import torch sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from core.logger import Logger from core.filter.zfilter import ZFilter from core.algorithm.mcpo import mcpo_step from core.agent import Agent_sync as Agent from core.model import Po...
[ "torch.cat", "torch.sqrt", "torch.multiprocessing.set_start_method" ]
1.3.0
id9502/RLFrame
a6fe99c6578e74f74767720b9212365e10f0cefd
1.3
######################## # Importing libraries ######################## # System libraries import os import random from time import gmtime, strftime import numpy as np import pickle # Tensorboard for PyTorch logging and visualization from torch.utils.tensorboard import SummaryWriter # Torch libraries import torch imp...
[ "torch.cuda.is_available", "torch.load", "torch.utils.tensorboard.SummaryWriter", "torch.nn.DataParallel" ]
1.3.1
MrtnMndt/OCDVAEContinualLearning
2c5f778dc7f94ff696b923a84246a56c391a8eff
0.4
import numpy as np import torch.nn as nn from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD from timm.models.helpers import build_model_with_cfg from timm.models.layers import ClassifierHead, AvgPool2dSame, ConvBnAct, SEModule, DropPath def _mcfg(**kwargs): cfg = dict( se_ratio=0., ...
[ "torch.nn.Identity", "torch.nn.init.kaiming_normal_", "torch.nn.init.ones_", "torch.nn.init.normal_", "torch.nn.init.zeros_", "torch.randn" ]
0.4.0
sahilparekh/imgclsmob
74d52457b4bf00c82d063b3f4a1a73fb6ba3863a
1.7
import numpy as np import torch import torch.nn as nn from torch.autograd import Variable from .helper import * ############################################################################### # Functions ############################################################################### def define_G( input_nc, ou...
[ "torch.nn.Dropout", "torch.nn.MSELoss", "torch.nn.ReplicationPad2d", "torch.nn.Sequential", "torch.nn.AvgPool2d", "torch.nn.Tanh", "torch.autograd.Variable", "torch.nn.ConvTranspose2d", "torch.nn.LeakyReLU", "torch.nn.Sigmoid", "torch.nn.L1Loss", "torch.nn.ReLU", "torch.nn.Conv2d", "torch....
1.7.1
bruceli-rw0/edge2pic-generation
e9ee6f89361d1a12b044c0ab665a09fca4a47089
1.2
from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler import numpy as np import networkx as nx import random import pickle as pk import torch import torch.nn.functional as F class Node: def __init__(self, node, embedding, features, walk): self.node = node self.embedding = embedding self.feature...
[ "torch.utils.data.SubsetRandomSampler", "torch.tensor", "torch.utils.data.DataLoader" ]
1.2.0
ggapp1/microinfl-instagram
e3fefbc09f9ee1bc5010618ccae647e4d763f503
1.8
import numpy as np import torch from torch import nn import os ## Network functions # Model class Net(nn.Module): """ A class for a deep neural net architecture. Parameters ---------- in_dim: int Input dimension. out_dim: int Output dimension. hidden_size: int, default ...
[ "torch.nn.Linear", "torch.nn.ModuleList", "torch.nn.Sequential", "torch.nn.ReLU", "torch.nn.BatchNorm1d", "torch.nn.BCEWithLogitsLoss" ]
1.8.1
rflperry/double_descent
5001613791b3bbfa77c86f8426458253e8989bea
1.3
''' DQN agent The code is derived from https://github.com/dennybritz/reinforcement-learning/blob/master/DQN/dqn.py Copyright (c) 2019 Matthew Judell Copyright (c) 2019 DATA Lab at Texas A&M University Copyright (c) 2016 Denny Britz Permission is hereby granted, free of charge, to any person obtaining a copy of this ...
[ "torch.nn.Linear", "torch.cuda.is_available", "torch.nn.Flatten", "torch.nn.Sequential", "torch.nn.Tanh", "torch.nn.MSELoss", "torch.no_grad", "torch.nn.init.xavier_uniform_", "torch.from_numpy", "torch.nn.BatchNorm1d" ]
1.3
cogitoergoread/muszi-macrohard.hu
e9bbd36b789e670f96622a3a2ba8327f0d897561
1.4
#!/usr/bin/env python """ Translator Class and builder """ from __future__ import print_function import codecs import os import time import numpy as np from itertools import count, zip_longest import torch import onmt.model_builder import onmt.inputters as inputters import onmt.decoders.ensemble from onmt.translate.b...
[ "torch.device", "torch.cat", "torch.Tensor", "torch.no_grad" ]
1.4.0
GarrettNicolai/OpenNMT-py
9491d900ac1b50fe39da417bacc0b9d610331888
1.1
import numpy as np from scipy.misc import imsave import os import torch import torch.nn as nn import torch.optim as optim import torch.nn.init as init import torch.nn.functional as F import torchvision from torchvision import models from torch.autograd import Variable from torch.utils.data import DataLoader import tor...
[ "torch.zeros", "torch.nn.MSELoss", "torch.autograd.Variable", "torch.ones", "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.nn.BCELoss", "torch.load" ]
1.1.0
JinGyeSetBirdsFree/FudanOCR
fd79b679044ea23fd9eb30691453ed0805d2e98b
1.1
from roi_align.roi_align import RoIAlign # RoIAlign module from roi_align.roi_align import CropAndResize # crop_and_resize module from torchvision import transforms import torch import cv2 import numpy as np from torch.autograd import Variable def to_varabile(data,requires_grad,is_cuda): if is_cuda: d...
[ "torch.IntTensor", "torch.autograd.Variable", "torch.from_numpy", "torch.cuda.is_available", "torch.Tensor" ]
1.1.0
JinGyeSetBirdsFree/FudanOCR
fd79b679044ea23fd9eb30691453ed0805d2e98b
1.8
"""Policies: abstract base class and concrete implementations.""" import collections import copy import warnings from abc import ABC, abstractmethod from functools import partial from typing import Any, Dict, List, Optional, Tuple, Type, Union import gym import numpy as np import torch as th from torch import nn fro...
[ "torch.nn.Linear", "torch.cat", "torch.nn.Sequential", "torch.no_grad", "torch.FloatTensor", "torch.load", "torch.nn.init.orthogonal_", "torch.set_grad_enabled" ]
1.8.1
adbelniak/stable-baselines3
61e3b9c3fc4b113b5de65dd3b083de7550676018
1.1
import numpy as np import os import cv2 from models import Wav2Lip import face_detection import torch def get_smoothened_boxes(boxes, T): for i in range(len(boxes)): if i + T > len(boxes): window = boxes[len(boxes) - T:] else: window = boxes[i: i + T] boxes[i] = np.m...
[ "torch.load" ]
1.1.0
tpulkit/txt2vid
679b1672fb3221c6b5fe576a158974556047c201
1.7
import numpy as np from glumpy import app, gl, glm, gloo import torch import module.gpu_work as gw class mesh(): def __init__(self, motion): # plane self.motion = motion self.N = N = motion.N[:2] self.dx = dx = motion.dx # vertices X = [dx * (np.arange(N[i]) - N[i...
[ "torch.cat" ]
1.7.0
dego1985/wave_simulation
05f5119aab158e0958170d90066c2b87b998e658
1.4
import pickle from collections import OrderedDict from distutils.version import LooseVersion import cloudpickle import numpy as np import pytest import torch from torch import nn from pytorch_lightning.metrics.metric import Metric, MetricCollection torch.manual_seed(42) class Dummy(Metric): name = "Dummy" ...
[ "torch.manual_seed", "torch.cuda.is_available", "torch.tensor" ]
1.4
javierlorenzod/pytorch-lightning
6dba26666aa564db414eb238d99a4213006d8220
1.5
import os import hydra os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]='1' import logging import sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))) from hydra import utils from torch.utils.data import DataLoader from deepke.name_entity_re.few_shot.mode...
[ "torch.utils.data.DataLoader" ]
1.5
hphphp123321/DeepKE
f7efd3fc87d3bf88783a41efc3c09dca7a986013
1.7
import torch import torch.nn as nn def safe_norm(x, eps=1e-5, dim=-1, keepdim=True): return torch.sqrt(torch.sum(torch.square(x), dim=dim, keepdim=keepdim) + eps) class LayerNormTf(nn.Module): def __init__(self, hidden_size: int, eps: float = 1e-12): """Construct a layernorm module in the TF style (...
[ "torch.zeros", "torch.sqrt", "torch.square", "torch.ones", "torch.tensor" ]
1.7.1
PansoK/slp
ac55154f063245e0e4ed584c59f16370d228d8a7
0.4
import os import torch from collections import OrderedDict from abc import ABC, abstractmethod from . import networks class BaseModel(ABC): """This class is an abstract base class (ABC) for models. To create a subclass, you need to implement the following five functions: -- <__init__>: ...
[ "torch.device", "torch.save", "torch.no_grad", "torch.cuda.is_available", "torch.load" ]
0.4.0
herobd/GAN_aug
b240da32d4f3ae9a00a9d395ac8f29728623f6b4