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.7 | import logging
from typing import Optional, Union
import numpy as np
import pandas as pd
import torch
from anndata import AnnData
from pytorch_lightning.callbacks import Callback
from pytorch_lightning.callbacks.early_stopping import EarlyStopping
import scvi
from scvi import _CONSTANTS
from scvi.data import register... | [
"torch.cat",
"torch.no_grad",
"torch.Tensor"
] | 1.7.1 | giovp/scvi-tools | 9b9370aa502b308f84e3129a7c940a9bea06426b |
1.2 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F #233
import torch.optim as optim
from torchvision import datasets,models,transforms
from PIL import Image
import argparse
from deeprobust.image.attack.fgsm import FGSM
from deeprobust.image.netmodels.CNN import Net
from deeprobust.im... | [
"torch.load"
] | 1.2.0 | marblet/DeepRobust | 276a7048aded2cf3a190d3851ffd4587b7d1dd49 |
1.0 | #These models are dowloaded via the repo https://github.com/Cadene/pretrained-models.pytorch
#See licence here: https://github.com/Cadene/pretrained-models.pytorch/blob/master/LICENSE.txt
from torch import nn
from ..learner import model_meta
from ...core import *
pretrainedmodels = try_import('pretrainedmodels')
if no... | [
"torch.nn.Sequential"
] | 1.0.0 | JiahuaWU/fastai | 13a2df812d875abf0558004283392ab40d9bdea1 |
1.9 | import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
class NumpyDataset(Dataset):
def __init__(self, data_path, labels_path, transform, three_channels=False):
"""
Loads image NumPy arrays and labels NumPy arrays and applies transforms to them in a memory-efficient manner... | [
"torch.from_numpy",
"torch.tensor",
"torch.utils.data.DataLoader"
] | 1.9.1 | zysymu/Domain-Adaptation-DeepLense | 64d26010d730b4e049a07b58a7234a74de0d292c |
1.3 | import os
from collections import OrderedDict
import torch
import torch.nn as nn
from torch.nn.parallel import DistributedDataParallel
class BaseModel():
def __init__(self, opt):
self.opt = opt
self.device = torch.device('cuda' if opt['gpu_ids'] is not None else 'cpu')
self.is_t... | [
"torch.device",
"torch.save",
"torch.load"
] | 1.3.1 | fanld/HDRTVNet | 7ef7f25f55b776b4ca9fa2d7936895a42b0960af |
1.7 | import torch
import torch.nn as nn
class CLSA(nn.Module):
def __init__(self, base_encoder, args, dim=128, K=65536, m=0.999, T=0.2, mlp=True):
"""
:param base_encoder: encoder model
:param args: config parameters
:param dim: feature dimension (default: 128)
:param K: queue s... | [
"torch.zeros",
"torch.nn.functional.normalize",
"torch.cat",
"torch.nn.Linear",
"torch.distributed.get_world_size",
"torch.einsum",
"torch.arange",
"torch.no_grad",
"torch.argsort",
"torch.distributed.all_gather",
"torch.randperm",
"torch.softmax",
"torch.nn.ReLU",
"torch.ones_like",
"to... | 1.7.1 | maple-research-lab/CLSA | 37df76cf5cb032683e57b70a3a4090f0d524c8fd |
1.7 | import torch.nn as nn
import config as c
# custom weights initialization called on netG and netD
# based on Neff et al. 2017 parameters
def weights_init(model):
classname = model.__class__.__name__
if classname.find('Conv') != -1:
mean = 0.0
std = 0.05
nn.init.normal_(model.weight.dat... | [
"torch.nn.Linear",
"torch.nn.init.constant_",
"torch.nn.Tanh",
"torch.nn.LeakyReLU",
"torch.nn.ReLU",
"torch.nn.Upsample",
"torch.nn.init.normal_",
"torch.nn.Conv3d",
"torch.nn.InstanceNorm3d",
"torch.nn.BatchNorm3d"
] | 1.7.0 | pooja-subramaniam/3DGAN_synthesis_of_3D_TOF_MRA_with_segmentation_labels | c1142594b3fa0afce46436350b3f80efbb82d7b5 |
1.6 | import math
from typing import Any
import numpy as np
import torch
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader, Dataset
from pl_bolts.utils import _SKLEARN_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _SKLEARN_AVAILABLE:
from sklearn.utils import... | [
"torch.utils.data.DataLoader"
] | 1.6 | oke-aditya/pytorch-lightning-bolts | 268df20bb442e7385b709b1488d37fd2767aba3c |
1.1 | # Copyright 2021 Tomoki Hayashi
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""HiFi-GAN Modules.
This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN.
"""
import copy
import logging
from typing import Any
from typing import Dict
from typing import List
from typing import Option... | [
"torch.nn.ConvTranspose1d",
"torch.nn.ModuleList",
"torch.nn.Conv1d",
"torch.nn.utils.remove_weight_norm",
"torch.nn.Tanh",
"torch.nn.LeakyReLU",
"torch.nn.utils.weight_norm",
"torch.nn.Conv2d",
"torch.nn.utils.spectral_norm",
"torch.flatten",
"torch.nn.functional.pad"
] | 1.1.0 | Gold-Sea/espnet | f31fc9a832801ef725a003e97ab7a5496046dc66 |
1.2 | import torch.nn as nn
class Actor(nn.Module):
"""Actor neural network.
Parameters
----------
nn : class
Torch neural network class
Returns
-------
array 1-D
An array containing the action for a given state
"""
def __init__(self, n_states, n_actions, config):
... | [
"torch.nn.Linear"
] | 1.2.0 | janiapurv/swarm-reinforcement-learning | 118c952f96e0c6cc093996fa1c76e7cc8a544bad |
1.6 | # author: github/zabir-nabil
# relevant imports
import os
import cv2
import pydicom
import pandas as pd
import numpy as np
# import tensorflow as tf
# import matplotlib.pyplot as plt
# torch dataset
import torch
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import ra... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.ModuleList",
"torch.bmm",
"torch.squeeze",
"torch.cuda.is_available",
"torch.load",
"torch.nn.Softmax",
"torch.manual_seed",
"torch.tensor",
"torch.utils.data.DataLoader",
"torch.nn.Identity",
"torch.nn.Conv2d",
"torch.cuda.empty_cache",
"torch.r... | 1.6.0 | greenFantasy/Fibro-CoSANet | d7b472a93ae70a7355b221a820d0254c590fdf03 |
1.7 | from argparse import ArgumentParser
from typing import Tuple
from warnings import warn
import torch
import torch.nn as nn
from torch import Tensor
from lasaft.data.musdb_wrapper import SingleTrackSet
from lasaft.source_separation.conditioned.separation_framework import Spectrogram_based
from lasaft.utils.functions im... | [
"torch.zeros",
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.BatchNorm2d",
"torch.no_grad",
"torch.nn.Conv2d",
"torch.tensor",
"torch.flatten",
"torch.nn.Embedding"
] | 1.7.1 | YeongSeokJeong/Conditioned-Source-Separation-LaSAFT | fc06d200de0f369d447b247ca007c686583ec87a |
1.7 | """recur_cnn.py
Recurrent CNN models.
"""
import torch
import torch.nn as nn
class RecurCNN(nn.Module):
def __init__(self, num_outputs, width, depth, in_channels):
super().__init__()
self.num_outputs = num_outputs
self.width = width
self.iters = depth - 3
self.first_layers ... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.MaxPool2d",
"torch.nn.ReLU",
"torch.nn.Conv2d"
] | 1.7.0 | Arjung27/DeepThinking | 13a2ce534bcb0b9379a22fffef52d975d650adb2 |
1.4 | import os
import time
import argparse
import math
from numpy import finfo
import torch
from distributed import apply_gradient_allreduce
import torch.distributed as dist
from torch.utils.data.distributed import DistributedSampler
from torch.utils.data import DataLoader
from model import Tacotron2
from data_... | [
"torch.cuda.manual_seed",
"torch.distributed.init_process_group",
"torch.no_grad",
"torch.cuda.device_count",
"torch.manual_seed",
"torch.cuda.is_available",
"torch.distributed.all_reduce",
"torch.load",
"torch.utils.data.DataLoader",
"torch.utils.data.distributed.DistributedSampler"
] | 1.4.0 | Thien223/Multilanguage_Tacotron_2 | ee93c23117b317e5f7bda95aea45bf3095893c0a |
0.1 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Callable, Dict, List, Optional, Tuple
import torch
from ax.core.types import TConfig, TGenMeta... | [
"torch.tensor",
"torch.ones"
] | 0.1.3 | xiecong/Ax | f6501807bbc6bb952d636391231ebeb10646769a |
1.7 | import random
import torch
from torch import nn
from recbole.model.abstract_recommender import SequentialRecommender
from recbole.model.loss import BPRLoss
import torch.nn.functional as F
class ComiRec_SA(SequentialRecommender):
r"""ComiRec_SA is a model that incorporate Capsule Network for recommendation.
... | [
"torch.nn.Linear",
"torch.argmax",
"torch.eq",
"torch.arange",
"torch.nn.Tanh",
"torch.nn.CrossEntropyLoss",
"torch.nn.init.kaiming_normal_",
"torch.unsqueeze",
"torch.sum",
"torch.ones_like",
"torch.nn.functional.softmax",
"torch.transpose",
"torch.Tensor",
"torch.matmul",
"torch.nn.Emb... | 1.7.0 | leelige/RecBole | 66eb93d7b6f416cd0f603a0a5cf2bef94e80f658 |
1.1 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 Shigeki Karita
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Decoder definition."""
import logging
from typing import Any
from typing import List
from typing import Tuple
import torch
from espnet.nets.pytorch_backend.nets_utils impor... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"torch.nn.Module.__init__",
"torch.nn.ReLU",
"torch.nn.Embedding"
] | 1.1.0 | drumilT/espnet | 944de63aa9ede23cefca7b3d092150ea52e7f1b2 |
1.3 | import numpy as np
import scipy.signal
from gym.spaces import Box, Discrete
import torch
import torch.nn as nn
from torch.distributions.normal import Normal
from torch.distributions.categorical import Categorical
def combined_shape(length, shape=None):
if shape is None:
return (length,)
return (length... | [
"torch.no_grad",
"torch.distributions.normal.Normal",
"torch.distributions.categorical.Categorical",
"torch.as_tensor",
"torch.exp"
] | 1.3.1 | florianHoidn/spinningup | 419ca30849aae11ac53b9421094d2212d4cad652 |
1.5 | # 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.allclose",
"torch.no_grad",
"torch.cuda.is_available",
"torch.randn"
] | 1.5 | LucasFidon/MONAI | a7ef9d567775dd7a222f93bab08191c0e3532c92 |
1.0 | """ Config class for search/augment """
import argparse
import os
import genotypes as gt
from functools import partial
import torch
def get_parser(name):
""" make default formatted parser """
parser = argparse.ArgumentParser(name, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
# print default val... | [
"torch.cuda.device_count"
] | 1.0.0 | IlyaTrofimov/pt.darts | 7cda57ad6b0e5802f852c3908619ffa066b277a7 |
1.7 | from typing import Generator, List, Union, Any
import torch
from torch import nn, optim, Tensor
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from torchtext.data import BucketIterator
from tqdm import tqdm
from src.config import Config
from src.early_stopping import EarlySt... | [
"torch.optim.lr_scheduler.StepLR",
"torch.utils.tensorboard.SummaryWriter"
] | 1.7.1 | BushMinusZero/deep-learning-skunk-works | 9178455c460940adbe6943e2b657c994da4af231 |
1.6 | import torch
from torch import nn
from einops import rearrange, repeat
##################################
# Linformer
##################################
def get_EF(input_size, dim, method="learnable", head_dim=None, bias=True):
"""
Retuns the E or F matrix, initialized via xavier initialization.
... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.Dropout",
"torch.einsum",
"torch.nn.init.normal_",
"torch.tensor",
"torch.nn.init.xavier_normal_",
"torch.matmul"
] | 1.6 | MohammadrezaRezvani/performer-pytorch | 347dd58111f4f79b8991f7609552203609856b4b |
1.8 | import numpy as np
import os
os.environ["TOKENIZERS_PARALLELISM"] = "false" # disable warning when using smart batching
import pandas as pd
from torch.utils.data import Dataset
from sklearn.model_selection import StratifiedKFold
from torch.utils.data import Dataset
from pytorch_lightning.callbacks import ModelCheckpo... | [
"torch.tensor"
] | 1.8.1 | ofnt/Kaggle-CommonLit-Readability-6th-Place-Solution | 61f5df662d8b5dfb3f80734e4444d52fe0f478cd |
1.4 | import torch
from torchaudio_unittest.common_utils import PytorchTestCase
from torchaudio_unittest.prototype.emformer_test_impl import EmformerTestImpl
class EmformerFloat32CPUTest(EmformerTestImpl, PytorchTestCase):
dtype = torch.float32
device = torch.device("cpu")
class EmformerFloat64CPUTest(EmformerTes... | [
"torch.device"
] | 1.4.0 | popcornell/audio | 7b6b2d000023e2aa3365b769866c5f375e0d5fda |
1.4 | import json
import torch
from parameterized import parameterized
from torchaudio.models.wav2vec2 import (
wav2vec2_base,
wav2vec2_large,
wav2vec2_large_lv60k,
)
from torchaudio.models.wav2vec2.utils import import_huggingface_model
from torchaudio_unittest.common_utils import (
get_asset_path,
skipI... | [
"torch.manual_seed",
"torch.randint",
"torch.randn",
"torch.arange"
] | 1.4.0 | popcornell/audio | 7b6b2d000023e2aa3365b769866c5f375e0d5fda |
1.0 | # coding=utf-8
# Copyright 2020 The Allen Institute for AI team 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... | [
"torch.nn.Linear",
"torch.cat",
"torch.einsum",
"torch.bmm",
"torch.ones",
"torch.masked_fill",
"torch.nn.functional.pad",
"torch.nn.CrossEntropyLoss",
"torch.nn.LayerNorm",
"torch.tensor",
"torch.zeros_like",
"torch.zeros",
"torch.nn.Tanh",
"torch.nn.functional.dropout",
"torch.nn.funct... | 1.0 | cgravill/transformers | 90d5ab3bfe8c20d9beccfe89fdfd62a8e5ac31e5 |
1.7 | # PyTorch
import torch
from torch.utils.data import IterableDataset, DataLoader
from donkeycar.utils import train_test_split
from donkeycar.parts.tub_v2 import Tub
from torchvision import transforms
from typing import List, Any
from donkeycar.pipeline.types import TubRecord, TubDataset
from donkeycar.pipeline.sequence ... | [
"torch.tensor",
"torch.utils.data.DataLoader"
] | 1.7.1 | DavidMeda/donkeycar | 1e42e40cb07d6f15c22461dc3f00182a7279cf0c |
1.4 | import torch
from torch import jit
class ComputeReturns(jit.ScriptModule):
__constants__ = ['gamma', 'T', 'B']
def __init__(self, target_actor_net, target_critic_net,
num_processes, reward_steps, batch_size, device,
gamma=0.99):
super(ComputeReturns, self).__init__(... | [
"torch.zeros"
] | 1.4.0 | fengredrum/Batch_D3PG | b1128db2b22ce6ba94665a066b1cc401f33145b5 |
1.8 | import torch
import numpy as np
def get_ntk_n(xloader, networks, recalbn=0, train_mode=False, num_batch=-1):
device = torch.cuda.current_device()
# if recalbn > 0:
# network = recal_bn(network, xloader, recalbn, device)
# if network_2 is not None:
# network_2 = recal_bn(network_2, ... | [
"torch.symeig",
"torch.cat",
"torch.stack",
"torch.einsum",
"torch.cuda.current_device",
"torch.cuda.empty_cache",
"torch.ones_like"
] | 1.8.0 | 2Dooh/TF-MOENAS | edd6ec8c3f89cfbe9674873425c5056e72899edb |
1.2 | import time
from typing import Tuple, Dict, Any
import torch
from torch.optim.optimizer import Optimizer
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from models.forward_tacotron import ForwardTacotron
from trainer.common import Averager, TTSSession, MaskedL1, to_device, n... | [
"torch.no_grad",
"torch.utils.tensorboard.SummaryWriter"
] | 1.2.0 | anh/ForwardTacotron | a58d9244844b4512f5655e154f08f934760c88b3 |
2.9 | import json as _json
import multiprocessing as _mp
import os as _os
from collections import Callable
from functools import partial as _partial
from os import sep as _sep
import numpy as _np
import torch as _torch
import torch.utils.data as _data
from torch.utils.data import DataLoader as _DataLoader, Dataset as _Datas... | [
"torch.initial_seed",
"torch.utils.data._utils.collate.default_collate",
"torch.utils.data.DataLoader",
"torch.utils.data.distributed.DistributedSampler"
] | 2.9.2 | trendscenter/easytorch | 0faf6c7f09701c8f73ed4061214ca724c83d82aa |
1.5 | from ast import parse
from torch.autograd.grad_mode import no_grad
from torch.functional import Tensor
from torch.nn.modules.loss import BCELoss, CrossEntropyLoss
from dataset import WakeWordDataset
from model import CNNNetwork
from torch.utils.data import DataLoader
from tqdm import tqdm
from typing import Tuple
impo... | [
"torch.nn.modules.loss.CrossEntropyLoss",
"torch.no_grad",
"torch.cuda.is_available",
"torch.utils.data.DataLoader"
] | 1.5.0 | wimausberlin/voice-assistant-system | 2d92fa0989109279b3959bc6d5ea32777d50cbac |
1.1 | import torch
from torch import multiprocessing, cuda
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch.backends import cudnn
import numpy as np
import importlib
import os
import voc12.dataloader
from misc import torchutils, imutils
cudnn.enabled = True
def _work(process_id, model, d... | [
"torch.nonzero",
"torch.stack",
"torch.nn.functional.adaptive_max_pool2d",
"torch.no_grad",
"torch.multiprocessing.spawn",
"torch.cuda.device",
"torch.cuda.device_count",
"torch.unsqueeze",
"torch.cuda.empty_cache",
"torch.utils.data.DataLoader",
"torch.load"
] | 1.1.0 | saramsv/CCT | 27b4fd838a174a3c0fca582aa163e5bd426b055a |
1.10 | import torch
from torchvision.models.segmentation import fcn_resnet50
from torchvision.utils import draw_segmentation_masks
from PIL import Image
import io
from torchvision.transforms import transforms
from torchvision.utils import save_image
import torchvision.transforms.functional as F
def get_model():
model = f... | [
"torch.arange",
"torch.nn.functional.softmax"
] | 1.10.2 | ummadiviany/image-segmenter | 906457a16765f7e1995a8dca7b222ba3abd13a3f |
1.2 | # Author: Robin Ru @ University of Oxford
# This is an implementation of zero-cost estimators based on:
# https://github.com/BayesWatch/nas-without-training (Jacov)
# and https://github.com/gahaalt/SNIP-pruning (SNIP)
import numpy as np
import torch
import logging
import gc
from naslib.predictors.predictor import Pre... | [
"torch.cat",
"torch.no_grad",
"torch.cuda.empty_cache",
"torch.cuda.is_available",
"torch.ones_like",
"torch.nn.CrossEntropyLoss"
] | 1.2.0 | shenyann/NASLib | 6fad875f21e41bb9c91647bbd0620aa6e6dc8c7f |
0.4 | import torch
import random
def bce_loss(input, target):
"""
Numerically stable version of the binary cross-entropy loss function.
As per https://github.com/pytorch/pytorch/issues/751
See the TensorFlow docs for a derivation of this formula:
https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_... | [
"torch.zeros_like",
"torch.numel",
"torch.ones_like",
"torch.sum"
] | 0.4.0 | sapan-ostic/deep_prediction | e4709e4a66477755e6afe39849597ae1e3e969b5 |
1.0 | import argparse
import torch
import onmt
import onmt.model_builder
import onmt.inputters as inputters
import onmt.opts
from onmt.utils.misc import use_gpu
from onmt.utils.logging import init_logger, logger
parser = argparse.ArgumentParser(description='translate.py')
parser.add_argument('-model', required=True,
... | [
"torch.cuda.set_device",
"torch.load"
] | 1.0 | cocoxu/OpenNMT-py | 820ad912dda0b5cbe49c53762374deb6bedd1299 |
0.6 | """LVQMLN example using all four dimensions of the Iris dataset."""
import argparse
import prototorch as pt
import pytorch_lightning as pl
import torch
class Backbone(torch.nn.Module):
def __init__(self, input_size=4, hidden_size=10, latent_size=2):
super().__init__()
self.input_size = input_siz... | [
"torch.nn.Linear",
"torch.utils.data.DataLoader",
"torch.nn.Sigmoid"
] | 0.6.0 | dmoebius-dm/prototorch_models | 71602bf38a09148eab13d98c9f89589b345ac570 |
1.6 | """
This script was made by soeque1 at 24/07/20.
To implement code for training your model.
"""
import logging
from argparse import ArgumentParser, Namespace
from logging import getLogger
import pytorch_lightning as pl
import torch
import torch.nn.functional as F
from pytorch_lightning import Trainer
from pyt... | [
"torch.nn.functional.cross_entropy",
"torch.cuda.is_available",
"torch.exp",
"torch.argmax"
] | 1.6.0 | HephaestusProject/pytorch-ReCoSa | eca171582a9021845009ade542cd99c2e5ddf701 |
1.5 | """
Text generation using a character LSTM, specifically we want to
generate new names as inspiration for those having a baby :)
Although this is for name generation, the code is general in the
way that you can just send in any large text file (shakespear text, etc)
and it will generate it.
Programmed by Aladdin Per... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.LSTM",
"torch.nn.CrossEntropyLoss",
"torch.multinomial",
"torch.cuda.is_available",
"torch.nn.Embedding"
] | 1.5.0 | xuyannus/Machine-Learning-Collection | 425d196e9477dbdbbd7cc0d19d29297571746ab5 |
1.8 | from collections import OrderedDict
from typing import List
import torch
from torch import nn
from torchvision.models import densenet121, densenet161, densenet169, densenet201, DenseNet
from .common import EncoderModule, _take, make_n_channel_input
__all__ = ["DenseNetEncoder", "DenseNet121Encoder", "DenseNet169Enco... | [
"torch.nn.Sequential",
"torch.nn.AvgPool2d"
] | 1.8.1 | azkalot1/pytorch-toolbelt | 9d7544fa32a6c6588f9f8c4525ba702700ac01cc |
1.4 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors, Facebook AI Research 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 L... | [
"torch.nn.Linear",
"torch.cat",
"torch.stack",
"torch.einsum",
"torch.nn.Parameter",
"torch.multinomial",
"torch.load",
"torch.nn.BCEWithLogitsLoss",
"torch.nn.functional.pad",
"torch.nn.CrossEntropyLoss",
"torch.topk",
"torch.nn.LayerNorm",
"torch.gather",
"torch.nn.init.normal_",
"torc... | 1.4.0 | HebatallaTarek/Empathy-Mental-Health | 16e2a5f93aabd22803bb39805f8e76c8bea0ccf2 |
1.0 | # coding=utf-8
# Copyright 2020-present 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 ap... | [
"torch.cat",
"torch.cuda.amp.autocast",
"torch.Generator",
"torch.cuda.random.set_rng_state",
"torch.random.get_rng_state",
"torch.cuda.random.set_rng_state_all",
"torch.cuda.is_available",
"torch.load",
"torch.cuda.random.get_rng_state_all",
"torch.nn.DataParallel",
"torch.utils.data.sampler.Ra... | 1.0 | boubakerwa/transformers | 8ed998f6456a60999d6f9a8a6b0094ab2da7473d |
0.4 | import torch.nn as nn
import torch.nn.functional as F
import torch
import argparse
class UPDeT(nn.Module):
def __init__(self, input_shape, args):
super(UPDeT, self).__init__()
self.args = args
self.transformer = Transformer(args.token_dim, args.emb, args.heads, args.depth, args.emb)
... | [
"torch.nn.Linear",
"torch.rand",
"torch.cat",
"torch.nn.LayerNorm",
"torch.nn.Dropout",
"torch.zeros",
"torch.triu_indices",
"torch.stack",
"torch.nn.Sequential",
"torch.bmm",
"torch.nn.ReLU",
"torch.nn.functional.softmax",
"torch.mean"
] | 0.4.1 | DH-O/UPDeT | 5c73feef31bebed59b0a35873a7133f319ec868b |
1.2 | import os
import hydra
import torch
import logging
import torch.nn as nn
from torch import optim
from hydra import utils
import matplotlib.pyplot as plt
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
# self
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirna... | [
"torch.device",
"torch.utils.tensorboard.SummaryWriter",
"torch.cuda.is_available",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"torch.nn.CrossEntropyLoss"
] | 1.2 | dongyingname/DeepKE | e5511bdad739a36cabd8439faebfceee22aebccb |
1.4 | # Adapted from code from the book "Deep Reinforcement Learning" by Maxim Lapan
import numpy as np
import torch
from lib import environ
def validation_run(env, net, episodes=100, device="cpu", epsilon=0.02, comission=0.1):
stats = {
"episode_reward": [],
"episode_steps": [],
"order_profits... | [
"torch.tensor"
] | 1.4.0 | ankile/reinforcement-trading | 849ba30d8be05abf1e9eae919463c4eebe812ce8 |
1.9 | import heapq
import pathlib
import pickle
import string
from collections import defaultdict
from typing import List, Tuple
import click
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import torch
from pydantic import BaseModel
from spacy.lang.en.stop_words import STOP_WORDS
from tqdm.auto imp... | [
"torch.no_grad"
] | 1.9.1 | evanweissburg/judging-a-book | b273988485047e1496387e91529ed25b6688b88f |
1.0 | # Copyright (c) 2020 mingruimingrui
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the MIT-style license found in the
# LICENSE file in the root directory of this source tree.
"""LASER LSTM sequence encoder"""
import torch
from torch import nn
from typ... | [
"torch.nn.LSTM",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.load",
"torch.nn.Embedding"
] | 1.0 | mingruimingrui/laser-keep-alive | 9f06ec825d7a8aadf46f1f1c96dae2537b101b17 |
1.10 | import torch
from torch import nn
import torch.nn.functional as F
import math
from backbone.repvgg import get_RepVGG_func_by_name
import utils
class SixDRepNet(nn.Module):
def __init__(self,
backbone_name, backbone_file, deploy,
bins=(1, 2, 3, 6),
droBatchNorm=nn.... | [
"torch.nn.Linear",
"torch.flatten",
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.AvgPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.load",
"torch.nn.AdaptiveAvgPool2d"
] | 1.10.1 | arsalan0004/6DRepNet | aa28f95516cacb1cac31313b981b9fd3f51f5c28 |
1.7 | import os
import argparse
import gc
from PIL import Image
import numpy as np
import torch
from torchvision.transforms.functional import to_tensor, to_pil_image
from model import Generator
gc.collect()
torch.backends.cudnn.enabled = False
torch.backends.cudnn.benchmark = False
torch.backends.cudnn.deterministic = ... | [
"torch.no_grad",
"torch.load"
] | 1.7.1 | codetyphon/AnimeGAN-web | 6a49296cc039bd86d133a8d023ad94199c19ed2b |
1.4 | #!/usr/bin/env python3
""" ImageNet Training Script
This is intended to be a lean and easily modifiable ImageNet training script that reproduces ImageNet
training results with some of the latest networks and training techniques. It favours canonical PyTorch
and standard Python style over trying to be able to 'do it al... | [
"torch.cuda.synchronize",
"torch.nn.SyncBatchNorm.convert_sync_batchnorm",
"torch.distributed.init_process_group",
"torch.no_grad",
"torch.nn.parallel.DistributedDataParallel",
"torch.cuda.device_count",
"torch.cuda.set_device",
"torch.nn.BCEWithLogitsLoss",
"torch.jit.script",
"torch.nn.CrossEntr... | 1.4.0 | Daweek/Edgar-pytorch-image-models | ca3398c64a8fb8b2e01f7057679440ff6a6c6672 |
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 | suakow/transformers | 0ec3619bb2c212737d2472cccaf6658317d2bfa1 |
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.CrossEntropyLoss"
] | 1.0 | suakow/transformers | 0ec3619bb2c212737d2472cccaf6658317d2bfa1 |
1.7 | import os
import sys
sys.path.append(os.path.abspath(".") + "/../")
sys.path.append(os.path.abspath("."))
import clip
import torch
import json
from PIL import Image
# Load the model
device = "cuda" if torch.cuda.is_available() else "cpu"
#model, preprocess = clip.load('ViT-B/32', device)
# 华为云项目
model, preprocess = cl... | [
"torch.no_grad",
"torch.cuda.is_available"
] | 1.7.1 | zhuxiangru/CLIP-finetune-v1 | 48bbe2c203667d94bcc82ea3fcdd2acec7ada8ab |
0.4 | import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.optim import lr_scheduler
###############################################################################
# Helper Functions
###############################################################################
def get_norm_layer(norm_... | [
"torch.optim.lr_scheduler.StepLR",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"torch.nn.LeakyReLU",
"torch.nn.init.kaiming_normal_",
"torch.cuda.is_available",
"torch.nn.BCEWithLogitsLoss",
"torch.nn.DataParallel",
"torch.nn.init.constant_",
"torch.nn.ConvTranspose2d",
"torch.nn.init.normal_",
... | 0.4.1 | spongezhang/pytorch-CycleGAN-and-pix2pix | 01875b21d537512c304f37fb0eb65fea7f57f4ba |
1.9 | import os
import torch
import numpy as np
import math
import scipy
from htvlearn.lattice import Lattice
from htvlearn.delaunay import Delaunay
from htvlearn.grid import Grid
class Hex():
"""Hexagonal lattice vectors"""
v1 = Lattice.hexagonal_matrix[:, 0].numpy()
v2 = Lattice.hexagonal_matrix[:, 1].numpy... | [
"torch.cat",
"torch.manual_seed",
"torch.tensor",
"torch.empty",
"torch.zeros",
"torch.cuda.manual_seed_all",
"torch.from_numpy",
"torch.linalg.solve",
"torch.empty_like"
] | 1.9.0 | joaquimcampos/HTV-Learn | dfc6c3b022ba010e18316d941af44d87c98cfa98 |
1.6 | import torch
import torch.nn.functional as F
from rl_algorithms.common.abstract.learner import TensorTuple
import rl_algorithms.common.helper_functions as common_utils
from rl_algorithms.registry import LEARNERS
from rl_algorithms.sac.learner import SACLearner
@LEARNERS.register_module
class BCSACLearner(SACLearner)... | [
"torch.zeros",
"torch.cat",
"torch.mul"
] | 1.6.0 | krishanrana/rl_algorithms | c12fe447a70f2f99f37f6c1157907755d38fde81 |
1.8 | # PyTorch utils
import logging
import math
import os
import subprocess
import time
from contextlib import contextmanager
from copy import deepcopy
from pathlib import Path
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.functional as F
import torchvision
try:
import thop ... | [
"torch.zeros",
"torch.device",
"torch.nn.utils.prune.l1_unstructured",
"torch.sqrt",
"torch.cuda.synchronize",
"torch.nn.functional.interpolate",
"torch.cuda.get_device_properties",
"torch.no_grad",
"torch.nn.utils.prune.remove",
"torch.cuda.device_count",
"torch.manual_seed",
"torch.mm",
"t... | 1.8.1 | AndrewLaird/ChessTutorModels | c4fd960417d5b9918e430d040deb89fed3f4b73b |
1.7 | from torch.nn import Conv2d, MaxPool2d
from torch import no_grad, round
from torch.nn.functional import interpolate
from itertools import chain
class PRISM:
_excitations = []
_hook_handlers = []
_is_orig_image = True
def _excitation_hook(module, input, output):
# for better output sharpness w... | [
"torch.round",
"torch.nn.functional.interpolate",
"torch.no_grad"
] | 1.7.1 | szandala/PRISM | 7f40e9ebdb5e53c1343cd3d358933861b24573da |
1.10 | import torch.nn as nn
# Fully connected neural network with one hidden layer
class NeuralNet(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNet, self).__init__()
self.fc1 = nn.Linear(input_size, hidden_size)
self.fc2 = nn.Linear(hidden_size, hidden_size)
... | [
"torch.nn.Linear",
"torch.nn.ReLU"
] | 1.10.1 | magalhaesdavi/ai-chatbot | 810740fbbd694539d6fd4ddc6f482e5d8f26b52d |
1.8 | import math
from functools import partial
from typing import Tuple
import torch
from torch.quantization.observer import _ObserverBase
from mqbench.utils import sync_tensor, pot_quantization, is_symmetric_quant
from mqbench.utils.logger import logger
class ObserverBase(_ObserverBase):
'''
Support per-ten... | [
"torch.round",
"torch.min",
"torch.max",
"torch.maximum",
"torch.minimum",
"torch.clamp",
"torch.abs",
"torch.tensor",
"torch._aminmax",
"torch.ones_like",
"torch.zeros_like",
"torch.flatten"
] | 1.8.1 | thb1314/mqbench-openvino | 476d64a18a009fa5c001895343929c0332224e1a |
1.2 | from typing import Tuple, Callable, Union, Type, List, Dict, Any
from itertools import combinations
import torch
import torch.nn as nn
import torch.nn.functional as F
from mars_gym.torch.init import lecun_normal_init
from mars_gym.model.abstract import RecommenderModule
import numpy as np
from mars_gym.meta_config imp... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.Embedding"
] | 1.2 | engsoares/mars-gym | c58605180a3f5fb16edbe8bd8954095b9f00a446 |
1.2 | import torch
import torch.nn as nn
import os
import torchvision
import torchvision.transforms as transforms
from tqdm import tqdm as pbar
import numpy as np
import time
from tqdm import tqdm
import scipy.linalg
import random
from random import shuffle
is_print = True
def _print(*args, **kwargs):
if is_print:
... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.BatchNorm2d",
"torch.nn.init.kaiming_normal_",
"torch.load",
"torch.nn.CrossEntropyLoss",
"torch.nn.init.normal_",
"torch.utils.data.DataLoader",
"torch.nn.init.zeros_",
"torch.max",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.functional.soft... | 1.2.0 | k-hanawa/criteria_for_instance_based_explanation | bb6ae19a9164748e1fac08f8a7a1ad0adf28a94c |
1.6 | # -*- coding: utf-8 -*-
import unittest
from argparse import Namespace
from io import StringIO
from comet.models import CometRanker
from comet.models.utils import average_pooling, max_pooling
import torch
class TestCometRanker(unittest.TestCase):
hparams = Namespace(
**{"encoder_model": "LASER", "pretr... | [
"torch.equal",
"torch.tensor"
] | 1.6 | chryssa-zrv/UA_COMET | 527e7c86bd0a0d8ff90efda58e820108a5666b92 |
1.6 | # -*- coding: utf-8 -*-
import unittest
from argparse import Namespace
from io import StringIO
import numpy as np
import torch
from comet.models import CometEstimator
from comet.models.utils import average_pooling, max_pooling
class TestCometEstimator(unittest.TestCase):
hparams = Namespace(
**{
... | [
"torch.cat",
"torch.tensor",
"torch.equal"
] | 1.6 | chryssa-zrv/UA_COMET | 527e7c86bd0a0d8ff90efda58e820108a5666b92 |
1.3 | #! /usr/bin/env python
# coding: utf-8
#
# Copyright (c) 2019 JR Oakes
#
# 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 to use,... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.Tanh",
"torch.FloatTensor",
"torch.no_grad",
"torch.nn.CosineSimilarity",
"torch.mean"
] | 1.3.1 | jroakes/tech-seo-crawler | c60619cb6517069665e229917cfbc4fd0614d36f |
1.4 | """DAgger (https://arxiv.org/pdf/1011.0686.pdf).
Interactively trains policy by collecting some demonstrations, doing BC, collecting more
demonstrations, doing BC again, etc. Initially the demonstrations just come from the
expert's policy; over time, they shift to be drawn more and more from the imitator's
policy.
"""... | [
"torch.save",
"torch.utils.data.DataLoader"
] | 1.4.0 | jadecastro/imitation | e05d7f5a4adfb021699647b80576c74ba6bd9443 |
0.0 | import os
os.environ['PYOPENGL_PLATFORM'] = 'osmesa'
import glob
import numpy as np
import torch
import yaml
import trimesh
import numbers
import pickle as pkl
from torch.utils import data
from scipy.spatial import cKDTree as KDTree
from scipy.spatial.transform import Rotation as R
# from human_body_prior.mesh impor... | [
"torch.utils.data.items",
"torch.utils.data.update"
] | 0.0.8 | taconite/PTF | a8789c9f752aea2944c2a75e04cc2aa21c7e4a00 |
1.0 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors, The HugginFace Inc. team and University of Washington.
#
# 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.... | [
"torch.device",
"torch.tensor"
] | 1.0 | soheeyang/denspi | f540b6a547f012823fc6c2bb10077df6bccc13a6 |
0.3 | import torch
from torch import nn, optim
from torch.nn import functional as F
EPS = 1e-12
class VAE(nn.Module):
def __init__(self, img_size, latent_spec, temperature=.67, use_cuda=False):
"""
Class which defines model and forward pass.
Parameters
----------
img_size : tup... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.Sigmoid",
"torch.nn.Sequential",
"torch.max",
"torch.nn.ConvTranspose2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.functional.softmax",
"torch.log",
"torch.exp"
] | 0.3.1 | 7wik/joint-vae | 4ba1ba7c202cb7c2dd8f1467e1f1b82ef5efd344 |
1.7 | # Loss functions
import torch
import torch.nn as nn
from utils.metrics import bbox_iou
from utils.torch_utils import is_parallel
def smooth_BCE(eps=0.1): # https://github.com/ultralytics/yolov3/issues/238#issuecomment-598028441
# return positive, negative label smoothing BCE targets
return 1.0 - 0.5 * eps,... | [
"torch.zeros",
"torch.sigmoid",
"torch.cat",
"torch.arange",
"torch.max",
"torch.argsort",
"torch.ones",
"torch.abs",
"torch.full_like",
"torch.tensor",
"torch.nn.BCEWithLogitsLoss",
"torch.ones_like",
"torch.zeros_like",
"torch.exp"
] | 1.7.0 | Daesung-Jung/baseball_pitchdesign | d4dc1eb5fb42bbf0bb3564be8def0492b80a0074 |
1.0 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | [
"torch.no_grad",
"torch.utils.data.DataLoader"
] | 1.0 | jecoz/transformers | cbfda413389830fc2788f82f49279c4c566b4194 |
1.5 | import torch
def repeat_parameter(parameter, *sizes):
parameter.data = parameter.data.repeat(*sizes)
if parameter.grad is not None:
parameter.grad = parameter.grad.repeat(*sizes)
def qkv_weight_repeat(parameter, ratio):
q, k, v = torch.chunk(parameter, 3, dim=0)
q = q.repeat(ratio, ratio)
... | [
"torch.cat",
"torch.chunk"
] | 1.5.0 | TevenLeScao/transformer-xl | f15c845d83fe7952e841cda92e277919e8ec10fe |
1.5 | import torch
import torch.nn.functional as F
import torch.autograd
import a3t.diffai.helpers as h
def catNonNullErrors(op, ref_errs=None): # the way of things is ugly
def doop(er1, er2):
erS, erL = (er1, er2)
sS, sL = (erS.size()[0], erL.size()[0])
if sS == sL: # TODO: here we know we... | [
"torch.cat",
"torch.nn.functional.avg_pool2d",
"torch.nn.functional.softplus",
"torch.min",
"torch.arange",
"torch.max",
"torch.isnan",
"torch.nn.functional.adaptive_avg_pool2d",
"torch.abs",
"torch.nn.functional.cross_entropy",
"torch.nn.functional.relu",
"torch.exp",
"torch.sort",
"torch... | 1.5 | ForeverZyh/NLP_training_framework | d5cc28bf389a3f57439a5650a614e341ea333bb8 |
1.10 | # coding=utf-8
# Copyright (c) DIRECT Contributors
"""MRI model engine of DIRECT."""
import gc
import pathlib
import time
from abc import abstractmethod
from collections import defaultdict
from os import PathLike
from typing import Callable, Dict, List, Optional, Tuple, Union
import numpy as np
import torch
from tor... | [
"torch.zeros",
"torch.no_grad",
"torch.stack",
"torch.cuda.empty_cache"
] | 1.10.2 | NKI-AI/direct | 7c9d59345b68ea70bc20a5cea2c895c6059f8e46 |
0.2 | #!/usr/bin/env python3
"""
An entry into the ml4seti signal classifier competition.
This entry is simply a large densenet architecture convolutional neural
network. For more information, see "Densely Connected Convolutional Networks"
<https://arxiv.org/pdf/1608.06993.pdf>
"""
import argparse
import time
import sklear... | [
"torch.stack",
"torch.max",
"torch.LongTensor",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"torch.load",
"torch.nn.CrossEntropyLoss"
] | 0.2.0 | sagelywizard/ml4seti | d56ffd46ca598ff4d44d2bc274acb7dc59389acd |
1.6 | import os
import time
import glob
import argparse
import os.path as osp
from tqdm import tqdm
from typing import Optional, List, NamedTuple
import numpy as np
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import ModuleList, Sequential, Linear, BatchNorm1d, ReLU, Dropout
from torc... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.Dropout",
"torch.optim.lr_scheduler.StepLR",
"torch.nn.ModuleList",
"torch.save",
"torch.nn.functional.dropout",
"torch.nn.functional.elu",
"torch.no_grad",
"torch.from_numpy",
"torch.nn.ReLU",
"torch.nn.functional.cross_entropy",
"torch.nn.BatchNorm... | 1.6.0 | tsotfsk/ogb | 3c24dd5f67a13426d5f39c7a71a460499713631a |
1.2 | from typing import Callable
import pytest
import torch
from rainy.net import GruBlock, LstmBlock, RnnBlock
from rainy.utils import Device
@pytest.mark.parametrize("rnn_gen", [GruBlock, LstmBlock])
def test_rnn(rnn_gen: Callable[[int, int], RnnBlock]) -> None:
TIME_STEP = 10
BATCH_SIZE = 5
INPUT_DIM = 20... | [
"torch.cat",
"torch.randn"
] | 1.2 | kngwyu/Rainy | 535f8f49d9efe0324a8480d0165ab1b35d83dc19 |
1.2 | """
This module has an implementation of ACKTR, which is described in
- Scalable trust-region method for deep reinforcement learning using
Kronecker-factored approximation
- URL: https://arxiv.org/abs/1708.05144
"""
import torch
from ..config import Config
from ..net import Policy
from .a2c import A2CAgent
class ... | [
"torch.randn_like"
] | 1.2 | kngwyu/Rainy | 535f8f49d9efe0324a8480d0165ab1b35d83dc19 |
1.10 | import os
import torch
from torch import nn
from torch.nn.functional import interpolate, softmax
from torch.cuda.amp import autocast
from .base import BaseNet
norm_layer = nn.BatchNorm2d
class DFF(BaseNet):
"""
Reference:
- Hu, Yuan, et.al "Dynamic Feature Fusion for Semantic Edge Detection... | [
"torch.cat",
"torch.mul",
"torch.cuda.amp.autocast",
"torch.nn.Sigmoid",
"torch.nn.ConvTranspose2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.sum"
] | 1.10.0 | Theia-4869/U-RISC | c493b11ab525b39a5ac029c3f83e059d703abaae |
1.0 | import torch
from abstract_rl.src.data_structures.abstract_conf.model_configuration import ModelConfiguration
from abstract_rl.src.operator.trajectory_operator import TrajectoryOperator
class ResampleOperator(TrajectoryOperator):
"""
Samples for each state additional actionsa and equips
"""
def __re... | [
"torch.Tensor"
] | 1.0.1 | kosmitive/abstract_rl | 13038a1a5a93c78374ba869c9e75221c2b73d290 |
1.3 | import os
import cv2
import glob
import numpy as np
from PIL import Image
import torch
import torchvision
from torch.utils import data
from torchvision import transforms
import torch
from torch import nn
import torchvision
import torch.nn.functional as F
def get_char_dict():
char_dict = {}
char_dict["pad"] = ... | [
"torch.from_numpy",
"torch.tensor"
] | 1.3.1 | guanjianyu/pytorch_hand_written_recognition | b9804ee1213fa744430ee7c25a52b04ab295747a |
1.6 | # Copyright (c) Facebook, Inc. and its affiliates.
import math
import os
from copy import deepcopy
from typing import Dict, List, Optional, Tuple
import numpy as np
import torch
import torch.nn.functional as F
from mmf.common.registry import registry
from mmf.models import BaseModel
from mmf.modules.hf_layers import ... | [
"torch.nn.Linear",
"torch.cat",
"torch.ones",
"torch.jit.is_scripting",
"torch.nn.CrossEntropyLoss",
"torch.nn.LayerNorm",
"torch.tensor",
"torch.nn.KLDivLoss",
"torch.zeros_like",
"torch.zeros",
"torch.nn.functional.log_softmax",
"torch.nn.ReLU",
"torch.nn.functional.softmax",
"torch.matm... | 1.6.0 | junqi-jiang/mmf | c8f47a23b85a87d14616c2f53e81693a25ea929a |
1.4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import typer
import time
import gym
import torch
import collections
import numpy as np
import pandas as pd
from pathlib import Path
import matplotlib.pyplot as plt
from sklearn.manifold import TSNE
import pygame
from pygame.locals import VIDEORESIZE
import gym.wrappers a... | [
"torch.device"
] | 1.4.0 | miguel-bm/ai6rl | cd751b734e485784e0d42bf4af7068860635ea91 |
1.7 | import pytest
import torch
from flash.core.serve.types import Label
def test_path(session_global_datadir):
label = Label(path=str(session_global_datadir / "imagenet_labels.txt"))
assert label.deserialize("chickadee") == torch.tensor(19)
assert label.serialize(torch.tensor(19)) == "chickadee"
def test_l... | [
"torch.tensor"
] | 1.7.1 | Actis92/lightning-flash | 49972268cfc0f95f1bd2b8fbf25036970cc44b59 |
0.3 | import os
import torch
import datasets
import translation_models.model as tmm
import translation_models.help_fun as transl_hf
import onmt
import model_manager
import quantization
import copy
import pickle
import functools
import quantization.help_functions as qhf
import helpers.functions as mhf
cuda_devices = os.envir... | [
"torch.cuda.is_available"
] | 0.3.1 | lijian10086/quantized_distillation | bb500b7ae48a3f6751d6434126de9845b58d2d65 |
0.4 | ###########################################################################
# Created by: Hang Zhang
# Email: zhang.hang@rutgers.edu
# Copyright (c) 2017
###########################################################################
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.func... | [
"torch.nn.functional.upsample",
"torch.cuda.device_of",
"torch.nn.parallel.scatter_gather.scatter",
"torch.nn.functional.pad"
] | 0.4.0 | youansheng/PyTorch-Encoding | dc501d28d478dbf668186f721c8600387c32859c |
0.4 | from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CppExtension
setup(
name='enclib_cpu',
ext_modules=[
CppExtension('enclib_cpu', [
'roi_align.cpp',
'roi_align_cpu.cpp',
]),
],
cmdclass={
'build_ext': BuildExtension
... | [
"torch.utils.cpp_extension.CppExtension"
] | 0.4.0 | youansheng/PyTorch-Encoding | dc501d28d478dbf668186f721c8600387c32859c |
1.8 | import os
import argparse
import json
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping
from asteroid.models import ConvTasNet
from asteroid.engine.optimizers import make_optimizer
from asteroid.eng... | [
"torch.cuda.is_available",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"torch.load"
] | 1.8.0 | ccan1995/asteroid | 782e95be17b6c16ed2b292d11b9063bf274ca346 |
1.9 | import torch
import torch.nn as nn
import torchvision.transforms as transforms
import torchvision.datasets as dsets
# datasets
train_dataset = dsets.MNIST(root='../../../_data', train=True, transform=transforms.ToTensor(), download=True)
test_dataset = dsets.MNIST(root='../../../_data', train=False, transform=transfor... | [
"torch.nn.Linear",
"torch.max",
"torch.nn.Tanh",
"torch.utils.data.DataLoader",
"torch.nn.CrossEntropyLoss"
] | 1.9.0 | niektuytel/Machine_Learning | 0cd5656ca8076c383fd81c5e32a49969a20ad042 |
0.4 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch.nn.functional as F
... | [
"torch.nn.functional.cross_entropy"
] | 0.4.1 | DeepLearnXMU/ABDNMT-RNMT | c3b20e4afdbfee5741e95a42bbd31329bb9bb93d |
1.10 | import os
import json
import sys
import time
import torch
from torch import nn
from torch import optim
import torchvision as tv
from torchvision.datasets import ImageFolder
from torch.utils.data import DataLoader
from PIL import Image
import numpy as np
EPS = 1e-6
ALPHA_RECONSTRUCT_IMAGE = 1
ALPHA_RECONSTRUCT_LATENT ... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.LeakyReLU",
"torch.nn.BatchNorm2d",
"torch.ones",
"torch.sum",
"torch.nn.Softmax",
"torch.nn.functional.pixel_shuffle",
"torch.nn.BCELoss",
"torch.zeros",
"torch.nn.Tanh",
"torch.nn.Conv2d",
"torch.nn.MSELoss",
"torch.nn.Si... | 1.10.0 | godomainz/PokeGAN | 253c267a89e7545524bcd0db3859fdfa801e303e |
1.4 | import util
import numpy as np
import random
from transformers import BertTokenizer, AutoTokenizer
import os
from os.path import join
import json
import pickle
import logging
import torch
import itertools
logger = logging.getLogger(__name__)
class CorefDataProcessor:
def __init__(self, config, language='english'... | [
"torch.tensor"
] | 1.4.0 | ondfa/coref-multiling | ac4ccf4ddb3187939525c5e7076057e7fdce55a4 |
1.0 | import torch.nn as nn
from simplecv.interface import ConfigurableMixin
from simplecv.module._hrnet import hrnetv2_w18
from simplecv.module._hrnet import hrnetv2_w32
from simplecv.module._hrnet import hrnetv2_w40
from simplecv.module._hrnet import hrnetv2_w48
from simplecv.module import context_block
from simplecv.modul... | [
"torch.utils.checkpoint.checkpoint"
] | 1.0 | Bobholamovic/SimpleCV | f4edacf088d0155725a469e227de847820bdfa53 |
1.0 | from __future__ import division
from models import *
from utils.utils import *
from utils.datasets import *
import os
import sys
import time
import datetime
import argparse
from PIL import Image
import torch
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable... | [
"torch.no_grad",
"torch.cuda.is_available",
"torch.load"
] | 1.0 | ljx02/MLFinalWork | d0eb1551401035be5b8c12fe1fd3733aefcc652f |
0.27 | # Copyright 2021 MosaicML. All Rights Reserved.
"""Core MixUp classes and functions."""
from __future__ import annotations
import logging
from typing import Optional, Tuple
import numpy as np
import torch
from torch.nn import functional as F
from composer.core.types import Algorithm, Event, Logger, State, Tensor
f... | [
"torch.Tensor",
"torch.nn.functional.one_hot",
"torch.randperm"
] | 0.27 | stanford-crfm/composer | 4996fbd818971afd6439961df58b531d9b47a37b |
1.5 | """Torch backend distributions"""
def get_TorchDeterministic():
from numbers import Number
import torch
from torch.distributions import constraints
from torch.distributions.kl import register_kl
from torch.distributions.utils import broadcast_all
class TorchDeterministic(torch.distributions... | [
"torch.Size",
"torch.zeros",
"torch.distributions.utils.broadcast_all",
"torch.ones",
"torch.distributions.kl.register_kl"
] | 1.5.0 | chiragnagpal/probflow | 1ba0619cd4f482a015cd25633d2f113d5d0f3476 |
1.4 | import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
logger = logging.getLogger(__name__)
class SeqSoftmaxDecoder(nn.Module):
"""This class decodes sequence hidden unit
"""
def __init__(self, hidden_size, label_size, bias=True):
"""This function sets SeqSoftmaxDecode... | [
"torch.nn.Linear",
"torch.nn.CrossEntropyLoss",
"torch.nn.functional.log_softmax"
] | 1.4.0 | Receiling/ENPAR | decd2945d21a7be5a0f73c37cfc5e252301aab15 |
1.6 | # Differentiable Augmentation for Data-Efficient GAN Training
# Shengyu Zhao, Zhijian Liu, Ji Lin, Jun-Yan Zhu, and Song Han
# https://arxiv.org/pdf/2006.10738
from random import random
import torch
import torch.nn as nn
import torch.nn.functional as F
class DiffAugment(nn.Module):
def __init__(self, policy='', ... | [
"torch.nn.functional.pad",
"torch.nn.functional.interpolate",
"torch.arange"
] | 1.6.0 | AyushExel/GANSketching | c72524ac4425de898087af7a4c554b777a4e2218 |
1.7 | ################################################################################
# Code from
# https://github.com/pytorch/vision/blob/master/torchvision/datasets/folder.py
# Modified the original code so that it also loads images from the current
# directory as well as the subdirectories
###########################... | [
"torch.mul",
"torch.median",
"torch.from_numpy"
] | 1.7.0 | mckaymckay/Unsupervised-learning | 46d627fc5b24043ebb6f2e3b4388b66be3ece7d5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.