version
stringclasses
25 values
code
stringlengths
75
178k
apis
list
full_version
stringlengths
1
6
repo_name
stringlengths
9
78
hexsha
stringlengths
40
40
1.10
import os import torch import torch.nn as nn import torch.quantization from torch.utils.mobile_optimizer import optimize_for_mobile from openunmix import utils from openunmix import model from openunmix.model import OpenUnmix target_urls_umxhq = { "bass": "https://zenodo.org/api/files/1c8f83c5-33a5-4f59-b109-721f...
[ "torch.jit.script", "torch.quantization.quantize_dynamic", "torch.utils.mobile_optimizer.optimize_for_mobile", "torch.hub.load_state_dict_from_url" ]
1.10.1
demixr/openunmix-torchscript
e0ccb812b6a6e16151e54cb2101372f61eb12c60
1.7
"""Pytorch Dataset object that loads 27x27 patches that contain single cells.""" import os import random import numpy as np import scipy.io import torch import torch.utils.data as data_utils import torchvision.transforms as transforms from skimage import io, color from sklearn.model_selection import KFold import uti...
[ "torch.stack", "torch.LongTensor" ]
1.7.1
apardyl/ProtoPNet
b2bbd7284bfc84a37385c0e975408c68cdf64205
1.0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jul 4 12:32:53 2017 @author: wroscoe """ import os import sys import time import json import datetime import random import tarfile import numpy as np import pandas as pd from PIL import Image from donkeycar import util from ..log import get_logger l...
[ "torch.FloatTensor" ]
1.0.0
0h-n0/donkeycar_pytorch
ed19404ad274ff0228cfa290a8b9d318f8781aad
1.4
# Copyright 2021 The HuggingFace Team. 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 applicabl...
[ "torch.utils.data.graph_settings.apply_shuffle_settings", "torch.Generator", "torch.empty" ]
1.4.0
yuxinyuan/accelerate
450d51ce0191020408bd3481bde85fe1dabaf289
1.8
import warnings from math import sqrt from typing import Iterator, List, Optional, Union, Any import e3nn import torch import torch.fx from e3nn import o3 from e3nn.util import prod from e3nn.util.codegen import CodeGenMixin from e3nn.util.jit import compile_mode from torch import fx from ._codegen import codegen_tens...
[ "torch.zeros", "torch.cat", "torch.no_grad", "torch.ones", "torch.fx.Graph", "torch.jit.is_scripting", "torch.nn.Module", "torch.Tensor", "torch.randn" ]
1.8.0
dmadisetti/e3nn
224ac5a4a4911626a7a04cf408d3f1872e5ff239
1.0
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and the HuggingFace Inc. 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 # # U...
[ "torch.nn.Linear", "torch.einsum", "torch.ones", "torch.nn.BCEWithLogitsLoss", "torch.nn.CrossEntropyLoss", "torch.nn.LayerNorm", "torch.nn.Softmax", "torch.tensor", "torch.zeros", "torch.nn.Tanh", "torch.matmul", "torch.nn.Dropout", "torch.nn.MSELoss", "torch.arange", "torch.from_numpy"...
1.0
luyug/transformers
a59e7c1ed4ef1568ca0ba4140c9af641b17fa37e
1.6
import albumentations as albu import matplotlib.pyplot as plt import numpy as np import torch from torch.autograd import Variable def matplotlib_imshow(img, one_channel=False): if one_channel: img = img.mean(dim=0) img = img / 2 + 0.5 # unnormalize npimg = img.numpy() if one_channel: ...
[ "torch.autograd.Variable" ]
1.6.0
loayghawji/CPM
8d1c1d0e15bba04c0ef06997411a09765f736cfa
1.5
from metric.recall_at_k import RecallAtK from loss.vae_loss import VAELoss from dataloader.mamo_dataset import MamoDataset from validator import Validator from torch.utils.data import DataLoader from models.multi_VAE import MultiVAE import os import numpy as np import pytest import yaml # Packages needed to run test: ...
[ "torch.utils.data.DataLoader" ]
1.5.0
blagojce95/ai-research-mamo-framework
7f3b5a5a9fb8b19c9eef453b81b03b6046a33bf2
1.9
###################################### ## 数据文件夹下LRW文件夹的名字. ## ###################################### LRW1000_DATA_PATH_NAME = '/data/zhangyk/data/CAS-VSR-W1k/audio/LRW1000_Public/audio' LRW1000_AUDIO_DATA_PATH_NAME = '/data/zhangyk/data/lrw1000_audio_pkl' ###################################### import torch from torch....
[ "torch.zeros" ]
1.9.0
ZhangYikaii/Proto-CAT
57bb2c7fd88a9489faa88e3b904218bf5fb01b4e
1.0
import os import math import numpy as np from PIL import Image import skimage.transform as trans import cv2 import torch from data import dataset_info from data.base_dataset import BaseDataset import util.util as util dataset_info = dataset_info() class CasiaDataset(BaseDataset): @staticmethod def modify_comm...
[ "torch.from_numpy" ]
1.0.0
kangzhiq/Rotate-and-Render
e4b0946260f9ece8af7066f2668ee889a1ee9f23
1.4
# coding: utf-8 from itertools import chain, starmap from collections import Counter import torch from torchtext.data import Dataset as TorchtextDataset from torchtext.data import Example from torchtext.vocab import Vocab def _join_dicts(*args): """ Args: dictionaries with disjoint keys. Return...
[ "torch.save", "torch.LongTensor" ]
1.4.0
futuran/OpenNMT-py
0fef19aff6ea839e0684314792d41f7e08d1232d
1.4
import itertools as it from collections import namedtuple from typing import Dict, List, Optional, Union, NamedTuple import torch from torchaudio._torchaudio_decoder import ( _CriterionType, _LM, _KenLM, _LexiconDecoder, _LexiconDecoderOptions, _SmearingMode, _Trie, _Dictionary, _cr...
[ "torch.IntTensor", "torch.full" ]
1.4.0
spital/audio
414f4f774e9b649bf17c523fbd56b2c54c493508
1.8
import argparse import inspect from . import gaussian_diffusion as gd from .respace import SpacedDiffusion, space_timesteps from .unet import SuperResModel, UNetModel, EncoderUNetModel NUM_CLASSES = 1000 def diffusion_defaults(): """ Defaults for image and classifier training. """ return dict( ...
[ "torch.manual_seed", "torch.cuda.manual_seed", "torch.cuda.manual_seed_all" ]
1.8.2
XezXey/guided-diffusion
5e156d0c1135e3432c33e5a5efb382f2095d9a59
1.8
from abc import ABC, abstractmethod import numpy as np from numpy.lib.function_base import diff import torch as th import torch.distributed as dist def create_named_schedule_sampler(name, diffusion): """ Create a ScheduleSampler from a library of pre-defined samplers. :param name: the name of the sample...
[ "torch.zeros", "torch.distributed.get_world_size", "torch.distributed.all_gather", "torch.from_numpy", "torch.tensor" ]
1.8.2
XezXey/guided-diffusion
5e156d0c1135e3432c33e5a5efb382f2095d9a59
1.7
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # Copyright (c) Megvii, Inc. and its affiliates. from loguru import logger import torch import torch.backends.cudnn as cudnn from torch.nn.parallel import DistributedDataParallel as DDP from yolox.core import launch from yolox.exp import get_exp from yolox.ut...
[ "torch.nn.parallel.DistributedDataParallel", "torch.cuda.device_count", "torch.manual_seed", "torch.cuda.set_device", "torch.load" ]
1.7
XHYsdjkdsjsk2021/Yolox_xhy
a60f585d4d2bf36f9fa90b0a078efb7b315e0118
1.4
import colorama import spacy import torch import torch.nn.functional as F from nltk.corpus import stopwords from spacy.pipeline import EntityRuler from spacy.tokens import Token from transformers import GPT2Tokenizer from KID.agent import BaseAgent from KID.agent.agent_utils import calc_banned_ngram_tokens, top_k_filt...
[ "torch.cat", "torch.sum", "torch.multinomial", "torch.nn.functional.softmax", "torch.empty", "torch.topk" ]
1.4.0
microsoft/KID
a23e9d819b53605b6426170124feed10288c6f8b
1.7
import re from typing import Tuple, List, Iterator, Dict, Any import numpy as np from PIL import Image from numpy.core.fromnumeric import resize import tensorflow as tf from tensorflow import keras import tensorflow.keras.applications as tensorflow_models from tensorflow.keras import layers import thingsvision.cor...
[ "torch.nn.Linear", "torch.device", "torch.cat", "torch.unique", "torch.no_grad", "torch.hub.load_state_dict_from_url", "torch.load", "torch.nn.functional.softmax" ]
1.7.1
ViCCo-Group/THINGSvision
27273564631605639287f9b3bd3c57ba8cdb720f
1.4
import argparse import torch import warnings from argformat import StructuredFormatter from .preprocessor import Preprocessor from .tiresias import Tiresias if __name__ == "__main__": ######################################################################## # Parse arguments ...
[ "torch.cuda.is_available" ]
1.4.0
Thijsvanede/Tiresias
b007e19fb1bb5d073001aa156673c9dd382f939a
1.5
import os import json import argparse import math import torch from torch import nn, optim from torch.nn import functional as F from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter import torch.multiprocessing as mp import torch.distributed as dist from apex.parallel import Distribu...
[ "torch.distributed.init_process_group", "torch.no_grad", "torch.multiprocessing.spawn", "torch.cuda.device_count", "torch.manual_seed", "torch.cuda.set_device", "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.utils.data.distributed.DistributedSampler", "torch.utils.tensorboard.Sum...
1.5.1
techthiyanes/vakyansh-tts
b090eb0aa3b36cf19de99902da7caef959dad45b
1.10
"""Utility function for the PPO-based safe explorer. """ import numpy as np import torch import torch.nn as nn from gym.spaces import Box from safe_control_gym.math_and_models.neural_networks import MLP, CNN, RNN, init_ from safe_control_gym.math_and_models.distributions import Normal, Categorical import safe_contro...
[ "torch.min", "torch.nn.Module.__init__", "torch.clamp", "torch.ones", "torch.exp" ]
1.10.2
catgloss/safe-control-gym
b3f69bbed8577f64fc36d23677bf50027e991b2d
1.9
from pathlib import Path from typing import Optional, Dict, List, Type, Any, Union import pytorch_lightning as pl import torch from torch import nn as nn from torchmetrics import Metric from schnetpack.model.base import AtomisticModel __all__ = ["ModelOutput", "AtomisticTask"] class ModelOutput(nn.Module): """...
[ "torch.nn.ModuleDict", "torch.set_grad_enabled", "torch.nn.ModuleList" ]
1.9
sxie22/schnetpack
a421e7c121c7bdb2838fb30f887812110ecfa3c6
1.6
import torch import torch.nn.functional as F from torch import nn from vit_pytorch.vit import ViT from vit_pytorch.t2t import T2TViT from vit_pytorch.efficient import ViT as EfficientViT from einops import rearrange, repeat # helpers def exists(val): return val is not None # classes class DistillMixin: def...
[ "torch.nn.Linear", "torch.cat", "torch.nn.LayerNorm", "torch.no_grad", "torch.nn.functional.log_softmax", "torch.nn.functional.cross_entropy", "torch.nn.functional.softmax", "torch.randn" ]
1.6
zarszz/vit-pytorch
d93cd84ccdb338572fe978c08bd95ca93bee11cc
1.0
import os import torch from torchvision import utils class Visualizer(): def __init__(self, netG, device, out, num_samples=10, num_columns=None, batch_size=100, range=(-1, 1)): self.netG...
[ "torch.no_grad", "torch.cat", "torch.arange" ]
1.0.1
takuhirok/rGAN
6f7a092de5814c662fd17224b3d48bebe7e03c2f
1.2
#!/usr/bin/env python3 from typing import Any, Callable, List, Tuple, Union import torch from torch.nn import Module from captum.log import log_usage from ...._utils.common import _verify_select_column from ...._utils.typing import BaselineType, TensorOrTupleOfTensorsGeneric from ..._utils.attribution import NeuronA...
[ "torch.no_grad" ]
1.2
caraya10/captum
258928905875c18e85a2413b3bb97def1bfb730a
1.6
# Copyright (c) Facebook, Inc. and its affiliates. # MMBTModel, ModalEmbeddings is copied from [1] # as we have internal dependency on transformers v2.3. # These will be removed when we upgrade to package v2.5+. # [1]: https://github.com/huggingface/transformers/blob/master/src/transformers/modeling_mmbt.py # noqa im...
[ "torch.nn.Linear", "torch.zeros", "torch.nn.Dropout", "torch.cat", "torch.arange", "torch.gather", "torch.ones", "torch.jit.is_scripting", "torch.tensor", "torch.nn.CrossEntropyLoss" ]
1.6.0
hahaxun/mmf
6d32c3925ed9bf938e19a071aaa5e72a5cf01ee1
1.7
# -*- coding: utf-8 -*- # Copyright 2021 National Institute of Information and Communication Technology (Raj Dabre) # # 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, i...
[ "torch.cuda.amp.autocast", "torch.distributed.destroy_process_group", "torch.distributed.init_process_group", "torch.save", "torch.no_grad", "torch.multiprocessing.spawn", "torch.nn.parallel.DistributedDataParallel", "torch.ones", "torch.manual_seed", "torch.cuda.set_device", "torch.nn.functiona...
1.7.1
alvations/yanmtt
9da45055e95f6e66faa17306ad79630071b84d9e
1.6
import torch #Nota bene: In training, the average of losses in each batch is returned. #In testing, this is not the case. def loss_enc(z_code, z_code_hat, test): if(test): l_enc = torch.sum((z_code - z_code_hat)**2, dim=(1)) else: l_enc = torch.sum((z_code - z_code_hat)**2, dim=(1))...
[ "torch.abs", "torch.mean", "torch.sum" ]
1.6.0
ErikBertolino/Anomaly-Detection
edd14ccf3015d3bca48bd55b5b0d4aa98c98ff85
1.8
import sys import os import numpy as np import argparse import time import json from pathlib import Path import argparse import os import shutil import sys import numpy as np import torch import random random.seed(42) import torch.nn as nn import torch.optim as optim import torch.utils.data from torch.utils.data imp...
[ "torch.nn.Linear", "torch.load", "torch.nn.CrossEntropyLoss", "torch.nn.AvgPool2d", "torch.utils.data.DataLoader", "torch.nn.Flatten", "torch.device", "torch.save", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.no_grad", "torch.from_numpy", "torch.nn.AdaptiveAvgPool2d" ]
1.8.1
ashlylau/adversarial-robustness-toolbox
0ab24714db39f0d7e428e57f4eb6f9c0d34ca898
1.7
# ################################ # From paper: "End-to-End Waveform Utterance Enhancement for Direct Evaluation # Metrics Optimization by Fully Convolutional Neural Networks", TASLP, 2018 # Authors: Szu-Wei, Fu 2020 # ################################ import torch import torchaudio import numpy as np from sp...
[ "torch.zeros", "torch.min", "torch.max", "torch.square", "torch.norm", "torch.linspace", "torch.sum", "torch.squeeze", "torch.matmul", "torch.mean", "torch.pow" ]
1.7
jafermarq/speechbrain
b640e366dd0daa713ac2d7d19b77fbf7ed38486c
1.7
import os import torch import torch.nn as nn import torch.nn.functional as F from torchsummary import summary class UNet3D(nn.Module): def __init__(self, in_channels, out_channels, interpolate=True, conv_layer_order='cbr', init_ch=16): super(UNet3D, self).__init__() self.no_class = out_c...
[ "torch.cat", "torch.nn.MaxPool3d", "torch.nn.functional.interpolate", "torch.nn.GroupNorm", "torch.nn.ReLU", "torch.nn.Dropout3d", "torch.cuda.is_available", "torch.nn.Conv3d", "torch.nn.BatchNorm3d", "torch.nn.ConvTranspose3d" ]
1.7.1
jeff7021/organseg_dags
2ba7deb90836aaf8e0e35d879fd00b65787bb491
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.is_autocast_enabled", "torch.cuda.is_available", "torch.optim.lr_scheduler.StepLR" ]
1.6
yuvalkirstain/pytorch-lightning
ac1744242104a2f6a46a3d211723e4dbf90ad544
1.7
import os import time import numpy as np import torch import gym import gym_cabworld from algorithms.a2c_model import PolicyNetwork from common.features import clip_state, cut_off_state from common.logging import create_log_folder, get_last_folder from common.logging import Tracker def train_a2c(n_episodes): f...
[ "torch.tensor" ]
1.7.1
nikolim/cablab
1dcf0d7da01ed3988f84309acfb31cc9a9893de1
1.7
import os import numpy as np import sklearn from sklearn import preprocessing import torch from torch.utils.data import Dataset from torch.utils.data.sampler import Sampler from utils import load_w2v_feature import settings import logging logger = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO, f...
[ "torch.FloatTensor" ]
1.7.0
zfjsail/wechat-wow-analysis
9fc678f7931f0eac2e8b326d141b60ca7039eece
0.4
import torch from scipy import optimize import torch.nn.functional as F import math import numpy as np from functools import reduce from collections import OrderedDict def branin(x, a=1., b=5.1/(4.*math.pi**2), c=5./math.pi, r=6., s=10., t=1./(8*math.pi)): # branin function, global min of 0.397887 at # x =...
[ "torch.cos", "torch.from_numpy" ]
0.4.1
gngdb/pytorch-acdc
60044f39b018cfe7190381c08e9adff546c3bc66
1.0
#!/usr/bin/env python """ Translator Class and builder """ from __future__ import print_function import configargparse import codecs import os import math import torch from itertools import count from onmt.utils.misc import tile import onmt.model_builder import onmt.translate.beam import onmt.inputters as inputters ...
[ "torch.zeros", "torch.cat", "torch.arange", "torch.no_grad", "torch.full", "torch.tensor", "torch.div", "torch.ge", "torch.Tensor", "torch.distributions.Multinomial", "torch.topk" ]
1.0
hkhpub/opennmt-hkh
63dceae7f8737a1780e91f2e727c7875ec0ebfdf
1.6
''' Model file and non-differentially private file ''' import time import torch import torch.nn.functional as F from torch import nn, optim import data import utils class EmbeddingNet(nn.Module): def __init__(self, vocab_size: int, **_): super().__init__() # Embedding dimension: vocab_size + <un...
[ "torch.nn.Linear", "torch.nn.functional.sigmoid", "torch.nn.LSTM", "torch.nn.AvgPool2d", "torch.nn.CrossEntropyLoss", "torch.from_numpy", "torch.nn.ReLU", "torch.mean", "torch.nn.Conv2d", "torch.nn.BCELoss", "torch.nn.functional.relu", "torch.nn.functional.max_pool2d", "torch.nn.Embedding" ]
1.6.0
jessijzhao/fast-dpsgd
143370bd1a11076a461e1d06e235db9b1d6b5de5
1.6
from math import ceil import torch from torch import nn, einsum import torch.nn.functional as F from einops import rearrange, repeat from einops.layers.torch import Rearrange # helpers def exists(val): return val is not None def default(val, d): return val if exists(val) else d def cast_tuple(val, l = 3):...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.nn.AdaptiveAvgPool2d", "torch.arange", "torch.nn.ModuleList", "torch.einsum", "torch.nn.Softmax", "torch.nn.Sequential", "torch.nn.BatchNorm2d", "torch.nn.Conv2d", "torch.meshgrid", "torch.nn.GELU", "torch.nn.Embedding" ]
1.6
jhvics1/vit-pytorch
bad4b94e7b4baa544ca36149431f7912eccd4b49
1.7
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # Copyright (c) Megvii, Inc. and its affiliates. import argparse import random import warnings from loguru import logger import os import torch import torch.backends.cudnn as cudnn from yolox.core import Trainer, launch from yolox.exp import get_exp from yolox.utils impor...
[ "torch.manual_seed", "torch.cuda.device_count" ]
1.7
1298998/YOLOX-train-your-data
be50386e5cab7614924796bf6b6bde581d14d4aa
1.2
from typing import Dict, Any import torch from allennlp.training.optimizers import Optimizer from allennlp.common.testing import AllenNlpTestCase from allennlp.training.learning_rate_schedulers import LearningRateScheduler from allennlp.common.params import Params class CosineWithRestartsTest(AllenNlpTestCase): ...
[ "torch.nn.Linear" ]
1.2.0
avinashsai/allennlp
6da30e9d53bd2c8199848addc78ff0e29d79b542
1.9
from torch import nn from src.retrieval_core.models.pooling.GeM import GeM class PoolFactory(nn.Module): def __init__(self, pool='max'): super(PoolFactory, self).__init__() pool_type = { 'avg': nn.AdaptiveAvgPool2d(1), 'max': nn.AdaptiveMaxPool2d(1), 'gem': GeM...
[ "torch.nn.AdaptiveAvgPool2d", "torch.nn.AdaptiveMaxPool2d" ]
1.9.0
RImbriaco/OML
4998cdebc3ac553ccd53b4caacf24d8c3d8fc07b
1.4
import torch.nn as nn from models.blocks import GlobalAvgPool2d class _VanillaConvBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size): super(_VanillaConvBlock, self).__init__() self._block = nn.Sequential( nn.Conv2d(in_channels, out_channels, kernel_size, str...
[ "torch.nn.Softmax", "torch.nn.MaxPool2d", "torch.nn.Sequential", "torch.nn.BatchNorm2d", "torch.nn.ReLU", "torch.nn.Conv2d" ]
1.4.0
mamaheux/pytorch-exemple-calcul-canada
41bd1769aaf30bd3786589bd3e3252bb115fdd69
1.4
import torch import torch.nn as nn import torch.nn.functional as F from transformers import BertModel from .layer import AttentionLayer as AL, GlobalAttentionLayer as GoAL, \ StructAttentionLayer as SAL, ResAttentionLayer as RAL, ContAttentionLayer as CAL from .dataset import get_lm_path class TranHGAT(nn.Module...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.cat", "torch.stack", "torch.nn.Softmax", "torch.no_grad", "torch.matmul" ]
1.4.0
CGCL-codes/HierGAT
df0353e589a00b2b9ac6c8eae87396233fe850ee
1.5
import os import numpy as np import pandas as pd import torch from torch.utils.data.dataset import Dataset from PIL import Image, ImageFilter from Utils import utils import random import posixpath def get_list_from_filenames(file_path): # input: relative path to .txt file with file names # output: lis...
[ "torch.FloatTensor", "torch.LongTensor" ]
1.5.0
noamzilo/deep-head-pose
31969b8cbeeea5423ab7d326945f7871c5aed57e
0.4
# Copyright 2019 Uber Technologies, Inc. All Rights Reserved. # Modifications copyright Microsoft # # 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/LICENS...
[ "torch.IntTensor", "torch.is_tensor", "torch.cuda.is_available", "torch.zeros_like", "torch.Tensor" ]
0.4.0
pragupta/horovod
7d7a9df9ffb77a121030207f1659ec6c9afaa8ed
1.1
import numpy as np import torch from bonsai.pruning.abstract_pruners import WeightBasedPruner, ActivationBasedPruner, GradBasedPruner class WeightL2Prunner(WeightBasedPruner): @staticmethod def compute_single_layer_ranks(module, *args, **kwargs): size = module.weights.size() weights = module...
[ "torch.mean", "torch.sum" ]
1.1.0
ItamarWilf/pytorch-bonsai
d8091cfa731d5168ce9a0a1d98e555f7d1364244
0.4
#!/usr/bin/env python # Copyright 2018 Division of Medical Image Computing, German Cancer Research Center (DKFZ). # # 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...
[ "torch.nn.functional.softmax", "torch.from_numpy" ]
0.4.1
zhouyuegithub/medicaldetectiontoolkit
283121228ab6012f3369c0a649c0e1aeae492283
1.6
import functools import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import segmentation_models_pytorch as smp import utils class FCN(nn.Module): def __init__(self, num_input_channels, num_output_classes, num_filters=64): super(FCN, self).__init__() self.con...
[ "torch.nn.Conv2d" ]
1.6.0
baoqianyue/DFC2021-Track-MSD
d707f7601c6caa0d0f0e6013d493e66059d23d49
1.1
import argparse import glob import numpy as np import os import torch import constants as c def get_best_epoch_cell(ckpt_path, cell_type): model_ckpt = torch.load(ckpt_path) loss_history = model_ckpt['loss'] acc_history = model_ckpt['acc'] pp_acc_history = model_ckpt['pp_acc'] best_epoch = -1 ...
[ "torch.load" ]
1.1.0
ChihHsuLin/cellular_image_classification
5ea81b4a0f42d17ecb95c41ff4349ef610841394
0.6
import torch class Decoder(torch.nn.Module): # TODO: support learnable fusion modules def __init__(self): super().__init__() self.FUSION_DIC = {"2to1_fusion": ["sum", "diff", "abs_diff"], "2to2_fusion": ["concat"]} def fusion(self, x1, x2, fusion_form="concat"):...
[ "torch.abs", "torch.cat" ]
0.6.3
yjt2018/change_detection.pytorch
cbd6150708eeddbd66e30e311f2482d43334b738
1.10
import torch from cape import CAPE2d def test_cape2d(): pos_emb = CAPE2d(d_model=512, max_global_shift=0.0, max_local_shift=0.0, max_global_scaling=1.0, batch_first=False) print("Checking correct dimensionality input/output (16x16) for batch_size = False...") exp_shape = (16, 16, 32, ...
[ "torch.zeros", "torch.linspace", "torch.randn" ]
1.10.0
gcambara/cape
c18c3c5e33f24a85506f30c399bf88b45f8a1787
0.7
import numpy as np import random import os import time import importlib import cv2 from PIL import Image import math import pickle import torch from torch import distributed as dist from torch.utils.data.sampler import Sampler def load_module(module_type, module_name): m = importlib.import_module(f'{module_typ...
[ "torch.distributed.get_world_size", "torch.cat", "torch.utils.data.RandomSampler", "torch.stack", "torch.distributed.reduce", "torch.sum", "torch.is_tensor", "torch.FloatTensor", "torch.manual_seed", "torch.distributed.is_initialized", "torch.distributed.get_rank", "torch.set_num_threads", "...
0.7.0
saic-vul/style-people
a48418ace25b99a50801a54a9e282cd986c305ba
1.11
""" libraries """ import os import gc import re import ast import sys import copy import json import time import math import string import pickle import random import joblib import itertools import warnings from IPython.core.display_functions import display import scipy as sp import numpy as np import pandas as pd from...
[ "torch.cuda.is_available" ]
1.11.0
mkingopng/NBME_score_clinical_patient_notes
4ca9816be2665d7585ab0d168376a340aa800088
1.3
from functools import reduce import torch import torch.nn.functional as F from .td import generalized_lambda_returns from ding.hpc_rl import hpc_wrapper def tb_cross_entropy(logit, label, mask=None): assert (len(label.shape) >= 2) T, B = label.shape[:2] # Special 2D case if len(label.shape) > 2: ...
[ "torch.no_grad", "torch.nn.functional.cross_entropy", "torch.ones_like" ]
1.3.1
uuid0000/DI-engine
cc2713fa01e5288bae21cfeb595729d665e092d1
1.4
import torch import os from PIL import Image from xml.dom.minidom import parse import numpy as np import utilities.transforms as T class FacialDataset(object): def __init__(self, root, transforms, train=True): self.root = root self.transforms = transforms # load all image files, sorting th...
[ "torch.as_tensor", "torch.tensor" ]
1.4.0
jerinka/traffic_sign_frcnn
3a6cd77af965ea88de61d6718a4f539f58b46a13
1.5
from PIL import Image import requests import matplotlib.pyplot as plt import torch from torch import nn from torchvision.models import resnet50 import torchvision.transforms as T torch.set_grad_enabled(False); import gradio as gr import io model = torch.hub.load('facebookresearch/detr', 'detr_resnet50', pretrained=Tru...
[ "torch.stack", "torch.tensor", "torch.set_grad_enabled", "torch.hub.load" ]
1.5.0
AK391/detr
112396eec6b70b6bd1bb180d91c6e3b0e391cdc6
1.1
""" The trainer handles all the logic for running a val loop, training loop, distributing, etc.. . """ import os import sys import warnings import logging import torch import torch.distributed as dist import torch.multiprocessing as mp import tqdm from torch.optim.optimizer import Optimizer from pytorch_lightning.tr...
[ "torch.multiprocessing.spawn", "torch.cuda.current_device", "torch.cuda.device_count", "torch.cuda.empty_cache", "torch.cuda.is_available", "torch.distributed.barrier" ]
1.1
YehCF/pytorch-lightning
6666ca5af39aa2d3e5a483da3d7f6bb76514cc9f
1.6
import torch from torch.utils.data import Dataset from .data_utils import get_tokenizer, natural_sort, skip, FixedSizeOrderedDict import random import glob import tensorflow as tf import re import logging from itertools import cycle import os import subprocess import simdjson as json import hub class HubAdapter(torch....
[ "torch.tensor" ]
1.6
raijinspecial/gpt-neox
89749e0b76938fa1ff84a3dd1cbcbe64521d861b
1.0
import json import argparse import os import time import torch import numpy as np from scipy.spatial.distance import cosine from sklearn.preprocessing import scale from sklearn.linear_model import LogisticRegression import chart_studio import chart_studio.plotly as py import plotly.io as pio import plotly.graph_obje...
[ "torch.load" ]
1.0
MGheini/unify-parameter-efficient-tuning
3222ce2c0079566a28043e22380eb4ab6ad14389
1.9
import torch.nn as nn from torch.autograd import Variable from collections import defaultdict from .layers.PRM import Residual as ResidualPyramid from .layers.Residual import Residual as Residual from common.arguments import sppe_args opt = sppe_args() class Hourglass(nn.Module): def __init__(self, n, nFeats, ...
[ "torch.nn.MaxPool2d", "torch.nn.Sequential", "torch.nn.BatchNorm2d", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.nn.UpsamplingNearest2d" ]
1.9.0
fsImageries/video-to-pose3D
098c87ce19dc3331da03e6eac0b9744684eb66f6
1.6
from typing import Iterable, Dict, List import torch from einops import rearrange, repeat from torch import Tensor from torch import nn from torch.nn import Identity from perceiver_pytorch.caching import cache_by_name_fn from perceiver_pytorch.modalities import InputModality, modality_encoding from perceiver_pytorch....
[ "torch.nn.Linear", "torch.zeros", "torch.cat", "torch.nn.LayerNorm", "torch.nn.Identity", "torch.nn.ModuleList", "torch.linspace", "torch.meshgrid", "torch.randn" ]
1.6
frenkiboy/perceiver-pytorch
b07d5154c5dee63684c59f57d02a1b405701845f
1.0
# coding=utf-8 # Copyright 2020 The HuggingFace Team. 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 requir...
[ "torch.Size", "torch.allclose", "torch.tensor" ]
1.0
liminghao1630/transformers
207594be81b8e5a8589c8b11c3b236924555d806
1.0
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, 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 cop...
[ "torch.from_numpy", "torch.load" ]
1.0
liminghao1630/transformers
207594be81b8e5a8589c8b11c3b236924555d806
3
import torch import torch.nn as nn import torch.nn.functional as F import neural_renderer as nr import numpy as np import cv2 class DepthRenderer(nn.Module): def __init__(self, cfg): super(DepthRenderer, self).__init__() min_depth = cfg.MODEL.MVSNET.MIN_DEPTH max_depth = min_depth + (cfg....
[ "torch.zeros", "torch.inverse", "torch.bmm", "torch.from_numpy", "torch.tensor" ]
3
rakeshshrestha31/meshmvs
e82cf0121ae49dd781d87d172218f41a882e3c04
0.3
import argparse import sys import time import math import torch.nn as nn import torch.optim as optim from drnn import DRNN from char_rnn.utils import * from char_rnn.model import DRNN_Char import warnings warnings.filterwarnings("ignore") # Suppress the RunTimeWarning on unicode parser = argparse.ArgumentParser...
[ "torch.nn.CrossEntropyLoss" ]
0.3.0
dnbaker/pytorch-dilated-rnn
4d7e04bf00d2f144c4435cb7ad78ecee7de81dd1
1.7
import copy import numpy as np import scipy.linalg import scipy.stats import torch from matplotlib import pyplot as plt # from ray import tune # from ray.tune.suggest import ConcurrencyLimiter # from ray.tune.suggest.hyperopt import HyperOptSearch # import tqdm from torch import nn from torch.nn import functional as ...
[ "torch.nn.Linear", "torch.cat", "torch.nn.Parameter", "torch.ones", "torch.sum", "torch.randint", "torch.tensor", "torch.zeros", "torch.nn.ReLU", "torch.nn.functional.binary_cross_entropy", "torch.rand", "torch.nn.Sigmoid", "torch.diag", "torch.randn" ]
1.7.1
stewy33/Learning-to-Optimize
b5e6fd008f12d0b702d861f6d6a99b773fd7c024
0.4
from __future__ import print_function import torch import torch.nn as nn from torch.nn import init import functools from torch.optim import lr_scheduler import torch.nn.functional as F import torch.optim as optim from PIL import Image import matplotlib.pyplot as plt from .losses import ContentLoss, StyleLoss, Norma...
[ "torch.optim.lr_scheduler.StepLR", "torch.optim.lr_scheduler.CosineAnnealingLR", "torch.nn.LeakyReLU", "torch.nn.init.kaiming_normal_", "torch.cuda.is_available", "torch.nn.BCEWithLogitsLoss", "torch.nn.DataParallel", "torch.nn.init.constant_", "torch.nn.ConvTranspose2d", "torch.nn.init.normal_", ...
0.4.1
akgokce/EndoL2H
da012dbf3a907000fc469c738976e8905d1dd423
1.5
"""Tools to ease model training (like torch.ignite)""" import torch import torch.nn.functional as F from torch.optim.lr_scheduler import ReduceLROnPlateau from nitorch.core.utils import benchmark, fold, unfold, rubiks_shuffle from nitorch.core.py import make_tuple from nitorch.nn.modules import Module from nitorch.nn ...
[ "torch.ones", "torch.cuda.is_available", "torch.load", "torch.nn.CrossEntropyLoss", "torch.get_rng_state", "torch.cuda.set_rng_state", "torch.random.manual_seed", "torch.autograd.grad", "torch.as_tensor", "torch.utils.tensorboard.SummaryWriter", "torch.random.initial_seed", "torch.device", "...
1.5
liamchalcroft/nitorch
0de179aff97244a82213c528f0d6393725c868c9
1.7
import os import json import torch import numpy as np from pointnetae.config import * class SceneDataset(torch.utils.data.Dataset): def __init__( self, data_source, max_num_points, load_ram=False, is_testing=False, ): self.data_source = data_source self.l...
[ "torch.Tensor" ]
1.7.1
AdamWang00/pointnet.pytorch
b92c3916cf9f84c35861790e8d9cdc6170a9afd5
1.3
import random import warnings from collections import OrderedDict from functools import wraps from typing import Any, Callable, Generator, Iterator, List, Optional import torch from torch.utils.data import DataLoader from torch.utils.data.sampler import BatchSampler from ignite.engine.engine import Engine from ignite...
[ "torch.get_rng_state", "torch.cuda.is_available", "torch.set_rng_state" ]
1.3
01-vyom/ignite
6954817abaa03b9be0f3a18b262058e1e8dd8fbe
1.7
import time import logging import warnings import psutil from signal import signal, SIGINT from py3nvml.py3nvml import * from typing import Dict, Optional from kge import Config, Dataset from kge.distributed.parameter_server import init_torch_server, init_lapse_scheduler from kge.distributed.worker_process import Work...
[ "torch.multiprocessing.Process", "torch.multiprocessing.set_sharing_strategy" ]
1.7.1
uma-pi1/dist-kge
ccc93e7981c09a0499f2267f37886660896d8f72
1.1
import bisect import gc import glob import random import torch from others.logging import logger class Batch(object): def _pad(self, data, pad_id, width=-1): if (width == -1): width = max(len(d) for d in data) rtn_data = [d + [pad_id] * (width - len(d)) for d in data] return...
[ "torch.load" ]
1.1.0
thenghiapham/PreSumm
7bc537b656dc43898474c99b906e02f65b98c975
1.6
import os import torch from detecto.core import Model, Dataset from detecto.utils import xml_to_csv, read_image def get_dataset(**kwargs): path = os.path.dirname(__file__) input_folder = os.path.join(path, 'static') labels_path = os.path.join(path, 'static/labels.csv') xml_to_csv(input_folder, label...
[ "torch.empty" ]
1.6.0
erjiang/detecto
673bee8c0522e8cd18edce1602c2fd061bb27e14
1.11
# -*- coding: utf-8 -*- import torch class Config: ''' Chatbot模型参数 ''' corpus_data_path = 'corpus.pth' #已处理的对话数据 use_QA_first = True #是否载入知识库 max_input_length = 100 #输入的最大句子长度 max_generate_length = 300 #生成的最大句子长度 prefix = 'checkpoints/chatbot' #模型断点路径前缀 model_ck...
[ "torch.device", "torch.cuda.is_available" ]
1.11.0
scyq/CapstoneNetwork
e4c888f2a6b1951794687657f86cd84cb006c2a3
1.10
import torch from ...dataset import SequenceBatch from ._abstract import ImportanceMeasureModule class InputTimesGradientImportanceMeasure(ImportanceMeasureModule): def forward(self, batch: SequenceBatch) -> torch.Tensor: # Prepear a compact embedding matrix for doing sum(x * dy/dz @ W.T) efficently. ...
[ "torch.abs", "torch.autograd.grad", "torch.no_grad" ]
1.10.0
AndreasMadsen/nlp-roar-interpretability
ad30f756cd744dfb05d1b57de744c5ff60d9f20c
1.8
from typing import Any, List import numpy as np import torch.nn import torch from cptr_model.config.config import Config from cptr_model.config.specifics.cptr.architecture_config_file_manager import ArchitectureConfigFileManager from cptr_model.embeddings.position.base_position_embedding import BasePositionEmbedding ...
[ "torch.cos", "torch.device", "torch.sin", "torch.FloatTensor" ]
1.8.0
jsoft88/cptr-vision-transformer
c1728792e3a1b14805ad2489efcd869677c380d7
1.8
# Copyright (c) Meta Platforms, Inc import math from typing import Optional, Sequence, Tuple import torch import torch.nn.functional as F from flowtorch.bijectors.fixed import Fixed class LeakyReLU(Fixed): # TODO: Setting the slope of Leaky ReLU as __init__ argument def _forward( self, x: torch.Ten...
[ "torch.zeros_like", "torch.ones_like", "torch.nn.functional.leaky_relu" ]
1.8.1
vmoens/flowtorch
499273172dc64b68dd41d06ace935bd6ee970fe4
1.2
import torch import torch.nn as nn import torch.nn.functional as F class BaseNetwork(nn.Module): def __init__(self): super(BaseNetwork, self).__init__() def init_weights(self, init_type='normal', gain=0.02): ''' initialize network's weights init_type: normal | xavier | kaiming...
[ "torch.sigmoid", "torch.nn.init.constant_", "torch.nn.Sequential", "torch.nn.init.orthogonal_", "torch.nn.LeakyReLU", "torch.nn.ConvTranspose2d", "torch.nn.init.kaiming_normal_", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.nn.init.normal_", "torch.nn.ReflectionPad2d", "torch.nn.utils.spectral_n...
1.2.0
Larry-u/JAFPro
10e5ee3b77bcdb103709c08c3e7d033396bab5ba
1.7
#!/usr/bin/env python3 import unittest import torch from gpytorch.lazy import RootLazyTensor from gpytorch.test.lazy_tensor_test_case import LazyTensorTestCase class TestRootLazyTensor(LazyTensorTestCase, unittest.TestCase): seed = 0 should_test_sample = True should_call_lanczos = False should_call...
[ "torch.eye", "torch.randn" ]
1.7
qingfeng10/gpytorch
4d33fbf64594aab2dd6e0cfcb3242510231b3e0e
1.1
import numpy as np import torch import torch.nn as nn from mmcv.cnn import kaiming_init, normal_init from torch.nn.modules.utils import _pair import torch.nn.functional as F from mmdet.core import force_fp32 from ..builder import build_loss from ..registry import HEADS from ..utils import ConvModule import mmcv @HEA...
[ "torch.zeros", "torch.cat", "torch.nn.ModuleList", "torch.nn.MaxPool2d", "torch.nn.functional.interpolate", "torch.nn.ReLU", "torch.nn.Conv2d" ]
1.1
Gitgigabyte/mmd
02cf37884d3ac9a6018656d1871695669966dfb3
1.8
from torch import nn, Tensor class Classifier(nn.Module): """ Simple model with linear layers for mnist """ def __init__(self): super(Classifier, self).__init__() self.fc1 = nn.Linear(784, 512) self.relu1 = nn.LeakyReLU(negative_slope=0.1) self.drop1 = nn.Dropout(p=0.5...
[ "torch.nn.Linear", "torch.nn.LeakyReLU", "torch.nn.Dropout" ]
1.8.1
stefansturlu/FederatedMedical
d753acda850e0d8cf64fc1d5c19e7018494bc16a
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._C._log_api_usage_once", "torch.no_grad", "torch.jit.save", "torch.onnx.export" ]
1.4
lillekemiker/pytorch-lightning
6104a6316afb8cdd9825d77844db456ffa766ca1
1.4
import time from typing import Optional import torch from falkon.options import ConjugateGradientOptions, FalkonOptions from falkon.mmv_ops.fmmv_incore import incore_fdmmv, incore_fmmv from falkon.utils.tensor_helpers import copy_same_stride, create_same_stride from falkon.utils import TicToc # More readable 'pseudo...
[ "torch.cuda.synchronize", "torch.cuda.device", "torch.cuda.stream", "torch.diag", "torch.cuda.Stream", "torch.sum" ]
1.4
gpleiss/falkon
36aa6713aff8ee6b9ad922d48b07c994fce30559
1.4
import torch import torch.nn as nn import pdb class Cumulative_Probability_Layer(nn.Module): def __init__(self, num_features, args, max_followup): super(Cumulative_Probability_Layer, self).__init__() self.args = args self.hazard_fc = nn.Linear(num_features, max_followup) self.bas...
[ "torch.nn.Linear", "torch.tril", "torch.ones", "torch.nn.ReLU", "torch.t", "torch.sum" ]
1.4.0
harrivle/Mirai
70413de690da36c5878e2e6006711476e166bb1d
1.8
# This app is for educational purpose only. Insights gained is not financial advice. Use at your own risk! import streamlit as st from PIL import Image import pandas as pd import base64 import matplotlib.pyplot as plt from bs4 import BeautifulSoup import requests import json import time import tweepy import datetime fr...
[ "torch.device", "torch.sigmoid", "torch.tensor" ]
1.8.1
sgich/HateSpeechDetection
e6e0dd2ca6956cdb496232196ef292b97e96eb04
1.7
import argparse import os from tqdm import tqdm from datetime import datetime import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data as data from torch.utils.tensorboard import SummaryWriter import deepab from deepab.models.AbResNet import AbResNet, load_model from deepab.models.Pai...
[ "torch.zeros", "torch.device", "torch.save", "torch.no_grad", "torch.manual_seed", "torch.nn.functional.cross_entropy", "torch.cuda.is_available", "torch.tensor", "torch.utils.data.DataLoader", "torch.optim.lr_scheduler.ReduceLROnPlateau", "torch.load", "torch.exp" ]
1.7.1
nsridhar1/DeepAb
659bad092e1b56ec9f056d9c031900990436200c
1.8
from data.data_loader import Dataset_ETT_hour, Dataset_ETT_minute, Dataset_Custom, Dataset_Pred from data.edf_loader import EdfDataset from data.sample_loader import SampleDataset from exp.exp_basic import Exp_Basic from models.model import Informer, InformerStack from utils.tools import EarlyStopping, adjust_learning...
[ "torch.zeros", "torch.cat", "torch.cuda.amp.autocast", "torch.nn.MSELoss", "torch.ones", "torch.utils.data.DataLoader", "torch.load", "torch.cuda.amp.GradScaler", "torch.nn.DataParallel" ]
1.8.0
kimjimong/Informer2020
1466bea980552ca65468f10d53bef8506935f315
1.1
import torch from torch import nn from torch import autograd from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence class SeqToLangModel(nn.Module): def __init__(self, num_of_ngrams, output_size, hidden_size, embedding_dim): super().__init__() self.chars_embedding = nn.Embedding...
[ "torch.nn.Linear", "torch.cat", "torch.nn.LSTM", "torch.nn.utils.rnn.pad_packed_sequence", "torch.cuda.is_available", "torch.nn.utils.rnn.pack_padded_sequence", "torch.nn.Embedding" ]
1.1.0
abdelrahman0110/task
2956dc96f51b3fb3d691d0f8bbad9d9bfdeb6078
1.4
import tqdm import pytest import numpy as np from torch.utils.tensorboard import SummaryWriter from tianshou.policy import BasePolicy from tianshou.env import DummyVectorEnv, SubprocVectorEnv from tianshou.data import Batch, Collector, AsyncCollector from tianshou.data import ( ReplayBuffer, PrioritizedReplayB...
[ "torch.utils.tensorboard.SummaryWriter" ]
1.4.0
ksc999/tianshou
8a5e2190f7045ffee2ffa4346c0010693ac7b222
1.5
import argparse import os # workaround to unpickle olf model files import sys import numpy as np import torch import time from envs.envs_util import VecPyTorch, make_vec_envs from misc.utils import get_render_func, get_vec_normalize # sys.path.append('a2c_ppo_acktr') parser = argparse.ArgumentParser(description='RL...
[ "torch.zeros", "torch.no_grad" ]
1.5.1
mazpie/vime-pytorch
fef62d9d700886622d9ca8c2234ad1718c10f553
1.8
from typing import Dict, Optional import torch from kornia.augmentation._2d.geometric.base import GeometricAugmentationBase2D from kornia.geometry.transform import get_tps_transform, warp_image_tps class RandomThinPlateSpline(GeometricAugmentationBase2D): r"""Add random noise to the Thin Plate Spline algorithm....
[ "torch.distributions.Uniform", "torch.tensor" ]
1.8.1
dichen-cd/kornia
dcd1c5e17cf4d2ae2db1f438c53245bba0afd93f
1.5
import argparse import sys import os import matplotlib.pyplot as plt from tensorboardX import SummaryWriter plt.switch_backend('agg') sys.path.insert(0, '../utils') # If that is the way to include paths for this project, then why not also for 'backbone'? sys.path.insert(0, '../eval') sys.path.insert(0, '../backbone...
[ "torch.device", "torch.utils.data.RandomSampler", "torch.no_grad", "torch.optim.Adam", "torch.cuda.get_device_name", "torch.cuda.device_count", "torch.manual_seed", "torch.cuda.is_available", "torch.utils.data.DataLoader" ]
1.5.0
simplexsigil/DPC
bf06939e302d9393b22f9b424abd281c535d8dbd
1.6
from pathlib import Path from typing import Tuple import numpy as np import pandas as pd import torch from .bandits import DataBasedBandit from .utils import download_data URL = "https://storage.googleapis.com/bandits_datasets/raw_stock_contexts" class FinancialDataBandit(DataBasedBandit): """A contextual band...
[ "torch.tensor" ]
1.6.0
IBM/sau-explore
dfeff8192292afeca7c17927684a3ed9fe65b97f
1.4
from math import ceil from typing import Dict, Any, List, Optional import gym import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.optim.lr_scheduler import LambdaLR from core.algorithms.onpolicy_sync.losses import PPO from core.algorithms.onpolicy_sync.losses.ppo import PPOCon...
[ "torch.cuda.is_available", "torch.cuda.device_count" ]
1.4.0
prithv1/allenact
f29dd6f0ec62425b02ca07fee815b1a82627a28e
1.9
from typing import List, Any import pytorch_lightning as pl import torch from pytorch_lightning import Trainer from torch.optim import Adam from torchmetrics import MetricCollection from new.data.report import Report from new.model.lstm_tagger import LstmTagger from new.training.data import ReportsDataModule from new...
[ "torch.cat", "torch.no_grad", "torch.nn.Softmax" ]
1.9.0
lissrbay/bugml
6a3823e32c176de9d3a47416a220e7d83d38763d
1.1
import torch import torch.nn as nn from mmdet.core import bbox2result, bbox2roi, build_assigner, build_sampler from .. import builder from ..registry import DETECTORS from .base import BaseDetector from .test_mixins import BBoxTestMixin, MaskTestMixin, RPNTestMixin @DETECTORS.register_module class TwoStageDetector(B...
[ "torch.zeros", "torch.cat", "torch.randn", "torch.ones" ]
1.1
nemonameless/mmkp
3758c48c7a6568e04d5a01b79f12baf12abcc420
1.6
# Code modified from https://github.com/kuangliu/pytorch-cifar '''ResNet in PyTorch. BasicBlock and Bottleneck module is from the original ResNet paper: [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun Deep Residual Learning for Image Recognition. arXiv:1512.03385 PreActBlock and PreActBottleneck module is ...
[ "torch.nn.Linear", "torch.nn.Sequential", "torch.nn.BatchNorm2d", "torch.nn.functional.adaptive_avg_pool2d", "torch.nn.Conv2d", "torch.nn.functional.relu", "torch.randn" ]
1.6.0
dmitryshendryk/tantum
afd07e7a52d65338297a4f46d26e5241d3e756dc
1.0
# coding=utf-8 # Copyright 2018 The Google AI Language Team 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 ...
[ "torch.Size", "torch.eq", "torch.tensor", "torch.as_tensor", "torch.allclose", "torch.Tensor" ]
1.0
HatsuneMiku4/transformers
ee5a5b6be825a9e3ac539485e7dea7601ad57653
0.4
""" A ``TokenEmbedder`` which uses one of the BERT models (https://github.com/google-research/bert) to produce embeddings. At its core it uses Hugging Face's PyTorch implementation (https://github.com/huggingface/pytorch-pretrained-BERT), so thanks to them! """ from typing import Dict import logging import torch impo...
[ "torch.cat", "torch.stack", "torch.split", "torch.zeros_like", "torch.nn.functional.pad" ]
0.4.1
schmmd/allennlp
fbc28cefe03b1ea3ff65300d475d34f5f9629a5c
0.4
# pylint: disable=no-self-use,invalid-name import torch from pytorch_pretrained_bert.modeling import BertConfig, BertModel from allennlp.common.testing import ModelTestCase from allennlp.data.dataset import Batch from allennlp.data.fields import TextField, ListField from allennlp.data.instance import Instance from al...
[ "torch.LongTensor" ]
0.4.1
schmmd/allennlp
fbc28cefe03b1ea3ff65300d475d34f5f9629a5c
1.0
# Pytorch imports import torch # Cyphercat imports from .train import train, train_attacker from .metrics import eval_membership_inference, eval_attack_model # Device to run on device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") def ml_leaks1(target=None, shadow_model=None, attacker_model=None, ...
[ "torch.cuda.is_available", "torch.LongTensor" ]
1.0.0
arafin-lab/model_inversion_experiments
4029ae8683b9056013e6424d8931afe79afa618e