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.6 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | [
"torch.cuda.empty_cache"
] | 1.6.0 | supersunshinefk/UMRFormer-Net | bf165ca2158a158f7c194c6201af2a4fcabe8742 |
1.7 | # encoding: utf-8
import os
import random
import torch
import torch.nn as nn
import torch.distributed as dist
from yolox.exp import Exp as MyExp
from yolox.data import get_yolox_datadir
class Exp(MyExp):
def __init__(self):
super(Exp, self).__init__()
self.num_classes = 1
self.depth = 0.67... | [
"torch.distributed.get_world_size",
"torch.utils.data.SequentialSampler",
"torch.utils.data.DataLoader",
"torch.utils.data.distributed.DistributedSampler"
] | 1.7 | monchana/ByteTrack | b9a9448fa01d661a07d74aed6f900a4f5e7c1f54 |
1.0 | # coding=utf-8
# Copyright 2021 Iz Beltagy, Matthew E. Peters, Arman Cohan and The HuggingFace Inc. 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://w... | [
"torch.nn.Linear",
"torch.cat",
"torch.einsum",
"torch.isnan",
"torch.finfo",
"torch.bmm",
"torch.masked_fill",
"torch.nn.functional.pad",
"torch.nn.CrossEntropyLoss",
"torch.nn.LayerNorm",
"torch.tensor",
"torch.zeros",
"torch.nn.functional.dropout",
"torch.clamp",
"torch.isinf",
"tor... | 1.0 | syskn/transformers | fafbd2574cb12b987099f69b3821814042d8f4ce |
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"
] | 1.3.1 | aaronzs/metrics | 30019851186f2e224504ec76e87cc7f5170b7166 |
1.2 | #!/usr/bin/env python
# coding: utf-8
import yaml
import torch
import argparse
import numpy as np
# For reproducibility, comment these may speed up training
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
# Arguments
parser = argparse.ArgumentParser(description='Training E2E asr.')
pa... | [
"torch.manual_seed",
"torch.cuda.is_available",
"torch.cuda.manual_seed_all"
] | 1.2.0 | DanielLin94144/End-to-End-jointCTC-Attention-ASR | 2b8900f1f397d65d0e86972f7379bb3dfeb7c4ea |
1.8 | # This script is borrowed from https://github.com/LynnHo/DCGAN-LSGAN-WGAN-GP-DRAGAN-Pytorch
# which is also used by Durall et al. (https://ieeexplore.ieee.org/document/9157579)
import torch
def get_gan_losses_fn():
bce = torch.nn.BCEWithLogitsLoss()
def d_loss_fn(r_logit, f_logit):
r_loss = bce(r_lo... | [
"torch.zeros_like",
"torch.ones_like",
"torch.nn.MSELoss",
"torch.nn.BCEWithLogitsLoss"
] | 1.8.0 | sutd-visual-computing-group/Fourier-Discrepancies-CNN-Detection | ff313150035935c2c81167291ed82b7f13064f05 |
1.9 | import json
import os
import argparse
import scipy.stats as stats
import numpy as np
import pandas as pd
import torch
import random
import sys
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import time
import torch.utils.data as data
from sklearn.model_selection import StratifiedKFold
from collect... | [
"torch.save",
"torch.random.manual_seed",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"torch.nn.CrossEntropyLoss"
] | 1.9.0 | zroger49/hac | 5905369344c985d5293d572a610c82308306e385 |
1.3 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import torch
from classy_vision.generic.util import is_pos_int
def add_generic_args(parser... | [
"torch.cuda.is_available"
] | 1.3.1 | miguelvr/ClassyVision | 38a59270e16fda83e160c5888b96c777cb78757b |
1.11 | import torch
from torch import nn
__author__ = "Daniel-Tobias Rademaker"
####################################################
# Single GNN-layer #
####################################################
class GNN_layer(nn.Module):
def __init__( # pylint: disable=too-many-arguments
... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.Sigmoid",
"torch.nn.SiLU",
"torch.nn.BatchNorm1d"
] | 1.11.0 | DeepRank/deeprank-gnn-2 | 9d1b5f254ae25364bec88ba6e82a6aa1022fc699 |
1.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 copy of the Licens... | [
"torch.distributed.get_world_size",
"torch.utils.data.RandomSampler",
"torch.cuda.is_available",
"torch.load",
"torch.nn.DataParallel",
"torch.distributed.init_process_group",
"torch.manual_seed",
"torch.tensor",
"torch.utils.data.DataLoader",
"torch.distributed.get_rank",
"torch.device",
"tor... | 1.8.0 | Berumotto1/ml-platform-sdk-python | fc30300552bbeed5d97e8846beb040c9d262d23e |
1.0 | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConditionedCNNClassifier(nn.Module):
def __init__(self, net_cfg, embed_cfg):
super().__init__()
self.net_cfg = net_cfg
self.embed_cfg = embed_cfg
print('----------- Model Config---------------')
print(f... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.functional.max_pool1d",
"torch.nn.Embedding"
] | 1.0 | varshanth/FakeNewsChallenge-FNC1 | 57cc26c62f73953bf49a2be7e35426c28c055991 |
1.10 | import argparse
import random
import sys
from pathlib import Path
from typing import Tuple
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
from torch.optim.optimizer import Optimizer
from torch.utils.data import DataLoader
from torchvision import datasets, ... | [
"torch.cat",
"torch.stack",
"torch.no_grad",
"torch.manual_seed",
"torch.tensor",
"torch.nn.functional.nll_loss"
] | 1.10.1 | lucagrementieri/model-manifold | 41042a4c4f7cf702ca6c57fdd20d698c7ed46a52 |
1.6 | import argparse
import logging
import os
import sys
import socket
import json
import pickle
import torch
from datetime import datetime
from transformers import AutoConfig, AutoTokenizer, AutoModel
from torch.utils.data import DataLoader, RandomSampler
from .framework import RerankerFramework
from ..datasets import (E... | [
"torch.utils.data.RandomSampler",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"torch.nn.BCEWithLogitsLoss",
"torch.nn.CrossEntropyLoss"
] | 1.6.0 | Ankur3107/scalingQA | f648e34a9e4d7d4dbc2549a3c8767b6a25e3c447 |
1.9 | import torch
import random
import numpy as np
import pandas as pd
def seeding(seed=31):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = True
torch.set_printoptions(precis... | [
"torch.device",
"torch.cuda.manual_seed",
"torch.manual_seed",
"torch.set_printoptions",
"torch.cuda.is_available"
] | 1.9.1 | strong-win/Timeband | 179ca45ce9cb3efb686d837c8df6cdad4932e59e |
0.2 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import getopt
import sys
import os
import math
import time
import argparse
from visdom import Visdom
sys.path.insert(0, os.path.join('..', '..'))
import torch as T
from torch.autograd import Variable ... | [
"torch.save",
"torch.manual_seed"
] | 0.2.0 | kierkegaard13/pytorch-dnc | b21a705ccb88f72fe3723e3c1e1f2bbe741f01b6 |
0.1 | import torch
import torch.nn as nn
from gneiss.cluster import random_linkage
from gneiss.balances import sparse_balance_basis
from scipy.sparse import coo_matrix
import numpy as np
from torch.distributions import Multinomial, Normal
from catvae.composition import ilr
from catvae.distributions.mvn import MultivariateNor... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.Sequential",
"torch.distributions.Normal",
"torch.ones",
"torch.tensor",
"torch.nn.Softplus",
"torch.exp"
] | 0.1.0 | flatironinstitute/catvae | 003a46682fc33e5b0d66c17e85e59e464a465c53 |
1.5 | import torch
import torch.nn.functional as F
from .base import Loss
from .base import Mode
from .base import Reduction
class CrossEntropyLoss(Loss):
"""
CE with optional smoothing and support for multiple positive labels.
Can accept one-hot encoded y_trues
Args:
mode (str): Metric mode {'bina... | [
"torch.zeros_like",
"torch.Tensor",
"torch.tensor",
"torch.nn.functional.log_softmax"
] | 1.5 | vladserkoff/pytorch-tools | c838b5776b3d7e2d9d20c98432db400d5d842144 |
1.10 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import itertools
import torch
import functorch
from functorch import vmap
import torch.utils._pytree as pytree
fr... | [
"torch.testing._internal.common_methods_invocations.DecorateInfo",
"torch.stack",
"torch.utils._pytree.tree_map",
"torch.ones",
"torch.utils._pytree.tree_unflatten",
"torch.testing._internal.common_device_type.toleranceOverride",
"torch.utils._pytree.tree_flatten"
] | 1.10.0 | ConnollyLeon/functorch | 0a7b3dff269148ceac831194f3358452b18b6e19 |
1.7 | # coding=utf-8
# Copyright 2021, The Facebook AI Research Team and The HuggingFace Inc. team. All rights reserved.
# Copyright 2021, National Institute of Information and Communication Technology (Raj Dabre)
# Modified portions by Raj Dabre are indicated as so.
#
# Licensed under the Apache License, Version 2.0 (the ... | [
"torch.nn.Linear",
"torch.cat",
"torch.einsum",
"torch.nn.ModuleList",
"torch.isnan",
"torch.finfo",
"torch.bmm",
"torch.nn.Parameter",
"torch.ones",
"torch.nn.CrossEntropyLoss",
"torch.nn.LayerNorm",
"torch.tril",
"torch.tensor",
"torch.zeros",
"torch.nn.functional.dropout",
"torch.cl... | 1.7.1 | koukoulala/yanmtt | 24a499aff8f587e6de252dd67a64471fce6fe71b |
1.1 | """Python Script Template."""
from abc import ABCMeta
import torch
from hucrl.policy.augmented_policy import AugmentedPolicy
from rllib.policy import AbstractPolicy, NNPolicy
class AdversarialPolicy(AbstractPolicy, metaclass=ABCMeta):
"""Given a protagonist and an antagonist policy, combine to give a joint polic... | [
"torch.cat"
] | 1.1.1 | sebascuri/rhucrl | 27663e1302f3bbc636dff28495c6f2667bb7c1da |
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"
] | 1.3 | wdmwhh/pytorch-lightning | 5d10a36762776c4b6f6a9c55b4e6bf7bd258137f |
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.nn.ReLU",
"torch.utils.data.dataloader.DataLoader",
"torch.utils.data.distributed.DistributedSampler",
"torch.cuda.device_count"
] | 1.3 | wdmwhh/pytorch-lightning | 4018237c309b7d9d6978da73132003615341e04a |
1.4 | import os
import json
import numpy as np
import torch
import torch.nn.functional as F
from torch.optim import Adam
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
import matplotlib
import matplotlib.pyplot as plt
import warnings
from mode_disent_no_ssm.utils.skill_policy_wrapper import DiaynSki... | [
"torch.nn.Linear",
"torch.cuda.is_available",
"torch.meshgrid",
"torch.Size",
"torch.manual_seed",
"torch.tensor",
"torch.utils.tensorboard.SummaryWriter",
"torch.save",
"torch.linspace",
"torch.no_grad",
"torch.from_numpy",
"torch.nn.functional.mse_loss"
] | 1.4.0 | fgitmichael/AutoregressiveModeDisentangling | c556b2384ba90e87acd1358d5aae34c3cf477ae5 |
1.8 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
import torch
from .base_grad_scaler import BaseGradScaler
__all__ = ['DynamicGradScaler']
class DynamicGradScaler(BaseGradScaler):
def __init__(self,
initial_scale: int = 2**16,
growth_factor: int = 2,
backoff_fa... | [
"torch.min",
"torch.max"
] | 1.8 | oikosohn/ColossalAI | fc5101f24c9a2ad8e7e16cb81e1ef7646a1061fd |
1.0 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2022 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-... | [
"torch.jit.script",
"torch.stack",
"torch.no_grad",
"torch.tensor"
] | 1.0 | Sophylax/transformers | 5d565dd8526ec794a701a80f216e03e506b1c607 |
1.6 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import itertools
import warnings
import torch
from botorch import fit_gpytorch_model
from botorch.exceptions.errors ... | [
"torch.Size",
"torch.rand",
"torch.tensor",
"torch.allclose",
"torch.equal"
] | 1.6 | sgbaird/botorch | 3318c06333166328c95d24edd1055d4ef4bded70 |
0.4 | import torch
import torch.nn as nn
from pytorch_direct_warp.direct_proj import direct_projection
class DirectWarper(nn.Module):
def __init__(self, keep_index=False):
super(DirectWarper, self).__init__()
self.id_grid = None
self.keep_index = keep_index
def set_id_grid(self, depth):
... | [
"torch.cat",
"torch.stack",
"torch.arange"
] | 0.4.1 | ClementPinard/direct-warper | be46410202c8cd9efb982b5dc4c1eb954ab45b10 |
1.0 | # Copyright 2019 The Texar Authors. 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 applicable ... | [
"torch.no_grad",
"torch.ones"
] | 1.0.0 | Codle/texar-pytorch | d63556e7a8f48076c396467314a771d56552d595 |
1.4 | import logging
import math
import higher
import torch
from torch import nn, optim
import numpy as np
from torch.utils import data
from transformers import AdamW
import datasets
import models.utils
from models.base_models import ReplayMemory, TransformerClsModel, TransformerNeuromodulator
logging.basicConfig(level=... | [
"torch.utils.data.ConcatDataset",
"torch.save",
"torch.optim.SGD",
"torch.no_grad",
"torch.autograd.grad",
"torch.tensor",
"torch.utils.data.DataLoader",
"torch.load",
"torch.nn.CrossEntropyLoss"
] | 1.4.0 | mjhoshea/MetaLifelongLanguage | 22327dec0038a50276ba0994258f6f2fd46fbae7 |
1.5 | import os
import pickle
# import pickle5 as pickle
import random
import warnings
from distutils.util import strtobool
import numpy as np
import torch
import torch.nn as nn
from torch.nn import functional as F
from environments.parallel_envs import make_vec_envs
device = torch.device("cuda:0" if torch.cuda.is_availab... | [
"torch.nn.Linear",
"torch.zeros",
"torch.cat",
"torch.min",
"torch.no_grad",
"torch.nn.functional.relu",
"torch.manual_seed",
"torch.random.manual_seed",
"torch.randn_like",
"torch.all",
"torch.cuda.is_available",
"torch.tensor",
"torch.ones",
"torch.tanh",
"torch.exp",
"torch.pow"
] | 1.5.1 | MetaMind/varibad | 75e26430d83296c0ee3a7ac3ebb1506b7cf7d49e |
0.6 | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..base import modules
class PSPBlock(nn.Module):
def __init__(self, in_channels, out_channels, pool_size, use_bathcnorm=True):
super().__init__()
if pool_size == 1:
use_bathcnorm = False # PyTorch does not suppo... | [
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.functional.interpolate",
"torch.cat",
"torch.nn.Dropout2d"
] | 0.6.3 | yida2311/segmentation_models.pytorch | e5c0b8b915a7d8c82222cc319030b241b12b0cf2 |
1.4 | # -*- coding: utf-8 -*-
'''
@Time : 2020/05/06 21:09
@Author : Tianxiaomo
@File : dataset.py
@Noice :
@Modificattion :
@Author :
@Time :
@Detail :
'''
import os
import random
import sys
import cv2
import numpy as np
import torch
from torch.utils.data.dataset im... | [
"torch.zeros",
"torch.as_tensor"
] | 1.4.0 | LipatJob/pytorch-YOLOv4 | ba91f3c7a3e54a557e045d4276ac08d0a85afbee |
1.3 | import numpy as np
import unittest
import torch
import os
import heat as ht
if os.environ.get("DEVICE") == "gpu" and torch.cuda.is_available():
ht.use_device("gpu")
torch.cuda.set_device(torch.device(ht.get_device().torch_device))
else:
ht.use_device("cpu")
device = ht.get_device().torch_device
ht_device =... | [
"torch.arange",
"torch.equal",
"torch.ones",
"torch.cuda.set_device",
"torch.cuda.is_available",
"torch.tensor",
"torch.zeros_like",
"torch.empty"
] | 1.3.1 | bhagemeier/heat | b362b61a558c4a69cd9a884051b5efcc74f494da |
1.9 | """
Copyright (c) 2019-present NAVER Corp.
MIT License
"""
from collections import namedtuple
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from torchvision import models
from torchvision.models.vgg import model_urls
def init_weights(modules)... | [
"torch.cat",
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.BatchNorm2d",
"torch.nn.init.xavier_uniform_",
"torch.nn.ReLU",
"torch.nn.Conv2d"
] | 1.9.0 | nhatnxn/layout_GateGCN | 66ead2482fc5148668cfc776e0a3ac03d916e897 |
0.4 | ## TODO: define the convolutional neural network architecture
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
# can use the below import should you choose to initialize the weights of your Net
import torch.nn.init as I
from torchvision import models
from collecti... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.MaxPool2d",
"torch.nn.AvgPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.BatchNorm1d"
] | 0.4.0 | rishabhchhillar/Facial-Keypoints-Detection | c8fb7db7b4743a753e9234e6236bcdd6b0f6de77 |
1.0 | # -*- coding: utf-8 -*-
# file: sentiment_classifier.py
# author: yangheng <yangheng@m.scnu.edu.cn>
# Copyright (C) 2020. All Rights Reserved.
import json
import os
import pickle
import random
import numpy
import torch
from findfile import find_file
from termcolor import colored
from torch.utils.data import DataLoader... | [
"torch.cuda.manual_seed",
"torch.no_grad",
"torch.softmax",
"torch.manual_seed",
"torch.utils.data.DataLoader",
"torch.load"
] | 1.0 | WeiLi9811/PyABSA | e1595784b8c978c1e91c0d8139a0a4dc36ac5965 |
1.1 | from functools import reduce
from itertools import permutations
from typing import Dict
from typing import Optional
from typing import Tuple
import logging
import torch
from torch_complex.tensor import ComplexTensor
from typeguard import check_argument_types
from espnet2.enh.abs_enh import AbsEnhancement
from espnet2.... | [
"torch.stack",
"torch.min",
"torch.arange",
"torch.norm",
"torch.pow",
"torch.log10",
"torch.ones",
"torch.tensor",
"torch.sum"
] | 1.1.0 | ishine/DPSL-ASR | fabb66cbd7f24f7a05c64f5b7e87af154f39ceb2 |
1.6 | #!/usr/bin/python
#-*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy, math, pdb, sys, random
import time, os, itertools, shutil, importlib
from tuneThreshold import tuneThresholdfromScore
from DatasetLoader import test_dataset_loader
from torch.cuda.amp import autoc... | [
"torch.nn.functional.normalize",
"torch.cuda.amp.autocast",
"torch.LongTensor",
"torch.utils.data.DataLoader",
"torch.load",
"torch.cuda.amp.GradScaler"
] | 1.6.0 | llongquoc/voxceleb_trainer | 7442ea6c1a4b4fde3bcec44a4538d6a515e5f292 |
1.6 | from machin.auto.config import (
generate_algorithm_config,
generate_env_config,
generate_training_config,
launch,
)
import torch as t
import torch.nn as nn
class SomeQNet(nn.Module):
def __init__(self, state_dim, action_num):
super().__init__()
self.fc1 = nn.Linear(state_dim, 16... | [
"torch.nn.Linear"
] | 1.6.0 | lorenzosteccanella/machin | 9d3ce87dbed820b5019211b0690b54613084d9e4 |
1.5 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Backbone modules.
"""
from collections import OrderedDict
import torch
import torch.nn.functional as F
import torchvision
from torch import nn
from torchvision.models._utils import IntermediateLayerGetter
from typing import Dict, List
from uti... | [
"torch.zeros",
"torch.ones"
] | 1.5.0 | Aliweka2020/EfficientDETR | 6557dca4e969d58f15555fe030a7ad7a0bacef7c |
1.7 | from typing import Dict, Optional, List, Any
from overrides import overrides
import torch
from allennlp.common.checks import check_dimensions_match
from allennlp.data import TextFieldTensors, Vocabulary
from allennlp.models.model import Model
from allennlp.modules import FeedForward
from allennlp.modules import Seq2S... | [
"torch.cat",
"torch.nn.CrossEntropyLoss",
"torch.nn.functional.softmax"
] | 1.7.0 | zhiyangxu-umass/allennlp-models | d922f7a8075387ebed1a3e38e588345f706d3f02 |
1.7 | import warnings
from typing import Dict, List, Any, Union
from overrides import overrides
import torch
from torch.nn.modules import Linear, Dropout
import torch.nn.functional as F
from transformers.models.bert.configuration_bert import BertConfig
from transformers.models.bert.modeling_bert import BertModel
from allen... | [
"torch.zeros",
"torch.nn.modules.Dropout",
"torch.nn.modules.Linear",
"torch.nn.functional.softmax"
] | 1.7.0 | zhiyangxu-umass/allennlp-models | d922f7a8075387ebed1a3e38e588345f706d3f02 |
1.5 | import logging.config
import os
from pathlib import Path
import torch
from transformers import set_seed as hf_set_seed
# global variable: cache_root
cache_root = Path(os.getenv("FLAIR_CACHE_ROOT", Path(Path.home(), ".flair")))
# global variable: device
if torch.cuda.is_available():
device = torch.device("cuda:0"... | [
"torch.device",
"torch.cuda.is_available"
] | 1.5.0 | chen-yuxuan/flair | 480d2c9afd66ab8d3bf40a676917e84dba3c4cee |
0.4 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
from .kernel import Kernel
from ..lazy import ToeplitzLazyTensor, KroneckerProductLazyTensor
from .. import settings
class GridKernel(Kernel):
r"""
... | [
"torch.equal"
] | 0.4.1 | konstantinklemmer/gpytorch | f1d947b340a188c398b6c6e610b6a839c61aa298 |
0.4 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
from ..lazy import LazyTensor
class NonLazyTensor(LazyTensor):
def __init__(self, tsr):
"""
Not a lazy tensor
Args:
- ... | [
"torch.is_tensor",
"torch.matmul",
"torch.arange"
] | 0.4.1 | konstantinklemmer/gpytorch | f1d947b340a188c398b6c6e610b6a839c61aa298 |
0.4 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import math
import torch
from .kernel import Kernel
class CosineKernel(Kernel):
r"""
Computes a covariance matrix based on the cosine kernel
between inputs ... | [
"torch.zeros"
] | 0.4.1 | konstantinklemmer/gpytorch | f1d947b340a188c398b6c6e610b6a839c61aa298 |
1.2 | import copy
import numpy as np
import torch
import os
import sys
sys.path.insert(0, os.environ['ALFRED_ROOT'])
from agents.utils.misc import extract_admissible_commands
def evaluate_vision_dagger(env, agent, num_games, debug=False):
env.seed(42)
agent.eval()
episode_no = 0
res_points, res_steps, res_... | [
"torch.cat",
"torch.no_grad"
] | 1.2.0 | 594zyc/alfworld | 704922821fb0a2ff92dfc3f3a5033ba498cb3932 |
1.4 | import torch
import torch.nn as nn
from args import get_parser
# read parser
parser = get_parser()
args = parser.parse_args()
class Norm(nn.Module):
def forward(self, input, p=2, dim=1, eps=1e-12):
return input / input.norm(p, dim, keepdim=True).clamp(min=eps).expand_as(input)
class LstmFlatten(nn.Module... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.nn.Conv1d",
"torch.nn.Tanh",
"torch.nn.ReLU",
"torch.nn.Flatten"
] | 1.4.0 | GOALCLEOPATRA/MLM | 331fd42f8f1f16ad990e66f9f0f873a824f8f849 |
1.7 | # 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"
] | 1.7 | 314dev/pi | 0e65adf329b00b0d0f73346734df2c06eec05ddd |
1.2 | import os
import argparse
import logging
import torch.nn.functional as F
import numpy as np
import pymia.data.assembler as assembler
import SimpleITK as sitk
import common.trainloop.data as data
import common.evalutation.eval as ev
import common.trainloop.steps as step
import common.trainloop.context as ctx
import co... | [
"torch.nn.functional.softmax"
] | 1.2.0 | alainjungo/reliability-challenges-uncertainty | 21e86f6e2a5d2520b5767dce48bbcf2b11773788 |
1.4 | from torch.utils.data import DataLoader
from sequence.data.datasets import brown
from sequence.data.utils import DatasetInference, Tokens, Language
from sequence.test import language, words, dataset, paths
import pytest
import numpy as np
import random
def test_dataset_torch_compatible(dataset):
dl = DataLoader(d... | [
"torch.utils.data.DataLoader"
] | 1.4.0 | ritchie46/clickstream | 79c669d0636521db2697e5fa583628d1920cc6c1 |
1.9 | #! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, Inc.
#
# 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
#
# Unles... | [
"torch.greater_equal",
"torch.sigmoid",
"torch.Size"
] | 1.9.0 | carlogrisetti/ludwig | 5c0887f14867e1577e0ddc3806c5cf7a781fb665 |
1.6 | import torch
import numpy as np
import random
from transformers import T5Tokenizer, T5ForConditionalGeneration
#Set all seeds to make output deterministic
torch.manual_seed(0)
np.random.seed(0)
random.seed(0)
#Paragraphs for which we want to generate queries
paragraphs = [
"Python is an interpreted, high-level and g... | [
"torch.manual_seed",
"torch.no_grad",
"torch.cuda.is_available"
] | 1.6.0 | faezakamran/sentence-transformers | 2158fff3aa96651b10fe367c41fdd5008a33c5c6 |
1.0 | import torch
from torch import nn
from torch.nn import Parameter
import torch.nn.functional as F
from torch.autograd.variable import Variable
import fast_self_multihead_attn_norm_add
class FastSelfAttnNormAddFunc(torch.autograd.Function) :
@staticmethod
def forward(ctx, use_time_mask, is_training, heads, inp... | [
"torch.tensor"
] | 1.0 | DonnieKim411/apex | fb00a5a1d569c7b118aa672b3dacac3663ca3911 |
1.2 | #!/usr/bin/env python3
from collections import namedtuple
from typing import Callable, Iterable, List, NamedTuple, Optional, Tuple, Union
import torch
from captum.attr import IntegratedGradients
from captum.attr._utils.batching import _batched_generator
from captum.attr._utils.common import _run_forward, safe_div
from... | [
"torch.norm",
"torch.tensor"
] | 1.2 | BrianTillman/captum | edf41d31bd12bd38846b1214ade0ad897063a4d4 |
1.2 | # -*- coding: utf-8 -*-
r"""
malgan.discriminator
~~~~~~~~~~~~~~~~~
Discriminator (i.e., substitute detector) block for MalGAN.
Based on the paper: "Generating Adversarial Malware Examples for Black-Box Attacks Based on GAN"
By Weiwei Hu and Ying Tan.
:version: 0.1.0
:copyright: (c) 2019 ... | [
"torch.nn.Sequential",
"torch.nn.Linear",
"torch.clamp",
"torch.nn.Sigmoid"
] | 1.2.0 | ZaydH/malware_gan | ea3f4e5139e6343c26273db0299a4b9d96d814af |
1.7 | import chess
import argparse
import questionary
import os
import json
import numpy as np
import torch
from tqdm import tqdm
import model
import utils
import pickle
import chess.engine
import nltk
from nltk.translate.bleu_score import SmoothingFunction
MASK_CHAR = u"\u2047"
engine = chess.engine.SimpleEngine.popen_uci... | [
"torch.device",
"torch.cuda.current_device",
"torch.cuda.is_available",
"torch.tensor"
] | 1.7.1 | HarryMellsop/chept-neural-chess | 656cb385e69d21c28117ef1fd0ecc671e01f1c1d |
1.5 | import datetime
import json
import os
import os.path as osp
from contextlib import contextmanager
try:
from torch.utils.tensorboard.writer import SummaryWriter
except ImportError:
print("Unable to import tensorboard SummaryWriter, proceeding without.")
from rlpyt.utils.logging import logger
LOG_DIR = osp.absp... | [
"torch.utils.tensorboard.writer.SummaryWriter"
] | 1.5.1 | williamd4112/curiosity_baselines | 45939f3f24c53cfff5153ef012486a6a058660be |
1.6 | import numpy as np
import torch
from .downloader import load_trained_model
from .spacy_extensions import ConstituentData
from ..parse_base import BaseInputExample
class PartialConstituentData:
def __init__(self):
self.starts = [np.array([], dtype=int)]
self.ends = [np.array([], dtype=int)]
... | [
"torch.cuda.is_available"
] | 1.6.0 | speedcell4/self-attentive-parser | 644a27d07316d1441a62425c85f78128b8dee4fe |
1.1 | import torch.nn as nn
import torch.nn.functional as F
class MnistModel(nn.Module):
def __init__(self, num_classes=10):
super().__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.conv2_drop = nn.Dropout2d()
self.fc1 = n... | [
"torch.nn.Linear",
"torch.nn.functional.dropout",
"torch.nn.functional.log_softmax",
"torch.nn.Conv2d",
"torch.nn.Dropout2d"
] | 1.1 | Yoontae6719/pytorch_hydra | c608f144fb8002bdcd329e09daf0416cba10a850 |
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.any",
"torch.allclose",
"torch.all",
"torch.nn.Linear"
] | 1.6 | qmpzzpmq/pytorch-lightning | 854bdc042d12fe4b713de881c58b025de30d0c39 |
0.6 | import os
import time
from cv2 import cv2
import numpy as np
from collections import defaultdict
from PIL import Image
from torch import torch
import torch.nn.functional as F
from torchvision import transforms as T
from face_utils import norm_crop, FaceDetector
from model_def import WSDAN, xception
class DFDCLoade... | [
"torch.nn.functional.interpolate",
"torch.torch.Tensor",
"torch.torch.device",
"torch.torch.set_grad_enabled",
"torch.torch.stack"
] | 0.6.3 | UnknwoonUser/kaggle-dfdc | 2088c2c54866b6a959e3477c1c7f277f82b9ebe3 |
1.6 | # Copyright (c) Facebook, Inc. and its affiliates.
import os
import pickle
import re
from collections import OrderedDict
from copy import deepcopy
from dataclasses import dataclass
from enum import Enum
from typing import Any
import torch
import torchvision
from mmf.common.registry import registry
from mmf.modules.emb... | [
"torch.nn.Linear",
"torch.nn.Identity",
"torch.cat",
"torch.prod",
"torch.flatten",
"torch.nn.Sequential",
"torch.from_numpy",
"torch.hub.load_state_dict_from_url",
"torch.nn.functional.relu",
"torch.nn.Embedding"
] | 1.6.0 | madian9/mmf | 6db9048c848a178872d1aa1a14ee0009de703750 |
0.6 | from torch.optim.lr_scheduler import _LRScheduler
from torch.optim.lr_scheduler import ReduceLROnPlateau
__all__ = ['GradualWarmupScheduler']
class GradualWarmupScheduler(_LRScheduler):
""" Gradually warm-up(increasing) learning rate in optimizer.
Proposed in 'Accurate, Large Minibatch SGD: Training ImageNet... | [
"torch.optim.sgd.SGD",
"torch.optim.lr_scheduler.StepLR",
"torch.randn"
] | 0.6.3 | mesuga-reymond/change_detection.pytorch | cc9a4aec59e13fb45f22b9d9d3f4c735bd257892 |
1.0 | import torch
from apex import amp
from math import ceil
import random
import PIL
from tqdm import tqdm
#torch.multiprocessing.set_start_method('spawn', force=True)
import os,sys,inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
urbangan_dir = os.path.dirname(curr... | [
"torch.zeros",
"torch.nn.functional.interpolate",
"torch.no_grad",
"torch.diag",
"torch.Tensor"
] | 1.0.0 | valeoai/SemanticPalette | a1b02a384c09881d6f1ca1a0c0ebfd87278c3d7d |
1.0 | import torch
import matplotlib.pyplot as plt
from matplotlib import cm
from tqdm import tqdm
import imageio
import numpy as np
import pandas as pd
from copy import deepcopy
import random
from glob import glob
import math
import os,sys,inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.curren... | [
"torch.cat",
"torch.stack",
"torch.sum",
"torch.mul",
"torch.sqrt",
"torch.tensor",
"torch.zeros_like",
"torch.max",
"torch.mean",
"torch.log",
"torch.argmax",
"torch.ones_like",
"torch.atan2",
"torch.randn"
] | 1.0.0 | valeoai/SemanticPalette | a1b02a384c09881d6f1ca1a0c0ebfd87278c3d7d |
1.10 | # ------------------------------------------------------------------------------
# Libraries
# ------------------------------------------------------------------------------
import datetime
import json
import logging
import math
import os
from time import time
import torch
from utils.visualization import WriterTens... | [
"torch.device",
"torch.save",
"torch.cuda.device_count",
"torch.load",
"torch.nn.DataParallel"
] | 1.10.1 | crutcher/stylelens | 8df3704f56fe6a30395eadcb1aee2e11563dfabb |
1.4 | # coding=utf-8
# Copyright 2022 The HuggingFace Inc. 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 r... | [
"torch.no_grad",
"torch.utils.data.DataLoader"
] | 1.4.0 | techthiyanes/accelerate | 3d92caa24169b9606ba2a7dbf7b86dc0e009fba0 |
1.4 | # Copyright 2022 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.cuda.mem_get_info",
"torch.device",
"torch.no_grad",
"torch.nn.Parameter",
"torch.cuda.device_count",
"torch.cuda.is_available",
"torch.tensor",
"torch.load"
] | 1.4.0 | techthiyanes/accelerate | 3d92caa24169b9606ba2a7dbf7b86dc0e009fba0 |
1.0 | import argparse
import random
import re
import numpy as np
import pandas as pd
import torch
def add_common_arg(parser):
def torch_device(arg):
if re.match('^(cuda(:[0-9]+)?|cpu)$', arg) is None:
raise argparse.ArgumentTypeError(
'Wrong device format: {}'.format(arg)
... | [
"torch.cuda.manual_seed_all",
"torch.cuda.device_count",
"torch.manual_seed",
"torch.cuda.is_available"
] | 1.0.5 | ksh981214/moses | 8a932ae578adb27c7f73ceb6f0de20acbe8196ff |
1.9 | import torch
def load_checkpoint(checkpoint_path: str, device: str):
"""Load checkpoint from file.
Args:
checkpoint_path (str): Path to checkpoint file
device (str): Device to load checkpoint on
"""
if "cpu" in device:
checkpoint = torch.load(checkpoint_path, map_location=torch... | [
"torch.device",
"torch.load"
] | 1.9.0 | mintusf/land_cover_tracking | e1c389729fdb628e4d34e0d427f43f6317eba4ee |
1.8 | import itertools
import json
from dataclasses import dataclass
import numpy as np
import pandas as pd
import seqeval.metrics as seqeval_metrics
import torch
from scipy.stats import pearsonr
from scipy.stats import spearmanr
from sklearn.metrics import f1_score
from sklearn.metrics import matthews_corrcoef
from typin... | [
"torch.cuda.is_available"
] | 1.8.1 | mfk3138/jiant | 6e67ff1ecb1bb98533c1019a86af4ad2c04c6a64 |
1.4 | import torch
import torch.nn as nn
from ..attack import Attack
class MIFGSM(Attack):
r"""
MI-FGSM in the paper 'Boosting Adversarial Attacks with Momentum'
[https://arxiv.org/abs/1710.06081]
Distance Measure : Linf
Arguments:
model (nn.Module): model to attack.
eps (float): maxi... | [
"torch.clamp",
"torch.autograd.grad",
"torch.zeros_like",
"torch.nn.CrossEntropyLoss",
"torch.nn.Flatten"
] | 1.4.0 | spokV/adversarial-attacks-pytorch | 2fa41799e38de2e318f4ba5f7815fba6610fc9af |
1.4 | # MIT License
#
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation th... | [
"torch.empty",
"torch.from_numpy"
] | 1.4.0 | jerryzhao173985/SMARTS | c8473049b4b52ad3eb29f7c7eb93753c2d70df55 |
1.6 | import pytest
import torch
import torch.nn.functional as F
from d3rlpy.models.encoders import DefaultEncoderFactory
from d3rlpy.models.torch.imitators import (
ConditionalVAE,
DeterministicRegressor,
DiscreteImitator,
ProbablisticRegressor,
)
from .model_test import DummyEncoder, check_parameter_updat... | [
"torch.rand",
"torch.nn.functional.log_softmax",
"torch.nn.functional.mse_loss",
"torch.ones",
"torch.randint",
"torch.nn.functional.nll_loss"
] | 1.6.0 | mcx/d3rlpy | 9867803a096b8a90e376443a0ffabb4765f38145 |
1.0 | import math
import torch
import torch.nn as nn
from deepke.model import BasicModule, Embedding
class DotAttention(nn.Module):
'''
\text {Attention }(Q, K, V)=\operatorname{softmax}\left(\frac{Q K^{T}}{\sqrt{d_{k}}}\right) V
'''
def __init__(self, dropout=0.0):
super(DotAttention, self).__init_... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"torch.nn.Softmax",
"torch.manual_seed",
"torch.nn.ReLU",
"torch.matmul",
"torch.randn"
] | 1.0 | napoler/deepke | 4d32527a22b7664600fe06fb5e24e1bedaaba97d |
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"
] | 1.3.1 | victorjoos/lightning-metrics | f06488faf79d4f4792cd392e964870d4898dde45 |
1.4 | import os
import warnings
from pathlib import Path
import torch
from torchaudio._internal import module_utils as _mod_utils # noqa: F401
_LIB_DIR = Path(__file__).parent / 'lib'
def _get_lib_path(lib: str):
suffix = 'pyd' if os.name == 'nt' else 'so'
path = _LIB_DIR / f'{lib}.{suffix}'
return path
de... | [
"torch.ops.load_library",
"torch.classes.load_library"
] | 1.4.0 | StatsGary/audio | 0a701058b432dd602bba3461866bfb3c3a352e04 |
1.0 | import torch
import torch.utils.model_zoo as model_zoo
import os
from collections import OrderedDict
def load_checkpoint(model, checkpoint_path, use_ema=False):
if checkpoint_path and os.path.isfile(checkpoint_path):
checkpoint = torch.load(checkpoint_path)
state_dict_key = ''
if isinstanc... | [
"torch.utils.model_zoo.load_url",
"torch.load"
] | 1.0 | bermanmaxim/pytorch-image-models | 1d7f2d93a68bdc3c5d8d634d869709f6cdd7cecd |
1.9 | import argparse
import os
from pathlib import Path
import torch
from torch.utils.data import DataLoader
import torchvision.transforms as T
from tqdm import tqdm
from torchvision.datasets import CIFAR10, CIFAR100, STL10, ImageNet, ImageFolder
import numpy as np
import pandas as pd
from models.neuralhash import NeuralH... | [
"torch.device",
"torch.no_grad",
"torch.sign",
"torch.utils.data.DataLoader",
"torch.load"
] | 1.9.0 | ml-research/Learning-to-Break-Deep-Perceptual-Hashing | 12148e8ecd47faa1f816f52f56662c47cd240cc1 |
0.4 | import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.optim import lr_scheduler
###############################################################################
# Helper Functions
###############################################################################
def get_norm_layer(norm... | [
"torch.cat",
"torch.optim.lr_scheduler.StepLR",
"torch.nn.LeakyReLU",
"torch.nn.init.kaiming_normal_",
"torch.cuda.is_available",
"torch.nn.DataParallel",
"torch.sum",
"torch.nn.Softmax",
"torch.nn.init.constant_",
"torch.nn.ConvTranspose2d",
"torch.abs",
"torch.nn.init.normal_",
"torch.tens... | 0.4.0 | linlih/colorization-pytorch | f3fd558d4b99d253988ea7ac8389f6842daa4315 |
1.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.no_grad",
"torch.cuda.get_device_name",
"torch.cuda.device",
"torch.optim.lr_scheduler.ReduceLROnPlateau"
] | 1.4.0 | mkim55/BleedDetection | 93eb5c08ab210b76ae554a5d7b3ffc8bdc7e3180 |
1.2 | from __future__ import absolute_import, division, print_function
import argparse
import csv
import logging
import os
import sys
from collections import defaultdict
import pandas as pd
import numpy as np
import torch
from torch.utils.data import (DataLoader, SequentialSampler,
TensorDatas... | [
"torch.no_grad",
"torch.utils.data.SequentialSampler",
"torch.cuda.device_count",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"torch.tensor",
"torch.load",
"torch.utils.data.TensorDataset"
] | 1.2.0 | derosejf/RedditHumorDetection | 48d93df7df82a8cab0fb3981a74b4c9448e7b555 |
1.0 | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and 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 copy of the License... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.cat",
"torch.nn.LayerNorm",
"torch.nn.MSELoss",
"torch.nn.Softmax",
"torch.arange",
"torch.nn.CrossEntropyLoss",
"torch.ne",
"torch.from_numpy",
"torch.ones",
"torch.tensor",
"torch.matmul",
"torch.nn.Embedding"
] | 1.0 | gp201/transformers | 89f2781e87e92b04303f7f128107718e44e755ed |
1.0 | from typing import Optional, Union, List, Callable
import logging
import torch
from torch.distributions import Poisson, Gamma, Bernoulli, Normal
from torch.utils.data import DataLoader
import numpy as np
import pandas as pd
from scipy.stats import spearmanr
from scvi.inference import Posterior
from . import Unsupervis... | [
"torch.cat",
"torch.stack",
"torch.distributions.Bernoulli",
"torch.exp",
"torch.sum",
"torch.sigmoid",
"torch.Size",
"torch.utils.data.DataLoader",
"torch.zeros_like",
"torch.nonzero",
"torch.nn.LogSoftmax",
"torch.distributions.Gamma",
"torch.no_grad",
"torch.optim.Adam",
"torch.distri... | 1.0.1 | chenlingantelope/scVI_TSP | c89c35002205b1169a740da06ec691a3d4f4d405 |
1.7 | from functools import partial
import numpy as np
import torch
import torch.nn as nn
from typing import Callable, Union
from alibi_detect.utils.prediction import tokenize_transformer
def predict_batch(x: Union[list, np.ndarray, torch.Tensor], model: Union[Callable, nn.Module, nn.Sequential],
device: ... | [
"torch.cuda.is_available",
"torch.no_grad",
"torch.from_numpy"
] | 1.7.0 | arnaudvl/alibi-detect | 573ef3be3435c834489a7b4f2d23e580c8a0a2a2 |
1.5 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Backbone modules.
"""
from collections import OrderedDict
import torch
import torch.nn.functional as F
import torchvision
from torch import nn
from torchvision.models._utils import IntermediateLayerGetter
from typing import Dict, List
from uti... | [
"torch.zeros",
"torch.ones"
] | 1.5.0 | bjuncek/detr | a1bd3788ca16fb8dc92f7e69b2d801259ecec8f9 |
2.5 | from copy import copy
from typing import List
import numpy as np
import torch
import torch.optim as optim
import torchvision.transforms as T
import yaml
from matplotlib.pyplot import fill
import wandb
from attacks.initial_selection import find_initial_w
from utils.wandb import load_model
class AttackConfigParser:
... | [
"torch.repeat_interleave",
"torch.full",
"torch.cuda.is_available",
"torch.tensor",
"torch.load"
] | 2.5.2 | LukasStruppek/Plug-and-Play-Attacks | f433f97531a5fb3e6f82965ecdde504e0eb1c4ab |
1.3 | import argparse
import torch
import pyro
import pyro.distributions as dist
from pyro.infer.mcmc.api import MCMC
from pyro.infer.mcmc import NUTS
"""
This simple example is intended to demonstrate how to use an LKJ prior with
a multivariate distribution.
It generates entirely random, uncorrelated data, and then attem... | [
"torch.zeros",
"torch.randn",
"torch.multiprocessing.set_sharing_strategy",
"torch.ones"
] | 1.3.0 | jrmcornish/pyro | 38914d5eb596dc140e226031534ff4ea7903dc35 |
1.8 | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from dgl.nn.pytorch import GraphConv, HeteroGraphConv
from openhgnn.models.macro_layer.SemanticConv import SemanticAttention
from ..models.layers import homo_layer_dict
class HeteroGeneralLayer(nn.Module):
'''General wrapper for layers'... | [
"torch.nn.Sequential",
"torch.nn.Dropout",
"torch.nn.BatchNorm1d"
] | 1.8.1 | guyuisland/OpenHGNN | ab25b83431fed760136e122b442ca4470eb9522c |
1.4 | """ Activations
A collection of activations fn and modules with a common interface so that they can
easily be swapped. All have an `inplace` arg even if not used.
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch
from torch import nn as nn
from torch.nn import functional as F
def swish(x, inplace:... | [
"torch.nn.functional.relu6",
"torch.nn.functional.softplus",
"torch.nn.functional.gelu",
"torch.nn.functional.silu",
"torch.nn.functional.prelu"
] | 1.4.0 | scottclowe/pytorch-image-models | 3dbeb84b3e02bf1d5dc289bd9fc0ca5682332956 |
1.1 | import abc
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
import utils
class ContinualLearner(nn.Module, metaclass=abc.ABCMeta):
'''Abstract module to add continual learning capabilities to a classifier.'''
def __init__(self):
super().__init__()
... | [
"torch.LongTensor",
"torch.nn.functional.log_softmax"
] | 1.1.0 | hillshadow/continual-learning-for-HAR | 21aeb99efa4bebf8f3f9f00f4452a8fd91e20c75 |
1.4 | from typing import Tuple
import pandas as pd
import torch
from genrl.utils.data_bandits.base import DataBasedBandit
from genrl.utils.data_bandits.utils import download_data, fetch_data_with_header
URL = "https://archive.ics.uci.edu/ml/machine-learning-databases/census1990-mld/USCensus1990.data.txt"
class CensusDat... | [
"torch.tensor"
] | 1.4.0 | matrig/genrl | 25eb018f18a9a1d0865c16e5233a2a7ccddbfd78 |
1.9 | #!/usr/bin/env python
"""
Copyright 2018 Johns Hopkins University (Author: Jesus Villalba)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
import sys
import os
from pathlib import Path
from jsonargparse import (
ArgumentParser,
ActionConfigFile,
ActionParser,
namespace_to_dict,
)
import... | [
"torch.manual_seed",
"torch.utils.data.DataLoader"
] | 1.9.0 | hyperion-ml/hyperion | c4c9eee0acab1ba572843373245da12d00dfffaa |
1.0 | from pathlib import Path
import hydra
import torch
from hydra.utils import to_absolute_path
from omegaconf import DictConfig
from torch import nn
from ttslearn.train_util import (
collate_fn_dnntts,
get_epochs_with_optional_tqdm,
save_checkpoint,
setup,
)
from ttslearn.util import make_non_pad_mask
d... | [
"torch.finfo",
"torch.sort",
"torch.cuda.is_available",
"torch.nn.MSELoss"
] | 1.0.0 | kunosato-mado/ttslearn | 1230ce8d5256a7438c485a337968ce086620a88e |
1.7 | import argparse
import os
import pickle as pkl
import numpy as np
import torch
from statsmodels.tsa.arima_process import ArmaProcess
from attribution.mask_group import MaskGroup
from attribution.perturbation import GaussianBlur
from baselines.explainers import FO, FP, IG, SVS
from utils.losses import mse
explainers ... | [
"torch.zeros",
"torch.manual_seed",
"torch.cuda.is_available",
"torch.tensor"
] | 1.7.1 | vanderschaarlab/Dynamask | b3b190b2ee79c4ecf6c1302b6a3efe6250f094b8 |
0.4 | """
Assorted utilities for working with neural networks in AllenNLP.
"""
# pylint: disable=too-many-lines
from collections import defaultdict
from typing import Any, Dict, List, Optional, Sequence, Tuple, TypeVar
import logging
import copy
import math
import torch
from allennlp.common.checks import ConfigurationError... | [
"torch.zeros",
"torch.cos",
"torch.cat",
"torch.stack",
"torch.arange",
"torch.max",
"torch.gather",
"torch.nn.utils.rnn.pad_sequence",
"torch.sin",
"torch.cuda.LongTensor",
"torch.nn.functional.log_softmax",
"torch.nn.functional.softmax",
"torch.zeros_like",
"torch.matmul",
"torch.exp",... | 0.4.1 | shellshock1911/allennlp | 79e2cf7b677f84daefaf63acc2a8e3833782de23 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.