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 | # -*- coding: utf-8 -*-
"""
@Time : 2021/1/14 下午5:34
@FileName: bert.py
@author: 王炳宁
@contact: wangbingning@sogou-inc.com
"""
import sys
import time
import apex
import torch
import torch.distributed as dist
from apex import amp
sys.path.append('..')
from modules.BERT import Bert
from train.parser import get_ar... | [
"torch.distributed.get_world_size",
"torch.eq",
"torch.distributed.init_process_group",
"torch.FloatTensor",
"torch.no_grad",
"torch.manual_seed",
"torch.cuda.set_device",
"torch.LongTensor",
"torch.tensor",
"torch.distributed.reduce",
"torch.distributed.get_rank",
"torch.distributed.barrier"
... | 1.6.0 | benywon/ComQA | 6731d63d16b731d6c3654b2dc7d2503cf333127f |
1.1 | import torch.nn as nn
from .gen_resblock import GenBlock
class Generator(nn.Module):
def __init__(self, args, activation=nn.ReLU(), n_classes=0):
super(Generator, self).__init__()
self.bottom_width = args.bottom_width
self.activation = activation
self.n_classes = n_classes
... | [
"torch.nn.Linear",
"torch.nn.Softmax",
"torch.nn.AvgPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.Tanh",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.utils.spectral_norm"
] | 1.1.0 | sudarshanregmi/ICRGAN-and-SSGAN | c9e7b01d89cba19505e566892a678932717b8039 |
1.8 | from typing import Iterable, Optional, Sequence
import numpy as np
import torch
from torch.distributions import Categorical, Normal
from torch.distributions import kl_divergence as kl
from torch.nn import functional as F
from scvi import _CONSTANTS
from scvi._compat import Literal
from scvi.module.base import LossRec... | [
"torch.distributions.Categorical",
"torch.sqrt",
"torch.distributions.Normal",
"torch.ones",
"torch.tensor",
"torch.ones_like",
"torch.zeros_like",
"torch.log",
"torch.mean"
] | 1.8.0 | jules-samaran/scvi-tools | 7dcbb819cdc6a7991469fdca6b292276c59a946d |
2.0 | #!/usr/bin/env python3
import argparse
import datetime
import os
import pickle
import pprint
import numpy as np
import torch
from torch.utils.tensorboard import SummaryWriter
from examples.atari.atari_network import QRDQN
from examples.atari.atari_wrapper import make_atari_env
from examples.offline.utils import load... | [
"torch.manual_seed",
"torch.cuda.is_available",
"torch.load",
"torch.utils.tensorboard.SummaryWriter"
] | 2.0.0 | BFAnas/tianshou | 6e86a0bed7d1117c5ad6a421b483b45a6adfe336 |
1.4 | import torch
import torch.nn as nn
import torch.nn.functional as F
from convs.dyres_conv import *
from convs.condconv import *
__all__ = ['DyResA_ResNet18']
class DyRes_BasicBlock(nn.Module):
expansion = 1
def __init__(self, in_channels, channels, stride=1, num_experts=3):
super().__init__()
... | [
"torch.nn.Linear",
"torch.nn.functional.avg_pool2d",
"torch.nn.Sequential",
"torch.nn.BatchNorm2d",
"torch.nn.Conv2d",
"torch.nn.functional.relu",
"torch.randn"
] | 1.4.0 | Nyquixt/DyConv | 255193068424aaa83352bee258d34cb8b32b6ee6 |
1.4 | import torch
import torch.nn as nn
import torch.nn.functional as F
__all__ = ['CondConv_Inf']
class route_func(nn.Module):
def __init__(self, in_channels, num_experts):
super().__init__()
self.avgpool = nn.AdaptiveAvgPool2d(1)
self.fc = nn.Linear(in_channels, num_experts)
self.sig... | [
"torch.nn.Linear",
"torch.nn.Sigmoid",
"torch.nn.AdaptiveAvgPool2d",
"torch.Tensor",
"torch.nn.functional.conv2d",
"torch.randn"
] | 1.4.0 | Nyquixt/DyConv | 255193068424aaa83352bee258d34cb8b32b6ee6 |
1.9 | import torch
import torch.nn as nn
class CosineSimilarity:
"""
Cosine similarity between the two vector.
Given two vector v1 and v2, the cosine similarity between the two vector
is the cosine of theta, where the theta is the angle between the two vector on therir inner product space.
The cosine ... | [
"torch.nn.Linear",
"torch.nn.init.xavier_normal_"
] | 1.9.1 | helloybz/CLANE | 60e6f0503642ac63d3bcde136885e47954067c17 |
1.6 | import os
from typing import Text
import torch
import unittest
import torch.nn as nn
import torch.optim as optim
from allennlp.models import Model
from allennlp.data.vocabulary import Vocabulary
from zsl_kg.class_encoders.auto_gnn import AutoGNN
from zsl_kg.example_encoders.text_encoder import TextEncoder
from zsl_kg... | [
"torch.nn.Linear",
"torch.nn.ReLU",
"torch.tensor",
"torch.load",
"torch.nn.CrossEntropyLoss"
] | 1.6.0 | BatsResearch/zsl-kg | 9bc4d4537a0f90ee3bbcefdf90ceae6dbcf48572 |
1.6 | import unittest
from zsl_kg.common.graph import NeighSampler
import torch
from allennlp.common.params import Params
from zsl_kg.knowledge_graph.conceptnet import ConceptNetKG
from zsl_kg.gnn.attention_agg import AttnAggregator
class TestAttnAggregator(unittest.TestCase):
def setUp(self) -> None:
params =... | [
"torch.tensor",
"torch.randn"
] | 1.6.0 | BatsResearch/zsl-kg | 9bc4d4537a0f90ee3bbcefdf90ceae6dbcf48572 |
1.3 | #!/h/haoran/anaconda3/bin/python
import sys
import os
sys.path.append(os.getcwd())
import pandas as pd
import numpy as np
import argparse
import Constants
import torch
import torch.nn as nn
from torch.utils import data
import pickle
from pytorch_pretrained_bert import BertTokenizer, BertModel
from run_classifier_datase... | [
"torch.nn.Linear",
"torch.nn.ModuleList",
"torch.cuda.is_available",
"torch.nn.CrossEntropyLoss",
"torch.nn.DataParallel",
"torch.nn.Softmax",
"torch.manual_seed",
"torch.utils.data.DataLoader",
"torch.nn.BCELoss",
"torch.tensor",
"torch.cuda.manual_seed_all",
"torch.cuda.device_count",
"tor... | 1.3.0 | MLforHealth/HurtfulWords | b59181585aa70152f0fbe79fa2611ded928bf9f1 |
1.4 | # Copyright (c) 2020, Soohwan Kim. 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 la... | [
"torch.hamming_window",
"torch.FloatTensor",
"torch.Tensor"
] | 1.4.0 | jungwook518/KoSpeech | 77b8daf2f821c8fa755e937096fdbc3536cafd81 |
1.4 | import torch
import numpy as np
from hipo_rank import Embeddings, SentenceEmbeddings, SectionEmbedding, \
PairIndices, SentenceSimilarities, SectionSimilarities, Similarities
from typing import List, Tuple
from numpy import ndarray
class CosSimilarity:
def __init__(self, threshold = 0):
self.threshol... | [
"torch.cosine_similarity",
"torch.from_numpy"
] | 1.4 | mukul-mehta/HipoRank | b44490c4f1f3e0ff8015e3eb0f2b1955947dfe80 |
1.9 | import torch
import torch.nn as nn
from vformer.functional import PatchMerging
from vformer.utils import ENCODER_REGISTRY
encoder_modules = ENCODER_REGISTRY.get_list()
def test_VanillaEncoder():
test_tensor = torch.randn(2, 65, 1024)
encoder = ENCODER_REGISTRY.get("VanillaEncoder")(
embedding_dim=1... | [
"torch.randn"
] | 1.9.0 | aditya-agrawal-30502/vformer | e1f4950f980238442ff1dc39a8f0791e4fbc9dac |
1.1 | import glob
import os
import torch
import tqdm
import time
from torch.nn.utils import clip_grad_norm_
from pcdet.utils import common_utils, commu_utils
def train_one_epoch(cur_epoch,model, optimizer, train_loader, model_func, lr_scheduler, accumulated_iter, optim_cfg,
rank, tbar, total_it_each_ep... | [
"torch.save"
] | 1.1 | Bilal-A-Qureshi/OpenPCDet | 633c6026e56fc3fb2112f2a9f7ce08a21619e78f |
1.9 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 5, 2)
self.conv2 = nn.Conv2d(32, 64, 7, 3)
self.dropout1 = nn.Dropout2d(0.25)
self.dropout2 = nn.Dropout2d(0... | [
"torch.nn.Linear",
"torch.flatten",
"torch.nn.functional.log_softmax",
"torch.nn.Conv2d",
"torch.nn.functional.relu",
"torch.nn.functional.max_pool2d",
"torch.nn.Dropout2d"
] | 1.9.0 | evanaze/captcha | 62d226742be7f4091e54a7ea960703812bd44fd5 |
1.6 | 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 pair(t):
return t if isinstance(t, tuple) else (t, t)
# classes
class PreNorm(nn.Module):
def __init__(self, dim, fn):
super().__ini... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"torch.nn.Identity",
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.Softmax",
"torch.einsum",
"torch.finfo",
"torch.nn.GELU",
"torch.randn"
] | 1.6 | rocke2020/vit-pytorch | a1f828da0c952fa56a90a71f7c88c8e0025c1d42 |
1.4 | import torch
import os
import numpy as np
import cv2
from PIL import Image
from collections import defaultdict
from tqdm import tqdm
import mcubes
import open3d as o3d
from plyfile import PlyData, PlyElement
from argparse import ArgumentParser
from models.rendering import *
from models.nerf import *
from utils import... | [
"torch.cat",
"torch.norm",
"torch.FloatTensor",
"torch.zeros_like",
"torch.no_grad",
"torch.ones_like"
] | 1.4.0 | U-sepSick/NeRF | c5910f84321eb5f72e3332507b0384f1b23f51f7 |
0.4 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace 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... | [
"torch.nn.Linear",
"torch.sigmoid",
"torch.nn.Dropout",
"torch.cat",
"torch.zeros",
"torch.sqrt",
"torch.arange",
"torch.nn.Conv1d",
"torch.nn.Softmax",
"torch.nn.Tanh",
"torch.nn.CrossEntropyLoss",
"torch.nn.init.xavier_uniform_",
"torch.ones",
"torch.load",
"torch.ones_like",
"torch.... | 0.4.1 | ankit-ai/BertQA-Attention-on-Steroids | 49c3de360f88f55c8442b9f8153af56c28a689a9 |
1.11 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from collections import OrderedDict
import pytest
import funsor
from funsor.domains import Bint
from funsor.einsum import (
einsum,
naive_contract_einsum,
naive_einsum,
naive_plated_einsum,
)
from funsor.interpretatio... | [
"torch.allclose"
] | 1.11.0 | fritzo/funsor | 1d07af18c21894dd56e2f4f877c7845430c3b729 |
1.9 | # Copyright 2021 MosaicML. All Rights Reserved.
"""Core ColOut classes and functions."""
from __future__ import annotations
import logging
import textwrap
import weakref
from typing import TypeVar
import torch
from PIL.Image import Image as PillowImage
from torchvision.datasets import VisionDataset
from composer.a... | [
"torch.randperm"
] | 1.9 | anisehsani/composer | 42599682d50409b4a4eb7c91fad85d67418cee13 |
1.0 | """
Functions are modified on top of GFLA.
GFLA's license: https://github.com/RenYurui/Global-Flow-Local-Attention/blob/master/LICENSE.md
"""
import torch
import torch.nn as nn
import torchvision.models as models
import torch.nn.functional as F
import os
import torchvision.transforms as transforms
import numpy as np
... | [
"torch.stack",
"torch.bmm",
"torch.nn.BCEWithLogitsLoss",
"torch.exp",
"torch.sum",
"torch.nn.functional.avg_pool2d",
"torch.tensor",
"torch.nn.functional.conv2d",
"torch.zeros",
"torch.max",
"torch.nn.Sequential",
"torch.nn.functional.cosine_similarity",
"torch.rand",
"torch.nn.MSELoss",
... | 1.0.0 | fyviezhao/dressing-in-order | 63790663ad0420d9d2dabed22d5c56dd40422313 |
1.8 | import os
import torch
import torchvision.transforms as transforms
import torchvision.utils as vutils
from PIL import Image
from abc import abstractmethod
from numpy import inf
from logger import TensorboardWriter
from model.esrgan.utils.utils import MODEL_KEY, GENERATOR_KEY, DISCRIMINATOR_KEY
from test import save_pre... | [
"torch.save",
"torch.no_grad",
"torch.load"
] | 1.8.0 | Lo1s/superresolution | 18052465694bfc2543b9af71d8012d854a516d1a |
1.7 | import torch
import torchaudio
import torchvision
from torchvision import transforms
import nltk
from nltk.stem import WordNetLemmatizer
from collections import defaultdict
# from allennlp.predictors.predictor import Predictor
# import allennlp_models.structured_prediction
import numpy as np
import re
import os
import ... | [
"torch.cat",
"torch.stack",
"torch.isnan",
"torch.nn.utils.rnn.pad_sequence",
"torch.FloatTensor"
] | 1.7.1 | lwang114/InformationQuantizer | 45419140708e612495fd324a9e5724306d4d4129 |
0.4 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# 这个是做cities 问题的
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(G... | [
"torch.zeros",
"torch.Size",
"torch.nn.Dropout",
"torch.cat",
"torch.isnan",
"torch.nn.LeakyReLU",
"torch.nn.functional.dropout",
"torch.nn.init.xavier_uniform_",
"torch.nn.functional.elu",
"torch.mm",
"torch.ones",
"torch.sparse_coo_tensor",
"torch.nn.functional.softmax",
"torch.ones_like... | 0.4.1 | zhangbo2008/GAT_network | c871a2aceceaa5d638c96c21d23d64ed07c07b4c |
1.10 | import os
import pickle
import random
import zlib
from os import path
from typing import List, Optional
import pandas as pd
import torch
from transformers import DistilBertTokenizerFast
import wandb
from artificial_detection.data.data import BinaryDataset, TextDetectionDataset
class MockDataset:
"""
Mock da... | [
"torch.manual_seed",
"torch.cuda.manual_seed_all"
] | 1.10.0 | MaratSaidov/artificial-text-detection | 74b2100294232ec361db84fdc3a24fdeba1fce49 |
1.7 | # ------------------------------------------------------------------------
# Conditional DETR
# Copyright (c) 2021 Microsoft. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 [see LICENSE for details]
# ------------------------------------------------------------------------
# Copied from DETR (htt... | [
"torch.nn.init.uniform_",
"torch.cat",
"torch.nn.Embedding",
"torch.arange"
] | 1.7.0 | miranmanesh/ConditionalDETR | c7d24c221125daa6322adc9915af77701240f063 |
1.8 | """
Adapted from the original WHAMR script to obtain the Room Impulse ResponsesRoom Impulse Responses
Authors
* Cem Subakan 2021
"""
import os
import pandas as pd
import argparse
import torchaudio
from recipes.WHAMandWHAMR.meta.wham_room import WhamRoom
from scipy.signal import resample_poly
import torch
from spe... | [
"torch.from_numpy"
] | 1.8.0 | JasonSWFu/speechbrain | cb78ba2b33fceba273b055dc471535344c3053f0 |
1.8 | """Library implementing complex-valued convolutional neural networks.
Authors
* Titouan Parcollet 2020
"""
import torch
import torch.nn as nn
import logging
import torch.nn.functional as F
from speechbrain.nnet.CNN import get_padding_elem
from speechbrain.nnet.complex_networks.c_ops import (
unitary_init,
com... | [
"torch.nn.functional.pad",
"torch.Tensor"
] | 1.8.0 | JasonSWFu/speechbrain | cb78ba2b33fceba273b055dc471535344c3053f0 |
1.3 | import os
import sys
# path at level marl/
sys.path.insert(0, os.path.abspath("."))
import time
import argparse
import numpy as np
from functools import partial
from collections import OrderedDict, defaultdict
import torch
# local
from algorithms.masac.utils import get_sample_scheme, dispatch_samples
from algorithms... | [
"torch.set_num_threads"
] | 1.3.1 | Justin-Yuan/learn-to-interact | eb013bb3bab269bda8a8075e64fe3bcd2964d8ae |
1.3 | import os
import sys
# path at level marl/
sys.path.insert(0, os.path.abspath("."))
import time
import argparse
import numpy as np
from functools import partial
from collections import OrderedDict, defaultdict
import torch
# local
from algorithms.rmaddpg.utils import get_sample_scheme, dispatch_samples
from algorith... | [
"torch.set_num_threads"
] | 1.3.1 | Justin-Yuan/learn-to-interact | eb013bb3bab269bda8a8075e64fe3bcd2964d8ae |
1.4 | '''
super slomo
code refered from https://github.com/avinashpaliwal/Super-SloMo.git
'''
# pylint: disable=E1101
import logging
import torch
from slomo import UNet, backWarp
from imageProcess import initModel, getStateDict, getPadBy32, doCrop, identity, Option, extend
from config import config
log = logging.getLogger('... | [
"torch.sigmoid",
"torch.cat",
"torch.stack"
] | 1.4 | lotress/MoePhoto | 6f47515d2cf236773a46413f57839565fa665796 |
1.1 | #!/usr/bin/env python3
"""
File: anilkfo_cifarfs.py
Author: Seb Arnold - seba1511.net
Email: smr.arnold@gmail.com
Github: seba-1511
Description:
Demonstrates how to use the low-level differentiable optimization utilities
to implement ANIL+KFC on CIFAR-FS.
A demonstration of the high-level API is available in:
exa... | [
"torch.nn.Linear",
"torch.device",
"torch.cuda.manual_seed",
"torch.optim.Adam",
"torch.from_numpy",
"torch.manual_seed",
"torch.cuda.device_count",
"torch.nn.CrossEntropyLoss"
] | 1.1.0 | Brikwerk/learn2learn | c0b7c088f15986880b136ec27059644ac513db60 |
1.5 | #!/usr/bin/env python
# coding: utf-8
from tqdm import tqdm
import os
import torch
import torchvision
import torchvision.transforms as transforms
from torch import nn
from torch.nn import functional as F
from torch.utils.data import DataLoader
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.style.use("d... | [
"torch.argmax",
"torch.no_grad",
"torch.save",
"torch.utils.data.DataLoader",
"torch.nn.functional.softmax",
"torch.nn.functional.nll_loss",
"torch.nn.CrossEntropyLoss"
] | 1.5.0 | kckishan/Depth_and_Dropout | 64bbff9169d588486d92946485e108342daa29b0 |
0.4 | """CLI and utils for training a batch of models and analysing hyper parameter tuning results"""
import train
import models
import data_processor as dp
import commons
import argparse
import torch
import os
import collections
def train_models(training_configs, email=False):
"""Train a batch of models"""
for i... | [
"torch.cuda.is_available"
] | 0.4.1 | rbiswas143/deep-audioviz-experiments-train | 294c648ca9115efce6127fb242ac3f6f51cdf532 |
1.2 | import numpy as np
import scipy.sparse as sp
import torch
from sklearn.model_selection import train_test_split
import torch.sparse as ts
import torch.nn.functional as F
import warnings
def encode_onehot(labels):
"""Convert label to onehot format.
Parameters
----------
labels : numpy.array
node... | [
"torch.cat",
"torch.LongTensor",
"torch.eye",
"torch.nn.functional.nll_loss",
"torch.exp",
"torch.Size",
"torch.FloatTensor",
"torch.zeros",
"torch.device",
"torch.clamp",
"torch.isinf",
"torch.log",
"torch.arange",
"torch.sparse.FloatTensor",
"torch.diag",
"torch.sparse.sum"
] | 1.2.0 | CrownX/DeepRobust | 276a7048aded2cf3a190d3851ffd4587b7d1dd49 |
1.10 | import logging
import os
from abc import ABC
from typing import Tuple, Any
import numpy as np
import torch
import torchvision
from pandas import read_csv
from torch.utils.data import Dataset, DataLoader
from torchvision.datasets import CIFAR10, CIFAR100
from torchvision.datasets.folder import pil_loader, accimage_load... | [
"torch.zeros",
"torch.cat",
"torch.nn.functional.one_hot",
"torch.stack",
"torch.device",
"torch.save",
"torch.no_grad",
"torch.tensor",
"torch.load"
] | 1.10.0 | jiahuei/cisip-FIRe | bcbda2b74dc5a0b26f0338f707a257d660b688a1 |
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.nn.Linear",
"torch.optim.lr_scheduler.OneCycleLR",
"torch.optim.lr_scheduler.StepLR",
"torch.optim.Adam",
"torch.optim.SGD",
"torch.nn.ReLU"
] | 1.6 | calebrob6/pytorch-lightning | 4c79b3a5b343866217784c66d122819c59a92c1d |
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.cuda.is_available",
"torch.nn.CrossEntropyLoss",
"torch.utils.data.DataLoader"
] | 1.6 | calebrob6/pytorch-lightning | 4c79b3a5b343866217784c66d122819c59a92c1d |
1.3 | import logging
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# torch.manual_seed(0)
# torch.backends.cudnn.deterministic = True
# torch.backends.cudnn.benchmark = False
from pyro.distributions import MultivariateNormal, Normal, Independent
from sklearn.cluster import KMeans, ... | [
"torch.nn.Linear",
"torch.cat",
"torch.stack",
"torch.ones",
"torch.squeeze",
"torch.cuda.is_available",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.load",
"torch.nn.RNN",
"torch.sum",
"torch.manual_seed",
"torch.abs",
"torch.tensor",
"torch.zeros_like",
"torch.zeros",
"torch.dev... | 1.3.0 | irenetrampoline/clustering-interval-censored | f6ab06a6cf3098ffe006d1b95d1b4f1d158b0bc4 |
1.2 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
fro... | [
"torch.arange",
"torch.bmm",
"torch.cuda.device_count",
"torch.squeeze",
"torch.nn.functional.cross_entropy",
"torch.cuda.is_available",
"torch.load",
"torch.nn.BCEWithLogitsLoss",
"torch.nn.DataParallel"
] | 1.2.0 | pbmstrk/BLINK | 7380cf7d63ff76563f017adc39fa5729ba36742a |
1.7 | import os
import torch
import numpy as np
import matplotlib.pyplot as plt
from unbalancedot.utils import euclidean_cost
from unbalancedot.sinkhorn import BatchVanillaSinkhorn
from unbalancedot.entropy import (
KullbackLeibler,
Balanced,
TotalVariation,
Range,
PowerEntropy,
)
path = os.getcwd() + ... | [
"torch.from_numpy"
] | 1.7 | thibsej/unbalanced-ot-functionals | bfd098e98ed10b90a36e0dbe7b099c1c31770931 |
1.6 | """Finetuning the library models for sequence classification on GLUE."""
import dataclasses
import logging
import os
import sys
from dataclasses import dataclass, field
from typing import Callable, Dict, Optional
import torch
import numpy as np
import transformers
from transformers import AutoConfig, AutoModelForSeq... | [
"torch.tensor"
] | 1.6.0 | leeyy2020/LM-BFF | 2c80b2ea3987c403c4d4abc6e202d280ea846210 |
1.5 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : train-duration.py
@Date : 2021/01/05, Tue
@Author : Atomicoo
@Version : 1.0
@Contact : atomicoo95@gmail.com
@License : (C)Copyright 2020-2021, ShiGroup-NLP-XMU
@Desc : Synthetize sentences into speech.
'''
__author__ = 'Atomicoo'
impo... | [
"torch.sqrt",
"torch.log10",
"torch.cuda.is_available",
"torch.tensor",
"torch.load"
] | 1.5.0 | f2re/FCH-TTS | 54ddee710694929d978943356fe913609ed0aab5 |
0.4 | from __future__ import absolute_import
import torch as tr
from base.dataloader import BaseDataLoader
from torchvision.datasets import MNIST, FashionMNIST
from torch.utils.data import Dataset
import torchvision.transforms as transforms
import numpy as np
class MnistDataLoader(BaseDataLoader):
def __init__(self, ... | [
"torch.load"
] | 0.4.1 | maharshi95/GANTree | 5541c5fb0ba3d856081c03f37870a85fdd654681 |
1.1 | # modify from mmcv and mmdetection
import warnings
import torch.nn as nn
from .norm import build_norm_layer
from .act import build_act_layer
from .registry import UTILS
conv_cfg = {
'Conv': nn.Conv2d,
# TODO: octave conv
}
def build_conv_layer(cfg, *args, **kwargs):
""" Build convolution layer
Ar... | [
"torch.nn.Sequential",
"torch.nn.Dropout2d"
] | 1.1.0 | E18301194/vedaseg | c62c8ea46dbba12f03262452dd7bed22969cfe4e |
0.4 | import argparse
import csv
import logging
import os
import sys
from ast import literal_eval
from datetime import datetime
import time
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.nn ... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"torch.optim.lr_scheduler.MultiStepLR",
"torch.utils.data.DataLoader",
"torch.load",
"torch.nn.CrossEntropyLoss",
"torch.nn.DataParallel"
] | 0.4.0 | yukuzntcva/Denoising-drone-rotors | 0122b020fc959dd3869b3863989fee3520aede73 |
1.2 | """
Copyright 2020 The Microsoft DeepSpeed Team
DeepSpeed library
Create a new wheel via the following command: python setup.py bdist_wheel
The wheel will be located at: dist/*.whl
"""
import os
import torch
from deepspeed import __version__ as ds_version
from setuptools import setup, find_packages
from torch.utils... | [
"torch.cuda.is_available",
"torch.__version__.split",
"torch.utils.cpp_extension.CUDAExtension"
] | 1.2 | sj6077/DeepSpeed | c70b472a68bc9ca387b14a1b35814c582d0ec94b |
1.4 | import os
import sys
import importlib
if importlib.util.find_spec('torch_itl') is None:
path_to_lib = os.getcwd()[:-15]
sys.path.append(path_to_lib)
from torch_itl.estimator import IQR
from torch_itl.kernel import Gaussian, LearnableGaussian
from torch_itl.model import DecomposableIdentity
from torch_itl.samp... | [
"torch.nn.Linear",
"torch.linspace",
"torch.nn.ReLU"
] | 1.4.0 | mathurinm/torch_itl | e3d92d753bd51ccf585029129110c93bbf9b5fd0 |
1.7 | import math
from torch import nn
import torch.nn.functional as F
import torch
import torchvision.models as models
def kp2gaussian(kp, spatial_size, kp_variance):
"""
Transform a keypoint into gaussian like representation
"""
mean = kp['value']
coordinate_grid = make_coordinate_grid(spatial_size, ... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.Unfold",
"torch.nn.ModuleList",
"torch.nn.BatchNorm2d",
"torch.eye",
"torch.nn.functional.pad",
"torch.exp",
"torch.sum",
"torch.nn.AvgPool2d",
"torch.nn.functional.adaptive_avg_pool2d",
"torch.nn.functional.relu",
"torch.nn.functional.conv2d",
"to... | 1.7.1 | shovelingpig/SAFA | 35cd638ab299e58ba303bf64874287abdbcf9fd6 |
1.9 | # this is derived from ClipDraw code
# CLIPDraw: Exploring Text-to-Drawing Synthesis through Language-Image Encoders
# Kevin Frans, L.B. Soros, Olaf Witkowski
# https://arxiv.org/abs/2106.14843
from DrawingInterface import DrawingInterface
import pydiffvg
import torch
import skimage
import skimage.io
import random
im... | [
"torch.zeros",
"torch.device",
"torch.no_grad",
"torch.optim.Adam",
"torch.cuda.is_available",
"torch.tensor"
] | 1.9.0 | q1qgames/pixray | 8bd73869af7979068aa7ff8402f5b3ab2b791255 |
1.1 | # Copyright 2019 Shigeki Karita
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Transformer speech recognition model (pytorch)."""
from argparse import Namespace
from distutils.util import strtobool
from itertools import groupby
import logging
import math
import numpy
import torch
from espnet.nets.as... | [
"torch.nonzero",
"torch.no_grad",
"torch.nn.Module.__init__",
"torch.from_numpy",
"torch.tensor",
"torch.jit.trace",
"torch.as_tensor",
"torch.topk"
] | 1.1.0 | HongYun0901/ESPnet | 44f78734034991fed4f42359f4d15f15504680bd |
1.0 | # coding=utf-8
# Copyright 2020 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
#
# Unless required by applicable... | [
"torch.no_grad",
"torch.load"
] | 1.0 | sunjiao123sun/transformers | c60e0e1ee45f4bf1017736b146c51729f120bb83 |
1.6 | #!/usr/bin/env python3
#
# Copyright (c) 2020 Mobvoi Inc. (authors: Fangjun Kuang)
# Xiaomi Corporation (authors: Haowen Qiu)
#
# See ../../../LICENSE for clarification regarding multiple authors
# To run this single test, use
#
# ctest --verbose -R index_test_py
import unittest
import... | [
"torch.device",
"torch.cuda.is_available",
"torch.tensor"
] | 1.6.0 | pzelasko/k2 | 2dbb3e09b152fcf98354c946baa271e5b57c8321 |
1.2 | # Copyright (c) 2019, salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: MIT
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
import os
import json
import torch
import torch.nn as nn
from .base import StochasticAgent
from agents.maze_agents.toy_m... | [
"torch.arange",
"torch.log",
"torch.no_grad",
"torch.nn.Softmax"
] | 1.2.0 | victorcampos7/edl | ffdf23d4e102ca7d69a1408bafa267b0c7d8bfa0 |
3 | import os
from tempfile import NamedTemporaryFile
import h5py
import numpy as np
import torch
from pytorch3dunet.datasets.utils import get_train_loaders
from pytorch3dunet.train import _create_optimizer, _create_lr_scheduler
from pytorch3dunet.unet3d.losses import get_loss_criterion
from pytorch3dunet.unet3d.metrics ... | [
"torch.cuda.is_available"
] | 3 | flavell-lab/pytorch-3dunet | f6b6c13cb0bb6194e95976b0245b76aaa9e9a496 |
1.6 | from torch.nn import functional as F
from torch import nn
import torch
import numpy as np
from utils import layer
from radam import RAdam
from vpn import MVProp
import utils
from torch_critic import Critic as ClassicCritic
class CriticModel(nn.Module):
def __init__(self, env, layer_number, FLAGS):
super().... | [
"torch.mul",
"torch.min",
"torch.max",
"torch.no_grad",
"torch.clamp",
"torch.abs",
"torch.ones_like",
"torch.mean"
] | 1.6.0 | christsa/hide-rl | 47dc3dfd93b817831473c07137a6a6e7f2eda549 |
1.0 | import unittest
import torch
import pyprob
from pyprob import util
from pyprob.nn import EmbeddingFeedForward, EmbeddingCNN2D5C, EmbeddingCNN3D5C
class NNTestCase(unittest.TestCase):
def test_nn_EmbeddingFeedForward(self):
batch_size = 32
input_shape = [100, 100]
output_shape = [128]
... | [
"torch.zeros",
"torch.Size"
] | 1.0.0 | probprog/pyprob | 0713ff6d25e5db475a5b97d8d5e87bf70e977599 |
1.1 | import torch
import numpy as np
def masked_mae_loss(y_pred, y_true):
mask = (y_true != 0).float()
mask /= mask.mean()
loss = torch.abs(y_pred - y_true)
loss = loss * mask
# trick for nans: https://discuss.pytorch.org/t/how-to-set-nan-in-tensor-to-0/3918/3
loss[loss != loss] = 0
return loss... | [
"torch.isnan",
"torch.abs",
"torch.zeros_like",
"torch.mean"
] | 1.1 | kevin-xuan/Traffic-Benchmark | b9f8e40b4df9b58f5ad88432dc070cbbbcdc0228 |
1.9 | import torch
from .utils import periodic_dis
def compute_idx_of_sufficient_stat(L, J, dj, dl, dn):
L2 = L * 2
idx_j1, idx_j2, idx_k1, idx_k2, idx_ell2, idx_dn1, idx_dn2 = [], [], [], [], [], [], []
idx_lists = (idx_j1, idx_j2, idx_k1, idx_k2, idx_ell2, idx_dn1, idx_dn2)
# j1=j2, k1=0,1, k2=0 or 1
... | [
"torch.tensor"
] | 1.9.0 | Eralys/pywph_dev | bb864050c73b168c32a59f37ac0aca71ff159aed |
1.6 | import gc
import os
import pickle as pkl
from captum import attr
import numpy as np
from captum.attr import IntegratedGradients
from datasets import Dataset
import torch
import torch.nn.functional as F
from tqdm.auto import tqdm
import collections
import numpy as np
from transformers import Trainer
import argparse
f... | [
"torch.device",
"torch.tensor",
"torch.nn.functional.softmax",
"torch.linalg.norm",
"torch.sum"
] | 1.6.0 | gchhablani/toxic-spans-detection | 5eeba0c069bef8c707d9c5fef8c6048c98d89ba5 |
1.9 | import argparse
import torch
import glob
from pig.models import PeppaPig
import pig.data
import pytorch_lightning as pl
import logging
from torch.utils.data import DataLoader
from dataclasses import dataclass
import pandas as pd
import numpy as np
import torch
import random
import yaml
from copy import deepcopy
rando... | [
"torch.cat",
"torch.save",
"torch.manual_seed",
"torch.eye",
"torch.load"
] | 1.9.1 | mitjanikolaus/peppa | bacfaf3ef09f050dcb503bb4c67e01f8e7ab06f5 |
1.6 | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
from PIL import Image, ExifTags
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from .utils import xyxy2x... | [
"torch.cat",
"torch.stack",
"torch.zeros",
"torch.from_numpy"
] | 1.6.0 | jinglingzhua/blinkblink | 1975be380ef08f895af4c1c07992efaed7af49e9 |
1.6 | import argparse
import torch
from cail.env import make_env
from cail.algo.algo import EXP_ALGOS
from cail.utils import evaluation
def run(args):
env = make_env(args.env_id)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
algo = EXP_ALGOS[args.algo](
state_sha... | [
"torch.cuda.is_available"
] | 1.6.0 | Stanford-ILIAD/Confidence-Aware-Imitation-Learning | 1d8af0e4ab87a025885133a2384d5a937329b2f5 |
1.2 | import pytest
import torch.cuda
from torch import nn
from torch.optim import SGD
from yann.callbacks import (
History, HistoryPlotter, HistoryWriter, Logger, Checkpoint
)
from yann.datasets import TinyDigits
from yann.datasets.wrappers import Slice
from yann.modules import Flatten
from yann.train import Trainer
de... | [
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.CrossEntropyLoss",
"torch.nn.Linear"
] | 1.2.0 | michalwols/yann | b3c0f35ec7515ddaeb1f04d365af7b6d136f56cf |
1.2 | import base64
import os
import io
import numpy as np
import pathlib
import torch
import random
from PIL import Image
from torchvision import transforms as tvt
from torchvision.transforms.functional import to_pil_image
from torchvision import transforms
from ..utils import truthy
class Transformer:
def __init__(se... | [
"torch.randperm"
] | 1.2.0 | michalwols/yann | b3c0f35ec7515ddaeb1f04d365af7b6d136f56cf |
1.5 | from torch.utils.tensorboard import SummaryWriter
import torch
class Logger(SummaryWriter):
def __init__(self, log_iter, use_any_mask, use_thumbs, use_fmap, n_featuremaps, n_thumbs, img_mean, img_std, device,
**kwargs):
self.log_iter = log_iter
self.n_featuremaps = n_featuremaps
... | [
"torch.tensor"
] | 1.5 | StefOe/selection-masks | e59487bffe3c30bdab7a6425bed01f6adeda4f67 |
1.6 | from math import sqrt
from itertools import product
from collections import namedtuple
import torch
import torch.nn.functional as F
from torch import nn, einsum
from se3_transformer_pytorch.basis import get_basis
from se3_transformer_pytorch.utils import exists, default, uniq, map_values, batched_index_select, masked... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.ModuleList",
"torch.einsum",
"torch.nn.ModuleDict",
"torch.finfo",
"torch.eye",
"torch.nn.functional.pad",
"torch.sum",
"torch.nn.LayerNorm",
"torch.is_tensor",
"torch.nn.Embedding",
"torch.nn.ParameterDict",
"torch.zeros",
"torch.nn.init.kaiming... | 1.6 | SuperXiang/se3-transformer-pytorch | d0db110533c0cd29a243e05e27dbef083ff232f4 |
1.8 | import json
import numpy as np
import os
import random
import time
import torch
from dataclasses import dataclass
from typing import Any
import jiant.utils.python.io as py_io
import jiant.utils.zlog as zlog
@dataclass
class QuickInitContainer:
device: Any
n_gpu: int
log_writer: Any
def quick_init(args,... | [
"torch.device",
"torch.cuda.manual_seed_all",
"torch.cuda.device_count",
"torch.manual_seed",
"torch.cuda.set_device",
"torch.cuda.is_available"
] | 1.8.1 | Inujal/jiant | 095fd4ab7613fe270fd7b7c64b00a90b32b18b5b |
1.7 | """
To visualize the results, demo.py needs two arguments,
--root (compulsary) - root directory of Cityscapes
--model_path (compulsary) - path of the saved_model
Press 'q' to quit the demo.
Press any key to visualize the next image.
"""
import torch
import numpy as np
import cv2
import imutils
from torc... | [
"torch.device",
"torch.no_grad",
"torch.cuda.is_available",
"torch.utils.data.DataLoader"
] | 1.7.1 | Chris10M/Vision-Project-Image-Segmentation | d32fe9302320c74f238bc125f1d62a4e2ddbca22 |
1.6 | import torch.nn as nn
from torch import optim
from graphgallery.nn.models import TorchKeras
from graphgallery.nn.layers.pytorch import APPNProp, PPNProp, activations
from graphgallery.nn.metrics.pytorch import Accuracy
class APPNP(TorchKeras):
def __init__(self,
in_features,
out... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.Sequential",
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss"
] | 1.6.0 | Jie-Re/GraphGallery | 37a2e807bb21e5ed986ade935ac9619b62bfdd90 |
1.4 | import torch
from torch import nn
import torch.nn.functional as F
from tianshou.data import Batch
from tianshou.policy import PGPolicy
class A2CPolicy(PGPolicy):
"""docstring for A2CPolicy"""
def __init__(self, actor, critic, optim,
dist_fn=torch.distributions.Categorical,
... | [
"torch.nn.functional.mse_loss",
"torch.tensor"
] | 1.4.0 | DZ9/tianshou | 4f843d3f51789f488169131a5b5decba8bab2b31 |
1.6 | import argparse
import math
import os
import random
import time
import logging
from pathlib import Path
import numpy as np
import torch.distributed as dist
import torch.nn.functional as F
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
import torch.utils.data
import yaml
from torch.cuda imp... | [
"torch.cuda.amp.autocast",
"torch.distributed.destroy_process_group",
"torch.distributed.init_process_group",
"torch.nn.functional.interpolate",
"torch.optim.SGD",
"torch.optim.Adam",
"torch.nn.parallel.DistributedDataParallel",
"torch.cuda.amp.GradScaler",
"torch.optim.lr_scheduler.LambdaLR",
"to... | 1.6.0 | 1079931505/ME336-Yellow-Team-SUSTech | f4e5391d7be3f7983692457d30c2bdc697dcb76d |
1.5 | import logging
import re
import typing
from abc import ABC, abstractmethod
from collections import Counter, defaultdict
from functools import lru_cache
from operator import itemgetter
from pathlib import Path
from typing import Callable, Dict, List, Optional, Union, cast
import torch
from deprecated import deprecated
... | [
"torch.cat",
"torch.utils.data.dataset.ConcatDataset",
"torch.tensor",
"torch.utils.data.dataset.Subset",
"torch.empty"
] | 1.5.0 | piamarlene/flair | 4f72d538fa49649aac88c7b5130250180ba64e43 |
1.10 | #!/usr/bin/python
# -*- encoding: utf-8 -*-
import torch
import torch.cuda.amp as amp
import torch.nn as nn
import torch.nn.functional as F
##
# version 1: use pytorch autograd
class MishV1(nn.Module):
def __init__(self):
super(MishV1, self).__init__()
def forward(self, feat):
return feat ... | [
"torch.nn.Linear",
"torch.sigmoid",
"torch.nn.functional.softplus",
"torch.nn.BatchNorm2d",
"torch.abs",
"torch.randn",
"torch.nn.Conv2d",
"torch.randint",
"torch.mean",
"torch.nn.CrossEntropyLoss",
"torch.pow"
] | 1.10.1 | napoler/pytorch-loss | 36a599d868844491633f3e0091f73759922a4557 |
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.is_tensor",
"torch.tensor"
] | 1.7.1 | AjinkyaIndulkar/lightning-flash | e65020c7e5bd779d477a198865b0a84ac4f39720 |
0.6 |
import glob, torch
from haven import haven_utils as hu
import numpy as np
import os
from PIL import Image
import torch.utils.data as data
import torchvision.transforms as transforms
import kornia.augmentation as K
import PIL
class COVIDDataset(data.Dataset):
def __init__(self, split, datadir, exp_dict):
i... | [
"torch.LongTensor"
] | 0.6.3 | JanAlexanderPersonal/covid19_weak_supervision | 5599e48c9945f1e08a2731740bc8f6e44a031703 |
0.6 | import sys; sys.path.append("../../_EXTRAS"); import misc as ms
import socket
import timeit
from datetime import datetime
import scipy.misc as sm
from collections import OrderedDict
import glob
# PyTorch includes
import torch.optim as optim
from torchvision import transforms
from torch.utils.data import DataLoader
fr... | [
"torch.optim.SGD",
"torch.utils.data.DataLoader",
"torch.nn.functional.upsample"
] | 0.6.3 | JanAlexanderPersonal/covid19_weak_supervision | 5599e48c9945f1e08a2731740bc8f6e44a031703 |
1.7 | # Copyright (c) Aishwarya Kamath & Nicolas Carion. Licensed under the Apache License 2.0. All Rights Reserved
"""Dataset and evaluator for CLEVR-Ref+"""
import copy
from collections import defaultdict
from pathlib import Path
import torch
import torch.utils.data
from transformers import AutoTokenizer
import mdetr.uti... | [
"torch.as_tensor"
] | 1.7.0 | rstrudel/mdetr | 177724cc60c7d63628dd14a5f26b21ea2cea45e3 |
1.7 | # Copyright (c) Aishwarya Kamath & Nicolas Carion. Licensed under the Apache License 2.0. All Rights Reserved
"""Postprocessors class to transform MDETR output according to the downstream task"""
from typing import Dict
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from mdetr.ut... | [
"torch.stack",
"torch.nn.functional.softmax",
"torch.no_grad",
"torch.nn.functional.interpolate",
"torch.ones_like",
"torch.sort"
] | 1.7.0 | rstrudel/mdetr | 177724cc60c7d63628dd14a5f26b21ea2cea45e3 |
1.7 | # Copyright (c) Aishwarya Kamath & Nicolas Carion. Licensed under the Apache License 2.0. All Rights Reserved
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import datetime
import json
import os
from collections import OrderedDict, defaultdict
import numpy as np
import pycocotools.m... | [
"torch.stack"
] | 1.7.0 | rstrudel/mdetr | 177724cc60c7d63628dd14a5f26b21ea2cea45e3 |
1.7 | import torch
from torch import nn
from .operation import Operation
class Conv2d(Operation):
"""
module.weight: c_out x c_in x k_h x k_w
module.bias: c_out x 1
Argument shapes
in_data: n x (c_in)(kernel_size) x out_size
out_grads: n x c_out x out_size
kernel_size = (k_h)(k_w)
out_siz... | [
"torch.matmul"
] | 1.7.0 | rioyokotalab/asdfghjkl | f435c1e2527162fb07512b4ce5058460aab238b9 |
1.6 | from argparse import ArgumentParser
import torch
from lasaft.source_separation.conditioned.cunet.dcun_base import Dense_CUNet, Dense_CUNet_Framework
from lasaft.source_separation.sub_modules.control_models import pocm_control_model, dense_control_block
from lasaft.utils.PoCM_utils import Pocm_Matmul, Pocm_naive
cla... | [
"torch.cat"
] | 1.6.0 | alswhdgus10/Conditioned-Source-Separation-LaSAFT | f8d8de82391fa04622bbe93e232bb627a9367feb |
1.4 | from typing import Optional, List, Tuple, Callable, Union, Dict, Type, Any
from functools import partial
import gym
import torch as th
import torch.nn as nn
import numpy as np
from stable_baselines3.common.policies import (BasePolicy, register_policy, MlpExtractor,
creat... | [
"torch.nn.Linear"
] | 1.4.0 | rolandgvc/stable-baselines3 | 805a87ed8b340c6a1a2e674468d5769a8cda38b0 |
1.8 | import torch
import random
import argparse
import numpy as np
import ipdb as pdb
import os, pwd, yaml
import pytorch_lightning as pl
from torch.utils.data import DataLoader, random_split
import warnings
warnings.filterwarnings('ignore')
from train_spline import pretrain_spline
from leap.tools.utils import load_yaml
fr... | [
"torch.utils.data.DataLoader"
] | 1.8.1 | weirayao/leap | 8d10b8413d02d3be49d5c02a13a0aa60a741d8da |
1.5 | import inspect
import logging
from abc import abstractmethod
from typing import Dict, Generic, List, Sequence, Union
import torch
from torch.nn import Parameter, ParameterList
import flair
from flair.data import DT
log = logging.getLogger("flair")
class Embeddings(torch.nn.Module, Generic[DT]):
"""Abstract bas... | [
"torch.split",
"torch.cat",
"torch.tensor"
] | 1.5.0 | lukasgarbas/flair | 041c85cf3d45940dccd453fc350767c1c85aad49 |
1.2 | from overrides import overrides
import torch
from torch.nn import Linear
from allennlp.common.checks import ConfigurationError
from allennlp.modules.matrix_attention.legacy_matrix_attention import LegacyMatrixAttention
from allennlp.modules.seq2seq_encoders.seq2seq_encoder import Seq2SeqEncoder
from allennlp.modules.s... | [
"torch.nn.Linear"
] | 1.2.0 | mhagiwara/allennlp | a05add5293f091e9dbcaa9db0783e782d77714cf |
1.2 | from typing import Dict, List, Tuple, Optional
from overrides import overrides
import numpy
import torch
import torch.nn.functional as F
from torch.nn import Linear
from allennlp.common.checks import ConfigurationError
from allennlp.common.util import END_SYMBOL, START_SYMBOL
from allennlp.modules.seq2seq_decoders.se... | [
"torch.rand",
"torch.cat",
"torch.max",
"torch.nn.functional.log_softmax",
"torch.Tensor"
] | 1.2.0 | mhagiwara/allennlp | a05add5293f091e9dbcaa9db0783e782d77714cf |
1.5 | """
Author: Navid Shervani-Tabar
"""
import torch
from torch import nn
from torch.autograd import Variable
from filter import scattering
class VAEmod(nn.Module):
def __init__(self, args):
super(VAEmod, self).__init__()
# -- training parameters
self.device = args.device
# -- gra... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.Softmax",
"torch.nn.LeakyReLU",
"torch.nn.ReLU",
"torch.nn.BatchNorm1d"
] | 1.5.0 | nshervt/GSVAE | 6a7771a32634e39644be5549f1c24ee7507518b0 |
1.0 | """Copyright 2021 Google LLC
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | [
"torch.cuda.is_available"
] | 1.0 | brainsharks-fyp17/ZEST | 036d5b92ebde6053ad789b95a257bda9db296926 |
1.1 | ########################################################################################################################
"""
Description : Contains the utility functions for the module.
Python version : 3.7.3
"""
##########################################################################################################... | [
"torch.no_grad",
"torch.FloatTensor",
"torch.LongTensor",
"torch.nn.BCEWithLogitsLoss"
] | 1.1.0 | vageeshSaxena/TX-Ray | 80f96012bd7ab4c789b037bbfa996fa26c160701 |
1.9 | # setting device on GPU if available, else CPU
import torch
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print('Using device:', device)
print()
# Additional Info when using cuda
if device.type == 'cuda':
print(torch.cuda.get_device_name(0))
print('Memory Usage:')
print('Allocated:... | [
"torch.cuda.memory_cached",
"torch.cuda.is_available",
"torch.cuda.memory_allocated",
"torch.cuda.get_device_name"
] | 1.9.0 | KirillPushkarev/valuenet | 54ff6351e55d0b7c74b3d9db9ea8f686e3d855d9 |
1.2 | import math
import torch
from torch import optim
from models import BaseVAE
from models.types_ import *
from utils import data_loader
import pytorch_lightning as pl
from torchvision import transforms
import torchvision.utils as vutils
from torchvision.datasets import CelebA
from torch.utils.data import DataLoader
from ... | [
"torch.optim.lr_scheduler.ExponentialLR",
"torch.stack",
"torch.utils.data.DataLoader"
] | 1.2.0 | Meso272/PyTorch-VAE | b1f80082a92c706969a63162ae083b9f7d15d9aa |
0.4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""An example of how to pretrain a transformer encoder with BERT."""
import collections
import itertools
import typing
import gensim.models.word2vec as word2vec
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import transformer
import... | [
"torch.LongTensor"
] | 0.4.1 | phohenecker/pytorch-transformer | 211406d82ac04a7b473bcdebda77cc3c2e9af0cf |
1.8 | from __future__ import division
import re
from collections import OrderedDict, defaultdict
from functools import partial
try:
import apex
except:
print("No APEX!")
import numpy as np
import torch
from det3d.builder import _create_learning_rate_scheduler
# from det3d.datasets.kitti.eval_hooks import KittiDis... | [
"torch.device",
"torch.tensor",
"torch.optim.lr_scheduler.MultiStepLR"
] | 1.8.0 | yukke42/CenterPointTensorRT | c06ec5da881b4f44f22f9e4b67bebbd35b7d1ed3 |
1.8 | # ------------------------------------------------------------------------------
# Portions of this code are from
# det3d (https://github.com/poodarchu/Det3D/tree/56402d4761a5b73acd23080f537599b0888cce07)
# Copyright (c) 2019 朱本金
# Licensed under the MIT License
# -------------------------------------------------------... | [
"torch.sigmoid",
"torch.cat",
"torch.nn.ModuleList",
"torch.max",
"torch.arange",
"torch.no_grad",
"torch.nn.BatchNorm2d",
"torch.from_numpy",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.tensor",
"torch.atan2",
"torch.exp"
] | 1.8.0 | yukke42/CenterPointTensorRT | c06ec5da881b4f44f22f9e4b67bebbd35b7d1ed3 |
1.7 | import argparse
import glob
import logging
import os
import random
import timeit
import numpy as np
import torch
from transformers import (MODEL_FOR_QUESTION_ANSWERING_MAPPING, WEIGHTS_NAME,
AdamW, AutoConfig, AutoModelForQuestionAnswering,
AutoTokenizer, get_linear_... | [
"torch.device",
"torch.distributed.init_process_group",
"torch.cuda.device_count",
"torch.cuda.set_device",
"torch.cuda.is_available",
"torch.distributed.barrier"
] | 1.7.0 | jojowither/Question-Answer-Project | f44ca52acc784e13295cb977cedb513854fac814 |
1.10 | # Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# 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
#
# ... | [
"torch.no_grad",
"torch.cuda.is_available",
"torch.as_tensor"
] | 1.10.0 | cclauss/openfold | a933bc7479a13e4fcb95f7c7d7ffb9a6b55b0d4f |
1.4 | from easydict import EasyDict
import torch
from functools import partial
from core.envs import SimpleCarlaEnv
from core.policy import CILRSPolicy
from core.eval import CarlaBenchmarkEvaluator
from core.utils.others.tcp_helper import parse_carla_tcp
from ding.utils import set_pkg_seed, deep_merge_dicts
from ding.envs i... | [
"torch.load"
] | 1.4 | L-Net-1992/DI-drive | cc7f47bedbf60922acbcf3a5f77fc8e274df62cf |
1.4 | # third party
import pytest
import torch as th
# syft absolute
import syft as sy
@pytest.mark.parametrize("with_verify_key", [True, False])
def test_make_searchable(with_verify_key: bool) -> None:
bob = sy.VirtualMachine(name="Bob")
root_client = bob.get_root_client()
client = bob.get_client()
ten =... | [
"torch.tensor"
] | 1.4 | aeroaks/PySyft | 88220c38faf3cd72ddc63c73f3c0533695df53c9 |
1.10 | from argparse import ArgumentParser
from config_parser import get_config
from utils.loss import LabelSmoothingLoss
from utils.opt import get_optimizer
from utils.scheduler import WarmUpLR, get_scheduler
from utils.trainer import train
from utils.load_SHREC import get_loaders
from utils.misc import seed_everything, cou... | [
"torch.nn.CrossEntropyLoss"
] | 1.10.0 | ID56/Multimodal-Fusion-CRNN | 1775ec0cb9d0878c2635860c291b343130296797 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.