version stringclasses 21
values | code stringlengths 225 174k | apis list | full_version stringlengths 1 6 | repo_name stringlengths 10 107 | hexsha stringlengths 40 40 |
|---|---|---|---|---|---|
1.8 | from torch import nn, optim
from torch.utils import data
from pytorch_lightning import Trainer
from asteroid.engine.system import System
from asteroid.utils.test_utils import DummyDataset
from asteroid.engine.schedulers import NoamScheduler, DPTNetScheduler
def common_setup():
model = nn.Sequential(nn.Linear(10... | [
"torch.nn.Linear",
"torch.nn.MSELoss",
"torch.utils.data.DataLoader",
"torch.nn.ReLU"
] | 1.8.0 | ldelebec/asteroid | d6390baca5409634f112ceed554ea66c4054cb54 |
1.8 | from itertools import permutations
import torch
from torch import nn
from scipy.optimize import linear_sum_assignment
class PITLossWrapper(nn.Module):
r"""Permutation invariant loss wrapper.
Args:
loss_func: function with signature (est_targets, targets, **kwargs).
pit_from (str): Determines ... | [
"torch.stack",
"torch.min",
"torch.einsum",
"torch.gather",
"torch.arange",
"torch.unsqueeze",
"torch.index_select",
"torch.mean"
] | 1.8.0 | ldelebec/asteroid | d6390baca5409634f112ceed554ea66c4054cb54 |
1.8 | import torch
from torch.utils.data._utils.collate import default_collate
def online_mixing_collate(batch):
"""Mix target sources to create new mixtures.
Output of the default collate function is expected to return two objects:
inputs and targets.
"""
# Inputs (batch, time) / targets (batch, n_src,... | [
"torch.randperm",
"torch.utils.data._utils.collate.default_collate",
"torch.stack",
"torch.sum"
] | 1.8.0 | ldelebec/asteroid | d6390baca5409634f112ceed554ea66c4054cb54 |
1.5 | """Utility code for running native pytorch distributed"""
import os
import torch.distributed as dist
def init_workers_file():
rank = int(os.environ['SLURM_PROCID'])
n_ranks = int(os.environ['SLURM_NTASKS'])
sync_file = 'file:///tmp/%s_%s_pytorch_sync' % (
os.environ['USER'], os.environ['SLURM_JOB... | [
"torch.distributed.init_process_group",
"torch.distributed.get_world_size",
"torch.distributed.get_rank"
] | 1.5.0 | caditi97/exatrkx-ctd2020 | ed090ddfcc9e2e623fb45000fca71d5ad6ccf3b9 |
1.0 | # Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | [
"torch.stack",
"torch.nn.utils.rnn.pad_sequence",
"torch.randint",
"torch.full",
"torch.tensor",
"torch.bernoulli"
] | 1.0 | arunraja-hub/transformers | 3f51e6a35871fefbdfb705902355d7530a72d1b8 |
1.10 | """
Copyright (c) 2021 Olivier Sprangers as part of Airlab Amsterdam
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 require... | [
"torch.zeros",
"torch.ones_like"
] | 1.10.0 | ii-research-yu/pgbm | d050a5f71f1a458d8269c4f5201744c0d7c4d487 |
1.4 | #!/usr/bin/env python3
""" ImageNet Validation Script
This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained
models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes
canonical PyTorch, standard Python style, and good perform... | [
"torch.no_grad",
"torch.cuda.empty_cache",
"torch.jit.script",
"torch.nn.CrossEntropyLoss",
"torch.jit.optimized_execution"
] | 1.4.0 | chrisjuniorli/pytorch-image-models | bb815fa90c46b1f5f2f59a0dcddab8ce69f91dcf |
1.4 | import os
import shutil
import time
import configargparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
from tensorboardX import SummaryWriter
from torch.optim.lr_scheduler import MultiStepLR
from tqdm ... | [
"torch.nn.functional.smooth_l1_loss",
"torch.save",
"torch.no_grad",
"torch.optim.lr_scheduler.MultiStepLR",
"torch.squeeze",
"torch.cuda.empty_cache",
"torch.load",
"torch.nn.DataParallel"
] | 1.4.0 | wodxyj/plpp | cd74916536cf180a37b088ec61ea2a12a63719f2 |
1.1 | from __future__ import absolute_import
from torch import nn
from torch.nn import functional as F
from torch.nn import init
import torchvision
import torch
import pdb
from .layers import (
SpatialAttention2d,
WeightedSum2d)
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resn... | [
"torch.nn.Linear",
"torch.nn.functional.normalize",
"torch.nn.Dropout",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"torch.nn.init.kaiming_normal_",
"torch.nn.functional.relu",
"torch.nn.init.normal_",
"torch.nn.BatchNorm1d",
"torch.nn.AdaptiveAvgPool2d"
] | 1.1.0 | wangyuan249/Mymmt767 | 6b9bb566d290bd3157350f6496fcb5df8c2b515c |
1.3 | import numpy as np
import torch
from torch.optim import Adam
import gym
import time
import spinup.algos.pytorch.ppo.core as core
from spinup.utils.logx import EpochLogger
from spinup.utils.mpi_pytorch import setup_pytorch_for_mpi, sync_params, mpi_avg_grads
from spinup.utils.mpi_tools import mpi_fork, mpi_avg, proc_id,... | [
"torch.min",
"torch.clamp",
"torch.manual_seed",
"torch.as_tensor",
"torch.exp"
] | 1.3.1 | ANCL/QuadPPO | b7ed0574467bd321f4259175621a12ff7aeb7d12 |
1.2 | #pylint: disable=invalid-name
import numpy as np
import torch
from torch import nn
from aw_nas import ops
from aw_nas.utils.exception import expect, ConfigException
from aw_nas.weights_manager.rnn_shared import RNNSharedNet, INIT_RANGE
class RNNGenotypeModel(RNNSharedNet):
REGISTRY = "final_model"
NAME = "rn... | [
"torch.nn.Linear",
"torch.cat",
"torch.stack",
"torch.nn.ModuleList",
"torch.split",
"torch.nn.BatchNorm1d"
] | 1.2.0 | Harald-R/aw_nas | 8cf0cf48f7bcfd7893e6355dcc3ccbc83fd39783 |
1.2 | # -*- coding: utf-8 -*-
import os
import random
import functools
import six
import numpy as np
import torch
from torch import nn
from torch.utils.data.distributed import DistributedSampler
from aw_nas import utils
from aw_nas.final.base import FinalTrainer
from aw_nas.final.bnn_model import BNNGenotypeModel
from aw_... | [
"torch.device",
"torch.utils.data.DataLoader",
"torch.utils.data.distributed.DistributedSampler",
"torch.nn.CrossEntropyLoss"
] | 1.2.0 | Harald-R/aw_nas | 8cf0cf48f7bcfd7893e6355dcc3ccbc83fd39783 |
1.8 | import ast
import numpy as np
import torch as torch
import torch.nn as nn
import torch.nn.functional as F
def get_descendants(node, ls):
for child in node.children:
ls.append(child)
get_descendants(child, ls)
return ls
class Node():
'''
For each node we store its parent and children n... | [
"torch.tensor"
] | 1.8.1 | ADCenterNetwork/discern-fmk | 4781f1a986f7b24f298b2729b87ddee4227cb1d0 |
1.8 | import os
import torch
from torch.utils.data import Dataset, random_split, DataLoader
from PIL import Image
import torchvision.models as models
import matplotlib.pyplot as plt
import torchvision.transforms as transforms
# from sklearn.metrics import f1_score
import torch.nn.functional as F
import torch.nn as nn
from t... | [
"torch.nn.Linear",
"torch.device",
"torch.nn.Dropout",
"torch.stack",
"torch.max",
"torch.nn.Sequential",
"torch.nn.MaxPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.functional.cross_entropy",
"torch.cuda.is_available",
"torch.nn.Conv2d",
"torch.nn.Flatten"
] | 1.8.1 | adityapatkar/covid-detection | 59797402bb4359d6070558d40597f7fce3958a0d |
1.7 | """
Run CGLE example using specified config file.
"""
import int.cgle as cint
import tests
import lpde
import os
import pickle
import shutil
import configparser
import numpy as np
import matplotlib.pyplot as plt
import tqdm
import torch
from torch.utils.tensorboard import SummaryWriter
import utils_cgle
from scipy.s... | [
"torch.get_default_dtype",
"torch.set_default_dtype",
"torch.utils.tensorboard.SummaryWriter"
] | 1.7.0 | fkemeth/emergent_pdes | d0501f21c9eb569543a19d4d95d6c91a9ccb11fe |
1.7 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | [
"torch.optim.lr_scheduler.StepLR",
"torch.cuda.empty_cache",
"torch.cuda.is_available",
"torch.utils.tensorboard.SummaryWriter"
] | 1.7 | diazandr3s/MONAI | 209db9e08129855df878634639d4c2700d9acd83 |
1.0 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"torch.cat",
"torch.nn.MSELoss",
"torch.arange",
"torch.nn.Softmax",
"torch.einsum",
"torch.nn.Tanh",
"torch.nn.CrossEntropyLoss",
"torch.ones",
"torch.tensor",
"torch.nn.BCEWithLogitsLoss",
"torch.tanh",
"torc... | 1.0 | djroxx2000/transformers | 77770ec79883343d32051cfb6a04f64523cd8df1 |
1.0 | # coding=utf-8
# Copyright 2020 Microsoft and the Hugging Face 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 require... | [
"torch.nn.Linear",
"torch._softmax_backward_data",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"torch.zeros",
"torch.sqrt",
"torch.arange",
"torch.nn.MSELoss",
"torch.nn.LogSoftmax",
"torch.nn.CrossEntropyLoss",
"torch.softmax",
"torch.ones",
"torch.clamp",
"torch.tensor",
"torch.zeros_lik... | 1.0 | djroxx2000/transformers | 76cadb7943c8492ec481f4f3925e9e8793a32c9d |
1.4 | """
discriminator model
"""
import torch
import torch.nn as nn
import torchvision.models as models
import json
from easydict import EasyDict as edict
from graphs.weights_initializer import weights_init
class EncoderModel(nn.Module):
def __init__(self,config):
super(EncoderModel, self).__init... | [
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.Linear",
"torch.nn.MaxPool2d"
] | 1.4.0 | suvarnak/GenerativeFSLCovid | 0bdeb4ed444c5c9d59697c71d0733fc3a100944c |
1.9 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Utils for generating stats from torch tensors.
"""
from typing import Iterator, List, Tuple, Union
import numpy as np
import torch
from torch.functional import F
def calc_sample_norms(
named_params: Iterator[Tuple[s... | [
"torch.functional.F.pad",
"torch.stack"
] | 1.9.0 | nhsx-mirror/SynthVAE | 64c00dff1b9cb1fe22b4b25e585b17ca5c7b9651 |
1.9 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Dict, Union
import torch.nn as nn
from torch import Tensor
from torch.nn.modules.module import _IncompatibleKeys
def filter_out_old_keys(self, state_dict, prefix, local_metadata):
new_state_dict = {... | [
"torch.nn.modules.module._IncompatibleKeys"
] | 1.9.0 | nhsx-mirror/SynthVAE | 64c00dff1b9cb1fe22b4b25e585b17ca5c7b9651 |
1.9 | #%% -------- Import Libraries -------- #
# Standard imports
from selectors import EpollSelector
from tokenize import String
import numpy as np
import pandas as pd
import torch
# VAE is in other folder
import sys
sys.path.append("../")
# Opacus support for differential privacy
from opacus.utils.uniform_sampler impor... | [
"torch.Tensor",
"torch.utils.data.TensorDataset"
] | 1.9.0 | nhsx-mirror/SynthVAE | 64c00dff1b9cb1fe22b4b25e585b17ca5c7b9651 |
1.3 | __all__ = ["EvaluatingInferencer"]
from dataclasses import dataclass
from typing import Sequence
import torch
import torch.utils.data as td
import utils
from datasets import BatchData
from .inferencer import Inferencer
from evaluators import FinegrainedEvaluator
@dataclass
class EvaluatingInferencer(Inferencer):
... | [
"torch.no_grad"
] | 1.3.0 | kaniblu/vhda | 35941097ef552568c29f66cc55d8ce1927f34978 |
1.8 | import pytorch_lightning as pl
from torch.utils.data import DataLoader
class plDataModule(pl.LightningDataModule):
def __init__(
self,
train_dataset,
val_dataset,
test_dataset=None,
num_workers=2,
train_sampler=None,
train_shuffle=True,
train_batch_s... | [
"torch.utils.data.DataLoader"
] | 1.8.1 | Yongtae723/88_face | 7a761cb277be2a28984161be1e7ae2b73cadf085 |
1.0 | from torch import nn
from torch.optim import Adam
from mask_generators import ImageMaskGenerator, DropoutMaskGenerator
from nn_utils import ResBlock, MemoryLayer, SkipConnection
from prob_utils import normal_parse_params, GaussianLoss
# sampler from the model generative distribution
# here we return mean of the Gaus... | [
"torch.nn.AvgPool2d",
"torch.nn.BatchNorm2d",
"torch.optim.Adam",
"torch.nn.LeakyReLU",
"torch.nn.Upsample",
"torch.nn.Conv2d"
] | 1.0.1 | HugoSenetaire/vaeac | 451d34dd4986c52f2f37c508f03ee3db9e7408d3 |
1.3 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020 Johns Hopkins University (Shinji Watanabe)
# Northwestern Polytechnical University (Pengcheng Guo)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""ConvolutionModule definition."""
from torch import nn
class ConvolutionMod... | [
"torch.nn.ReLU",
"torch.nn.functional.glu",
"torch.nn.BatchNorm1d",
"torch.nn.Conv1d"
] | 1.3.0 | A-Quarter-Mile/Muskits | 60d80727d2ec6b8ec405502d67796e8df319ea82 |
1.5 | """ Implemenation of uncertainty-aware option selection
"""
from abc import ABC, abstractmethod
from typing import Tuple
import torch
from torch import BoolTensor, LongTensor, Tensor
from torch.distributions import Categorical
from rainy.net.policy import BernoulliPolicy
def _debug_minmax(name: str, t: Tensor) -... | [
"torch.zeros_like",
"torch.where"
] | 1.5.0 | kngwyu/infomax-option-critic | 9d907c041c1d0280db9b23eb2fdf9e0033e33bf3 |
1.0 | from __future__ import absolute_import, division, print_function, unicode_literals
import six
import logging
from collections import OrderedDict
import numpy as np
import time
import torch
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.sampler import SubsetRandomSamp... | [
"torch.device",
"torch.isnan",
"torch.from_numpy",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"torch.utils.data.sampler.SubsetRandomSampler"
] | 1.0.0 | siyuchen95/madminer | dfcbd7ee26c47dd294610c195fafce15f74c10eb |
1.10 | import numpy as np, sys, os, random, pdb, json, uuid, time, argparse
from pprint import pprint
import logging, logging.config
from collections import defaultdict as ddict
# from ordered_set import OrderedSet
# PyTorch related imports
import torch
from torch.nn import functional as F
from torch.nn.init import xavier_no... | [
"torch.rfft",
"torch.nonzero",
"torch.stack",
"torch.complex",
"torch.nn.init.xavier_normal_",
"torch.Tensor",
"torch.fft.rfft2"
] | 1.10.1 | jinzhuoran/CogKGE | b0e819a1d34cf61a7d70c33808da3377b73c8fd6 |
1.10 | import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttentionLayer, self).__init__()
self.dropout = dropout
self.in_features = in_features
sel... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.functional.dropout",
"torch.nn.LeakyReLU",
"torch.nn.init.xavier_uniform_",
"torch.nn.functional.elu",
"torch.nn.functional.log_softmax",
"torch.nn.functional.softmax",
"torch.matmul"
] | 1.10.1 | jinzhuoran/CogKGE | 70d851d6489600c1e90eb25b0388a3ceba2f078c |
1.10 | import sys
import torch
from pathlib import Path
from torch.utils.data import RandomSampler
FILE = Path(__file__).resolve()
ROOT = FILE.parents[0].parents[0].parents[0] # CogKGE root directory
if str(ROOT) not in sys.path:
sys.path.append(str(ROOT)) # add CogKGE root directory to PATH
from cogkge import *
devic... | [
"torch.utils.data.RandomSampler",
"torch.optim.lr_scheduler.ReduceLROnPlateau"
] | 1.10.1 | jinzhuoran/CogKGE | b0e819a1d34cf61a7d70c33808da3377b73c8fd6 |
1.9 | import pytest
import torch
from ludwig.encoders import text_encoders
@pytest.mark.parametrize("use_pretrained", [False])
@pytest.mark.parametrize("reduce_output", [None, "sum"])
@pytest.mark.parametrize("max_sequence_length", [20])
def test_albert_encoder(use_pretrained: bool, reduce_output: str, max_sequence_length... | [
"torch.rand",
"torch.randint"
] | 1.9.0 | jimthompson5802/ludwig | 8a369328a3f839d9cdb3710be315952c7891d7c0 |
1.9 | import contextlib
import os
from typing import List
from unittest.mock import Mock, patch
import pytest
import torch
from ludwig.utils.torch_utils import (
_get_torch_init_params,
_set_torch_init_params,
initialize_pytorch,
sequence_length_2D,
sequence_length_3D,
)
@pytest.mark.parametrize("inpu... | [
"torch.equal",
"torch.tensor"
] | 1.9.0 | jimthompson5802/ludwig | 8a369328a3f839d9cdb3710be315952c7891d7c0 |
1.9 | #! /usr/bin/env python
# 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
#
# Unless required by a... | [
"torch.Size",
"torch.clamp"
] | 1.9.0 | jimthompson5802/ludwig | 8a369328a3f839d9cdb3710be315952c7891d7c0 |
0.4 | import argparse
import os
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import torch
import torch.optim as optim
import torchvision.utils as vutils
from swae.distributions import rand_cirlce2d, rand_ring2d, rand_uniform2d
from swae.models.mnist import MNISTAutoencoder
from swae.trainer import... | [
"torch.device",
"torch.cat",
"torch.cuda.manual_seed",
"torch.no_grad",
"torch.manual_seed",
"torch.cuda.is_available"
] | 0.4.1 | eifuentes/swae-pytorch | 763f771c1d4860f71819af48d4f21a8a29a689d5 |
0.1 | # 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 logging
import platform
import random
from abc import ABCMeta, abstractmethod
from typing import ClassVar, Dict, List
import torch
i... | [
"torch.manual_seed",
"torch.multiprocessing.get_context",
"torch.randint"
] | 0.1.0 | feynmanliang/beanmachine | 5dea2b9f6387f2f7fd1e53b0915a1b8405f2b46b |
0.1 | # 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.
from collections.abc import Iterable
from typing import Iterable as IterableType, overload, Type, Union
import torch
import torch.distribut... | [
"torch.distributions.Uniform",
"torch.distributions.biject_to",
"torch.ones",
"torch.ones_like",
"torch.zeros_like"
] | 0.1.0 | feynmanliang/beanmachine | 225114d9964b90c3a49adddc4387b4a47d1b4262 |
1.8 | import argparse
import os
import numpy as np
from torch.utils.data import DataLoader
from . import ImageDataset
from .core import get_inception_feature
def calc_and_save_stats(path, output, batch_size):
dataset = ImageDataset(path, exts=['png', 'jpg'])
loader = DataLoader(dataset, batch_size=batch_size, num... | [
"torch.utils.data.DataLoader"
] | 1.8.1 | w86763777/Pytorch-Unified-FID-IS-Score | 6a2620d6da0faa66bb798aa47c7e0e49ef2032b6 |
1.11 | import datetime
import itertools
import os
from typing import Optional
import pytest
import torch
import torch.distributed as dist
import optuna
from optuna.integration import TorchDistributedTrial
from optuna.testing.integration import DeterministicPruner
from optuna.testing.storage import STORAGE_MODES
from optuna.... | [
"torch.distributed.get_rank",
"torch.distributed.barrier",
"torch.Tensor"
] | 1.11.0 | masap/optuna | f56cea87c4771d53b39f441e727d733dd1785557 |
1.10 | from typing import Any, Callable, Iterable, List, Optional, Tuple, Union
import warnings
import numpy as np
import pytorch_lightning
from scipy.sparse import csr_matrix
import torch
from torchmetrics import Metric
from torchmetrics.functional import auroc
from tqdm.auto import tqdm
import collie
from collie.interacti... | [
"torch.sigmoid",
"torch.arange",
"torch.isnan",
"torch.no_grad",
"torch.cuda.is_available",
"torch.tensor"
] | 1.10.1 | RomaKoks/collie_recs | bc8979c8dbf68deefb030336d50f07f788cf1667 |
1.8 | """
Description:
Author: Jiaqi Gu (jqgu@utexas.edu)
Date: 2021-06-07 03:43:40
LastEditors: Jiaqi Gu (jqgu@utexas.edu)
LastEditTime: 2021-06-07 03:43:40
"""
from torchonn.op.mzi_op import project_matrix_to_unitary
from typing import List, Union
import torch
from torch import Tensor, nn
from torch.types import Device, ... | [
"torch.device",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Sequential",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.flatten"
] | 1.8.0 | JeremieMelo/pytorch-onn | 670996112277a6c19c7da400afbe0a4ce45ad5de |
1.1 | import argparse
import torch
from deep_rl import random_seed, set_one_thread, select_device, Config, generate_tag, Task, TDAuxNet, NatureConvBody, \
LinearSchedule, AsyncReplay, ImageNormalizer, SignNormalizer, run_steps, mkdir
from deep_rl.agent.TDAux_agent import TDAuxAgent
import os
def td_aux_many(config: Co... | [
"torch.optim.Adam"
] | 1.1.0 | csherstan/DeepRL | fbf8da1f158792a0b9d29728c9d407ae40573070 |
1.3 | """
Entry point for training and evaluating a dependency parser.
This implementation combines a deep biaffine graph-based parser with linearization and distance features.
For details please refer to paper: https://nlp.stanford.edu/pubs/qi2018universal.pdf.
"""
"""
Training and evaluation for the parser.
"""
import s... | [
"torch.cuda.is_available"
] | 1.3.0 | asears/stanza | f91ca215e175d4f7b202259fe789374db7829395 |
1.3 | import torch
import torch.nn as nn
class LangIDBiLSTM(nn.Module):
"""
Multi-layer BiLSTM model for language detecting. A recreation of "A reproduction of Apple's bi-directional LSTM models
for language identification in short strings." (Toftrup et al 2021)
Arxiv: https://arxiv.org/abs/2102.06282
... | [
"torch.nn.Linear",
"torch.device",
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.argmax",
"torch.nn.CrossEntropyLoss",
"torch.save",
"torch.cuda.is_available",
"torch.tensor",
"torch.nn.Embedding",
"torch.sum"
] | 1.3.0 | asears/stanza | f91ca215e175d4f7b202259fe789374db7829395 |
1.5 | import numpy as np
from tqdm import tqdm
import torch
import pdb
from typing import Iterator
from allennlp.data import Instance
from allennlp.data.dataset_readers import DatasetReader
from allennlp.data.token_indexers import TokenIndexer, SingleIdTokenIndexer, PretrainedTransformerIndexer
from allennlp.data.fields impo... | [
"torch.manual_seed"
] | 1.5.1 | ruanchaves/Dual-encoder-Entity-Retrieval-with-BERT | ff8c7933afaf0b2c40a7df0250f4b82a5868dc2a |
1.2 | import torch.nn as nn
import torch
import torch.nn.functional as F
import torchvision.models
import os
import utils.network_utils
from utils.pointnet2_utils import PointNetSetAbstraction,PointNetFeaturePropagation
import cuda.emd.emd_module as emd
# Set the path for pretrain weight
os.environ['TORCH_HOME'] = '/media... | [
"torch.cat",
"torch.stack",
"torch.cuda.is_available",
"torch.nn.DataParallel",
"torch.sqrt",
"torch.nn.Conv1d",
"torch.normal",
"torch.unsqueeze",
"torch.ceil",
"torch.tensor",
"torch.zeros_like",
"torch.cos",
"torch.nn.functional.sigmoid",
"torch.clamp",
"torch.matmul",
"torch.arange... | 1.2.0 | brian220/Sketch2PointCloud | 17e8657ffc6605804ab4f1da89f446ea4d37665c |
1.7 | # modify from https://github.com/rosinality/stylegan2-pytorch/blob/master/op/upfirdn2d.py # noqa:E501
import os
import torch
from torch.autograd import Function
from torch.nn import functional as F
BASICSR_JIT = os.getenv('BASICSR_JIT')
if BASICSR_JIT == 'True':
from torch.utils.cpp_extension import load
mod... | [
"torch.nn.functional.pad",
"torch.nn.functional.conv2d",
"torch.flip"
] | 1.7 | marcelodiaz558/BasicSR | 1d5138ed567e966965fd1540838d27e6f5082b70 |
1.9 | from torch import nn
import torch
class LogisticRegression(nn.Module):
def __init__(self,
theta_params: int):
super(LogisticRegression, self).__init__()
self.__linear = nn.Linear(theta_params, 1)
self.__sigmoid_layer = nn.Sigmoid()
def forward(self,
... | [
"torch.nn.Linear",
"torch.nn.Sigmoid"
] | 1.9.1 | govindansriram/CobraML | d231d2e446df7e7860071f5d7cfa1e31afa99c6b |
1.7 | from torch.utils.data import Dataset
import numpy as np
import torch
from . import functions
class TokensDataset(Dataset):
def __init__(self, X, Y):
self.X = self.encode_x(X)
self.y = Y
@staticmethod
def encode_x(x: list) -> list:
max_len = len(max(x, key=lambda i: len(i)))
... | [
"torch.LongTensor",
"torch.tensor"
] | 1.7.0 | GroupLe/grouple-face-tagger | 5fd87c074dc50a5fc341e9f30774094a1616a87f |
1.7 | import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
from utils import utils_sr
import torch
from argparse import ArgumentParser
from utils.utils_restoration import rgb2y, psnr, array2tensor, tensor2array
import sys
from matplotlib.ticker import MaxNLocator
class PnP_restoration():
def __init_... | [
"torch.norm",
"torch.cuda.is_available",
"torch.tensor",
"torch.load"
] | 1.7.1 | samuro95/GSPnP | 1aaabf24d2912135da0bdb89cad1cd0846f9649e |
1.4 | # coding=utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) 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... | [
"torch.distributed.get_world_size",
"torch.utils.data.RandomSampler",
"torch.cuda.is_available",
"torch.nn.BCEWithLogitsLoss",
"torch.load",
"torch.nn.DataParallel",
"torch.sigmoid",
"torch.distributed.init_process_group",
"torch.manual_seed",
"torch.tensor",
"torch.utils.data.DataLoader",
"to... | 1.4.0 | 12190143/transformers | ab90353f1abfd15f8d21f99395658d060679a08c |
1.4 | # coding=utf-8
# Copyright 2019-present, Facebook, Inc and the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.AdaptiveLogSoftmaxWithLoss",
"torch.nn.ModuleList",
"torch.ones",
"torch.LongTensor",
"torch.nn.CrossEntropyLoss",
"torch.nn.LayerNorm",
"torch.nn.init.constant_",
"torch.nn.init.normal_",
"torch.tensor",
"torch.nn.functional.dropout",
"torch.full_li... | 1.4.0 | 12190143/transformers | ab90353f1abfd15f8d21f99395658d060679a08c |
1.3 | import os
import torch
from osgeo import gdal
import numpy as np
from warnings import warn
from .model_io import get_model
from .transform import process_aug_dict
from .datagen import InferenceTiler
from ..raster.image import stitch_images, create_multiband_geotiff
from ..utils.core import get_data_paths
class Infere... | [
"torch.device",
"torch.no_grad",
"torch.from_numpy",
"torch.cuda.is_available"
] | 1.3.1 | sandhi-artha/solaris | 230a58f94f300062ee880d43920d218edf3321c4 |
1.1 | import random
import time
from collections import namedtuple
import pytest
import torch
import numpy as np
from easydict import EasyDict
from functools import partial
import gym
from ding.envs.env.base_env import BaseEnvTimestep
from ding.envs.env_manager.base_env_manager import EnvState
from ding.envs.env_manager imp... | [
"torch.randint",
"torch.randn"
] | 1.1.0 | song2181/DI-engine | 268d77db3cb54401b2cfc83e2bc3ec87c31e7b83 |
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.isfinite"
] | 1.6 | aphedges/pytorch-lightning | 160e7e128909abc8489261287a562777cf1ada02 |
1.2 | """
A stacked bidirectional LSTM with skip connections between layers.
"""
from typing import Optional, Tuple, List
import warnings
import torch
from torch.nn.utils.rnn import PackedSequence, pad_packed_sequence
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=FutureWarning)
import h... | [
"torch.cat",
"torch.stack",
"torch.FloatTensor",
"torch.nn.utils.rnn.pad_packed_sequence"
] | 1.2.0 | justindujardin/allennlp | c4559f3751775aa8bc018db417edc119d29d8051 |
1.2 | from typing import Dict, Tuple, List, NamedTuple, Any
from overrides import overrides
import torch
from torch.nn.modules.linear import Linear
from nltk import Tree
from allennlp.common.checks import check_dimensions_match
from allennlp.data import TextFieldTensors, Vocabulary
from allennlp.modules import Seq2SeqEncod... | [
"torch.nn.modules.linear.Linear",
"torch.cat",
"torch.max"
] | 1.2.0 | justindujardin/allennlp | c4559f3751775aa8bc018db417edc119d29d8051 |
1.2 | """
AllenNLP just uses
`PyTorch optimizers <https://pytorch.org/docs/master/optim.html>`_ ,
with a thin wrapper to allow registering them and instantiating them `from_params`.
The available optimizers are
* `"adadelta" <https://pytorch.org/docs/master/optim.html#torch.optim.Adadelta>`_
* `"adagrad" <https://pytorch.o... | [
"torch.zeros_like"
] | 1.2.0 | justindujardin/allennlp | c4559f3751775aa8bc018db417edc119d29d8051 |
1.7 | from typing import Union, List
import torch
from torch import nn as nn
from torch.nn import functional as F
from models.layers.create_act import get_act_layer
from .trace_utils import _assert
class BatchNormAct2d(nn.BatchNorm2d):
"""BatchNorm + Activation
This module performs BatchNorm + Activation in a man... | [
"torch.nn.functional.batch_norm",
"torch.nn.Identity",
"torch.nn.functional.group_norm",
"torch.nn.functional.layer_norm"
] | 1.7.1 | hmthanh/LaTeX_OCR | bf5cf4642aff9cbbd5c4f8f232cd993a38ee6d81 |
0.4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) IBM Corporation 2018
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"torch.cuda.is_available",
"torch.tensor",
"torch.utils.data.DataLoader"
] | 0.4.0 | tsjayram/mi-prometheus | cf163d9e246c3ae3c100045e58924148b2f81c39 |
1.7 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.checkpoint import checkpoint
from einops import rearrange, repeat
class CrissCrossAttention(nn.Module):
def __init__(self, in_dim):
super(CrissCrossAttention, self).__init__()
self.query_conv = nn.Conv2d(in_channel... | [
"torch.zeros",
"torch.cat",
"torch.nn.Softmax",
"torch.nn.BatchNorm2d",
"torch.bmm",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.utils.checkpoint.checkpoint"
] | 1.7.1 | antonkulaga/DeepAb | 51a32d06d19815705bdbfb35a8a9518c17ec313a |
1.4 | import torch
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
FloatTensor = torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor
LongTensor = torch.cuda.LongTensor if torch.cuda.is_available() else torch.LongTensor
| [
"torch.device",
"torch.cuda.is_available"
] | 1.4.0 | dgoodwin208/6.883ProteinDocking | 07f33688bd5ec8c5ae6d4d4113eb64b0f2352e9e |
1.6 | import json
from pathlib import Path
import torch
import numpy as np
from PIL import Image
from torch.utils.data import Dataset, TensorDataset
from tfrecord.torch.dataset import MultiTFRecordDataset
from uncertainty_eval.datasets.tabular import TabularDataset
from uncertainty_eval.datasets.abstract_datasplit import D... | [
"torch.distributions.Uniform",
"torch.distributions.Normal",
"torch.from_numpy",
"torch.empty",
"torch.utils.data.TensorDataset"
] | 1.6.0 | selflein/nn_uncertainty_eval | 94a7f2292b8db2197cd55fab57324d438618ae06 |
1.0 | import os
import re
import logging
from abc import abstractmethod
from collections import Counter
from pathlib import Path
from typing import List, Union, Dict
import gensim
import numpy as np
import torch
from bpemb import BPEmb
from deprecated import deprecated
from pytorch_pretrained_bert import (
BertTokenize... | [
"torch.nn.Linear",
"torch.zeros",
"torch.cat",
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.nn.GRU",
"torch.no_grad",
"torch.FloatTensor",
"torch.nn.init.xavier_uniform_",
"torch.nn.ReLU",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.LongTensor",
"torch.tensor",
"torch.nn.utils.rnn.pack... | 1.0.0 | atakanokan/flair | d33aa6a007384da76d1ae8dac6f4fc61bc652ce7 |
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._C._log_api_usage_once",
"torch.no_grad",
"torch.jit.save",
"torch.onnx.export"
] | 1.3 | tobiasmaier/pytorch-lightning | 7f352cb69a8202e3f829419657597697ca5d99e2 |
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.cuda.set_device",
"torch.cuda.amp.autocast"
] | 1.3 | tobiasmaier/pytorch-lightning | 7f352cb69a8202e3f829419657597697ca5d99e2 |
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.cuda.empty_cache"
] | 1.3 | tobiasmaier/pytorch-lightning | 7f352cb69a8202e3f829419657597697ca5d99e2 |
1.1 | # 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 numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
import egg.core as co... | [
"torch.nn.functional.cross_entropy",
"torch.utils.data.DataLoader",
"torch.sum"
] | 1.1.0 | schlevik/EGG | 428d5aed3eb6fb0296f6856fb77b0a1cdceb33f1 |
1.6 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Modules to compute the matching cost and solve the corresponding LSAP.
"""
import torch
from scipy.optimize import linear_sum_assignment
from torch import nn
from .box_ops import box_cxcywh_to_xyxy, generalized_box_iou
class HungarianMatcher(... | [
"torch.cat",
"torch.no_grad",
"torch.as_tensor",
"torch.cdist"
] | 1.6.0 | yihui8776/TensorRT-DETR | 1f32e9a2f98e26ec5b2376f9a2695193887430fb |
1.4 | # Copyright 2020 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... | [
"torch.tensor"
] | 1.4 | Irme/MONAI | 49e693c4e7df83dc1f8ab87349373de9263188a9 |
1.8 | import contextlib
import json
import logging
import os
from typing import Any, Dict, Optional
from unittest import mock
import pytest
import torch
import torch.nn.functional as F
from torch import nn, Tensor
from torch.optim import Optimizer
from torch.utils.data import DataLoader
from torchmetrics import Accuracy
fr... | [
"torch.nn.Linear",
"torch.device",
"torch.optim.lr_scheduler.StepLR",
"torch.nn.GRU",
"torch.optim.lr_scheduler.ExponentialLR",
"torch.nn.ReLU",
"torch.nn.functional.cross_entropy",
"torch.load",
"torch.nn.functional.softmax",
"torch.equal",
"torch.randn"
] | 1.8 | neptune-ml/pytorch-lightning | 3bcaed52454f3e6c3bce5513032e34302e5b1bb6 |
1.8 | # 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.StepLR",
"torch.load"
] | 1.8 | neptune-ml/pytorch-lightning | 3bcaed52454f3e6c3bce5513032e34302e5b1bb6 |
1.8 | import torch
from torch import nn
from typing import List
from .base import ResnetBase
class Segmenter(ResnetBase):
"""A ResNet34 U-Net model, as described in
https://github.com/fastai/fastai/blob/master/courses/dl2/carvana-unet-lrg.ipynb
Attributes:
imagenet_base: boolean, default: False
... | [
"torch.cat",
"torch.nn.Sigmoid",
"torch.nn.BatchNorm2d",
"torch.nn.ConvTranspose2d",
"torch.nn.ReLU",
"torch.nn.Upsample",
"torch.nn.Conv2d"
] | 1.8.1 | fedesigno/solar-panel-segmentation | 75856be3361bb4904387e6abc986627d1cc98ebb |
1.6 | # MIT License
#
# Copyright (c) 2021 Soohwan Kim and Sangchun Ha and Soyoung Cho
#
# 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 the rights... | [
"torch.LongTensor",
"torch.ones"
] | 1.6.0 | techthiyanes/openspeech | 10307587f08615224df5a868fb5249c68c70b12d |
1.8 | import pytest
import numpy as np
import torch
from openunmix import transforms
@pytest.fixture(params=[4096, 44100])
def nb_timesteps(request):
return int(request.param)
@pytest.fixture(params=[1, 2])
def nb_channels(request):
return request.param
@pytest.fixture(params=[1, 2])
def nb_sam... | [
"torch.rand"
] | 1.8.0 | ParhamYZ/MusicSourceSeparation | 26a42fbebdf50d2ae2ef674ef64f4c88cbe7e8e3 |
1.6 | import torch
from allennlp.common.testing import AllenNlpTestCase
from allennlp.modules.seq2seq_encoders.gated_cnn_encoder import GatedCnnEncoder
class TestGatedCnnEncoder(AllenNlpTestCase):
def test_gated_cnn_encoder(self):
cnn_encoder = GatedCnnEncoder(
input_dim=32,
layers=[[[4... | [
"torch.rand",
"torch.ones"
] | 1.6.0 | MSLars/allennlp | 2cdb8742c8c8c3c38ace4bdfadbdc750a1aa2475 |
1.6 | import pytest
from numpy.testing import assert_almost_equal
import torch
from torch.nn import LSTM
from torch.nn.utils.rnn import pack_padded_sequence
from allennlp.common.checks import ConfigurationError
from allennlp.common.testing import AllenNlpTestCase
from allennlp.modules.seq2vec_encoders import PytorchSeq2VecW... | [
"torch.rand",
"torch.nn.LSTM",
"torch.FloatTensor",
"torch.ones",
"torch.randn"
] | 1.6.0 | MSLars/allennlp | 2cdb8742c8c8c3c38ace4bdfadbdc750a1aa2475 |
1.6 | """
A maxout neural network.
"""
from typing import Sequence, Union
import torch
from allennlp.common.checks import ConfigurationError
from allennlp.common.registrable import FromParams
class Maxout(torch.nn.Module, FromParams):
"""
This `Module` is a maxout neural network.
# Parameters
input_dim ... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.ModuleList"
] | 1.6.0 | MSLars/allennlp | 2cdb8742c8c8c3c38ace4bdfadbdc750a1aa2475 |
1.6 | import copy
import pytest
import torch
from torch.testing import assert_allclose
from transformers import AutoModel
from transformers.models.bert.configuration_bert import BertConfig
from transformers.models.bert.modeling_bert import BertEmbeddings
from transformers.models.albert.configuration_albert import AlbertConf... | [
"torch.nn.Embedding",
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"torch.zeros",
"torch.arange",
"torch.manual_seed",
"torch.tensor",
"torch.testing.assert_allclose",
"torch.allclose",
"torch.randn"
] | 1.6.0 | MSLars/allennlp | 2cdb8742c8c8c3c38ace4bdfadbdc750a1aa2475 |
0.4 | # coding: utf-8
from __future__ import with_statement, print_function, absolute_import
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
import librosa
import pysptk
from wavenet_vocoder.mixture import discretized_mix_logistic_loss
from wavenet_vocoder.mixture import sample_fr... | [
"torch.rand",
"torch.sigmoid",
"torch.nn.functional.softplus",
"torch.max",
"torch.nn.functional.log_softmax",
"torch.from_numpy",
"torch.exp"
] | 0.4.1 | botmatic/tacotron2 | c2dee4930f6bd1cf707e0565fd0675b8646a51a1 |
1.3 | """ Translation main class """
from __future__ import unicode_literals, print_function
import torch
from onmt.inputters.text_dataset import TextMultiField
class TranslationBuilder(object):
"""
Build a word-based translation from the batch output
of translator and the underlying dictionaries.
Replace... | [
"torch.sort"
] | 1.3.1 | KaijuML/data2text-macro-plan-py | 17cebc5db507723d601d21a075adea59b0bd9ffb |
1.9 | import os
import dataclasses
import numpy as np
import torch
from torch.utils.data import DataLoader
from torch.optim import Adam
from torch.optim.lr_scheduler import OneCycleLR
from pymarlin.core import module_interface, data_interface
from transformers import AutoModelForTokenClassification
from pymarlin.utils.sta... | [
"torch.optim.lr_scheduler.OneCycleLR",
"torch.tensor"
] | 1.9.1 | nifarn/PyMarlin | ea1f5f927aa85112ecebc206d53b5c3ee65704fa |
0.4 |
"""
Created on Tue Jun 23 20:15:11 2020
@author: sarroutim2
"""
"""Genearates a representation for an image input.
"""
import torch.nn as nn
import torch
import torchvision.models as models
class EncoderCNN(nn.Module):
"""Generates a representation for an image input.
"""
def __init__(self, output_si... | [
"torch.nn.Linear",
"torch.nn.BatchNorm1d"
] | 0.4.0 | sarrouti/VQG | eb9cbe3ba4f75d85fc55f5f1e746b1f2190f0b2b |
1.4 | """
SEResNet implementation from Cadene's pretrained models
https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/senet.py
Additional credit to https://github.com/creafz
Original model: https://github.com/hujie-frank/SENet
ResNet code gently borrowed from
https://github.com/pytorch/v... | [
"torch.nn.Sigmoid",
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.BatchNorm2d",
"torch.nn.init.kaiming_normal_",
"torch.nn.init.constant_",
"torch.nn.functional.dropout",
"torch.nn.ReLU",
"torch.nn.Conv2d"
] | 1.4.0 | lzmisscc/pytorch-image-models | a32aa96d109292bfef00a631c501bd6c2bd44fdf |
1.0 | import numpy as np
from skimage.transform import resize
import skimage
import torchvision.utils as tvutils
import torch
def rescale_for_display( batch, rescale=True, normalize=False ):
'''
Prepares network output for display by optionally rescaling from [-1,1],
and by setting some pixels to the ... | [
"torch.zeros",
"torch.cat"
] | 1.0.1 | joel99/midlevel-reps | f0b4a4d8ccf09a0488cd18af24723172aff99446 |
1.0 | import torch
from habitat.sims.habitat_simulator import SimulatorActions
try:
from habitat.sims.habitat_simulator import SIM_NAME_TO_ACTION
except:
pass
# TODO these are action values. Make sure to add the word "action" into the name
FORWARD_VALUE = SimulatorActions.FORWARD.value
FORWARD_VALUE = FORWARD_VALU... | [
"torch.Tensor"
] | 1.0.1 | joel99/midlevel-reps | f0b4a4d8ccf09a0488cd18af24723172aff99446 |
1.3 | from torch.utils.data import DataLoader
from torchvision import transforms as T
from torchvision.datasets import CIFAR10
import pytorch_lightning as pl
class CIFAR10Data(pl.LightningDataModule):
""" returns cifar-10 examples in floats in range [0,1] """
def __init__(self, args):
super().__init__()
... | [
"torch.utils.data.DataLoader"
] | 1.3.0 | zhangbo2008/vqvae_pytorch | 98f2f2386328245ae26ac999528c7dda57680aca |
1.6 | # NASNet Search Space https://arxiv.org/pdf/1707.07012.pdf
# code modified from DARTS https://github.com/quark0/darts
import numpy as np
from collections import namedtuple
import torch
from algs.nsga_net.model.micro_models import NetworkCIFAR as Network
Genotype = namedtuple('Genotype', 'normal normal_concat reduce r... | [
"torch.randn",
"torch.autograd.Variable"
] | 1.6.0 | Beautyya/BenchENA | 776cd1dd035d73c4af369d0106d010b932f64782 |
0.4 | """
Adopted from AllenNLP:
https://github.com/allenai/allennlp/blob/v0.6.1/allennlp/nn/initializers.py
An initializer is just a PyTorch function.
Here we implement a proxy class that allows us
to register them and supply any additional function arguments
(for example, the ``mean`` and ``std`` of a normal initializ... | [
"torch.nn.init.calculate_gain"
] | 0.4.1 | sfillwo/stog | b965c47c17472eea11ab63aab9aa738af7875f06 |
1.0 | import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
import numpy as np
class Flatten(nn.Module):
def __init__(self):
super(Flatten, self).__init__()
def forward(self, x):
"""
Arguments:
x: a float tensor with shape [batch... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.MaxPool2d",
"torch.FloatTensor",
"torch.nn.Conv2d",
"torch.nn.PReLU",
"torch.nn.functional.softmax"
] | 1.0.1 | furkanc/Yolov3-Face-Recognition | d3074490a6a7bf83925319ed521b557919d0af7e |
1.7 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modificatio... | [
"torch.cat",
"torch.nn.Linear.__init__",
"torch.no_grad",
"torch.split"
] | 1.7 | todd-deshane/aihwkit | 07269e29731f9a6482d25326400437f6bef2fc94 |
1.7 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modificatio... | [
"torch.empty_like"
] | 1.7 | todd-deshane/aihwkit | 07269e29731f9a6482d25326400437f6bef2fc94 |
1.9 | import copy
from functools import partial
from collections import OrderedDict
import torch
from torch import nn
from efficientnetv2 import get_efficientnet_v2_structure
from efficientnetv2 import load_from_zoo
class ConvBNAct(nn.Sequential):
"""Convolution-Normalization-Activation Module"""
def __init__(sel... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.Identity",
"torch.nn.init.kaiming_normal_",
"torch.nn.init.ones_",
"torch.nn.Conv2d",
"torch.nn.init.normal_",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.init.zeros_",
"torch.empty",
"torch.nn.Flatten"
] | 1.9.0 | hankyul2/EfficientNetV2-pytorch | bce59dae3ce69e3e7e8aa99e4f32214b015dd1f8 |
1.1 | #!/usr/bin/env python3
import argparse
import random
import torch
from torch import nn, optim
from torch.nn import functional as F
from tqdm import tqdm
import learn2learn as l2l
class Net(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, num_classes, input_dim=768, inner_... | [
"torch.nn.NLLLoss",
"torch.device",
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.no_grad",
"torch.hub.set_dir",
"torch.manual_seed",
"torch.nn.ReLU",
"torch.cuda.is_available",
"torch.hub.load"
] | 1.1.0 | heiseApple/learn2learn | df3c3291b4681440a80a69a7815090a4bd3cd661 |
1.3 | from typing import Tuple, List
import torch
import torch.nn as nn
import torch.nn.functional as F
from kornia.filters.kernels import normalize_kernel2d
def compute_padding(kernel_size: Tuple[int, int]) -> List[int]:
"""Computes padding tuple."""
# 4 ints: (padding_left, padding_right,padding_top,padding_bot... | [
"torch.nn.functional.pad",
"torch.nn.functional.conv2d"
] | 1.3.0 | tdchaitanya/kornia | 6dd16563f66f979c7a95846ef86678894b7d54fd |
1.5 | import time
import gym
import numpy as np
import torch
import torch.nn.functional as F
from fireup.algos.ddpg import core
from fireup.utils.logx import EpochLogger
class ReplayBuffer:
"""
A simple FIFO experience replay buffer for DDPG agents.
"""
def __init__(self, obs_dim, act_dim, size):
... | [
"torch.manual_seed",
"torch.nn.functional.mse_loss",
"torch.Tensor"
] | 1.5.1 | kashif/spinningup-pytorch | 8f3389c239c94b3ff46453f359061ae30d851ce8 |
1.10 | """
Adapt from:
https://github.com/facebookresearch/barlowtwins/blob/main/main.py
"""
import torch
import torch.nn as nn
from transformers import Wav2Vec2Model
from transformers.models.wav2vec2.modeling_wav2vec2 import _compute_mask_indices
def off_diagonal(x):
"""
For the purpose of calculation:
return f... | [
"torch.nn.Linear",
"torch.nn.Identity",
"torch.nn.Dropout",
"torch.diagonal",
"torch.nn.Sequential",
"torch.full_like",
"torch.from_numpy",
"torch.nn.ReLU",
"torch.nn.BatchNorm1d",
"torch.nn.CosineSimilarity",
"torch.mean",
"torch.sum"
] | 1.10.2 | DigitalPhonetics/SpeechRepresentationFinetuning | 11d7130919888d0a27de61f5075e72f4a024673b |
1.6 | import math
import os
from abc import ABC, abstractmethod
from concurrent.futures import ThreadPoolExecutor
from typing import Tuple
import numpy as np
import torch
from hivemind.compression.base import CompressionBase, CompressionInfo
from hivemind.proto import runtime_pb2
EXECUTOR = ThreadPoolExecutor(max_workers=... | [
"torch.zeros",
"torch.bucketize",
"torch.finfo",
"torch.as_tensor",
"torch.quantize_per_tensor"
] | 1.6.0 | artek0chumak/hivemind | c6b2b2d84ccfc890314a2bfece8eef238372d410 |
1.6 | from __future__ import annotations
import logging
import os
import time
from functools import partial
from typing import Callable, Optional, Sequence, Union
import torch
from hivemind.averaging.control import AveragingStage, StepControl
from hivemind.compression import CompressionBase, NoCompression
from hivemind.dh... | [
"torch.enable_grad",
"torch.no_grad"
] | 1.6.0 | artek0chumak/hivemind | 762f116ffcd6c194b888ed64c8a82033cc97dce7 |
0.4 | from os import path
import torch
import torch.utils.data as data
class CacheClassLabel(data.Dataset):
"""
A dataset wrapper that has a quick access to all labels of data.
"""
def __init__(self, dataset):
super(CacheClassLabel, self).__init__()
self.dataset = dataset
self.labels... | [
"torch.save",
"torch.unique",
"torch.load"
] | 0.4.1 | parvex/residual-continual-learning-benchmark | 8eeb2e57ecf0711e075eb02e8ed06fc8e7b9f20d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.