version
stringclasses
24 values
code
stringlengths
396
135k
apis
list
full_version
stringlengths
1
6
repo_name
stringlengths
6
64
hexsha
stringlengths
40
40
1.8
import numpy as np import torch from discrete_network.network import KNNet, KNNetParameters, KNNetState from discrete_network.method.force_method import ForceParameters, ForceLearn from discrete_network.device import device import matplotlib.pyplot as plt print(f"Device = {device.type}") # params_spiking = KNNetParam...
[ "torch.rand", "torch.sqrt", "torch.zeros", "torch.linalg.norm", "torch.as_tensor", "torch.log" ]
1.8.2
aw02m/Spiking_neural_networks
4c23c50b52b15a9e5709cb672fd18cd22218b9f2
1.7
#!/usr/bin/env python # -*- coding: utf-8 -*- """ created by Halo 2020/10/28 11:28 https://tangshusen.me/Dive-into-DL-PyTorch/#/chapter03_DL-basics/3.12_weight-decay """ import torch import torch.nn as nn import numpy as np import mytorch.d2lzh_pytorch as d2l n_train, n_test, num_inputs = 20, 100, 200 true_w, true_b ...
[ "torch.zeros", "torch.nn.Linear", "torch.optim.SGD", "torch.ones", "torch.randn", "torch.nn.init.normal_", "torch.utils.data.DataLoader", "torch.matmul", "torch.utils.data.TensorDataset" ]
1.7.0
Halo1236/Dive-into-DL-PyTorch
586b4e9ca77b2121ce5f5bec8b0a893b33f1b574
1.4
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from torch.nn import functional as F from detectron2.layers import paste_masks_in_image from detectron2.structures import Instances def detector_postprocess(results, output_height, output_width, mask_threshold=0.5): """ Resize the output ...
[ "torch.nn.functional.interpolate" ]
1.4.0
aleSuglia/py-bottom-up-attention
a97142ad3526c11272c471ee7d610494f1247b7b
1.0
"""Training utilities.""" import os from typing import Any, Dict, Union import pytorch_lightning as pl import torch from loguru import logger from pytorch_lightning.callbacks.base import Callback from pytorch_lightning.callbacks.early_stopping import EarlyStopping from pytorch_lightning.callbacks.model_checkpoint impo...
[ "torch.cuda.is_available" ]
1.0
yvesnana/rxnaamapper
48fb6a6f45f5ec087f99cedbac34eda2a65e14a3
1.9
# ***************************************************************************** # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions...
[ "torch.sigmoid", "torch.cat", "torch.nn.ConvTranspose1d", "torch.nn.ModuleList", "torch.nn.Conv1d", "torch.IntTensor", "torch.autograd.Variable", "torch.nn.utils.remove_weight_norm", "torch.FloatTensor", "torch.det", "torch.nn.functional.conv1d", "torch.cuda.is_available", "torch.logdet", ...
1.9.0
brooklynbagel/Voice-Cloning-App
6e0034dc0b4e21f669d28753b5f30b32cca382ad
1.8
import warnings from typing import Any, Dict, Optional, Type, Union import numpy as np import torch as th from mod_gym.gym import spaces from torch.nn import functional as F from mod_stable_baselines3.stable_baselines3.common.on_policy_algorithm import OnPolicyAlgorithm from mod_stable_baselines3.stable_baselines3.co...
[ "torch.min", "torch.no_grad", "torch.clamp", "torch.nn.functional.mse_loss", "torch.abs", "torch.exp", "torch.mean" ]
1.8.1
Practical-Formal-Methods/mod_stable_baselines3
08bdb0a529c8ab446ac7973f2a02f832c0c3f454
1.8
# Copyright 2021 cstsunfu. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
[ "torch.ones_like", "torch.nn.init.xavier_uniform_", "torch.randn", "torch.einsum" ]
1.8.2
cstsunfu/dlkit
69e0efd372fa5c0ae5313124d0ba1ef55b535196
1.8
''' Accelerate demo with fp16 and multi-gpu support. Single CPU: python accelerate_demo.py --cpu 16-bit Floating Point: python accelerate_demo.py --fp16 Model from timm: python accelerate_demo.py --timm Singe-GPU: python accelerate_demo.py Multi-GPU or Multi-CPU: accelerate config accelerat...
[ "torch.nn.Linear", "torch.optim.lr_scheduler.CosineAnnealingLR", "torch.no_grad", "torch.utils.data.DataLoader", "torch.nn.CrossEntropyLoss" ]
1.8.0
Cahlil-Togonon/Deep-Learning-Experiments
501ae610b0a8fb7fb75a53dcfdab71be49274b58
1.3
import platform import pytest import torch from torch.utils.data.dataloader import DataLoader from torch.utils.data.dataset import Subset import tests.base.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException from tests.base import EvalMode...
[ "torch.nn.ReLU", "torch.utils.data.dataloader.DataLoader", "torch.cuda.device_count" ]
1.3
binshengliu/pytorch-lightning
8f6b7a2b4fea9b7bd0b873f5973e6364b3981412
0.4
''' Script to train the ranker Should add some sort of image pool someday...? ''' import time from options.train_options import TrainOptions from data import CreateDataLoader from models import create_model from util.visualizer import Visualizer from models import networks import pdb import torch from collections imp...
[ "torch.load" ]
0.4.0
dangeng/infiniteGANorama
92c9cbe0638cf9fcdc05020759772e36aebf788c
1.5
#!/usr/bin/env python """ Simple implementation for mixup. The loss and onehot functions origin from: https://github.com/moskomule/mixup.pytorch Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, David Lopez-Paz: mixup: Beyond Empirical Risk Minimization https://arxiv.org/abs/1710.09412 """ __all__ = [ 'mixup_cross_ent...
[ "torch.nn.functional.softmax", "torch.sum" ]
1.5.1
bozliu/E2E-Keyword-Spotting
64fc6fe414370a12a22fdf8ca5c8379d2c60b64e
0.4
""" A :class:`~allennlp.training.trainer.Trainer` is responsible for training a :class:`~allennlp.models.model.Model`. Typically you might create a configuration file specifying the model and training parameters and then use :mod:`~allennlp.commands.train` rather than instantiating a ``Trainer`` yourself. """ # pylint...
[ "torch.nn.parallel.replicate", "torch.no_grad", "torch.save", "torch.nn.parallel.scatter_gather.scatter_kwargs", "torch.tensor", "torch.nn.parallel.parallel_apply" ]
0.4.0
albert-dot-ai/allennlp
580dc8b0e2c6491d4d75b54c3b15b34b462e0c67
1.9
""" 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 math from typing import List, Tuple, Optional import fastmri import torch import torch.nn as nn import torch.nn.functional as F from ...
[ "torch.zeros", "torch.min", "torch.argmin", "torch.ones", "torch.ones_like", "torch.nn.functional.pad", "torch.where" ]
1.9.0
vigsivan/fastMRI
0f6c4c0176ff74bf2761d20ec62facb01c9038f8
1.13
import csv import decimal import os import threading import time from typing import List import torch import torch.distributed as dist import torch.distributed.rpc as rpc import torch.multiprocessing as mp from torch.distributed import rpc from .trpc_server import TRPCCOMMServicer from ..base_com_manager import BaseC...
[ "torch.distributed.rpc.TensorPipeRpcBackendOptions", "torch.multiprocessing.spawn", "torch.distributed.rpc.ProcessGroupRpcBackendOptions", "torch.ones", "torch.distributed.rpc.shutdown" ]
1.13.1
eliaskousk/FedML
e30d5dd3cc84c8a369c828a6f6ef097b3cf67b1a
1.3
# General structure from https://github.com/pytorch/examples/blob/master/mnist/main.py from __future__ import print_function import argparse import os import math import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.optim...
[ "torch.device", "torch.flatten", "torch.optim.lr_scheduler.CosineAnnealingLR", "torch.no_grad", "torch.nn.init.kaiming_normal_", "torch.nn.functional.log_softmax", "torch.manual_seed", "torch.nn.Dropout2d", "torch.nn.functional.linear", "torch.cuda.is_available", "torch.nn.functional.relu", "t...
1.3.0
weizhonz/hid
3ee3aeeaf12baeadf3d85c1bb86296073bba3fbe
1.6
import dataclasses import itertools from typing import List, Optional, Tuple import nltk import torch from .downloader import load_trained_model from ..parse_base import BaseParser, BaseInputExample from ..ptb_unescape import ptb_unescape, guess_space_after TOKENIZER_LOOKUP = { "en": "english", "de": "germa...
[ "torch.cuda.is_available" ]
1.6.0
thomaslu2000/Incremental-Parsing-Representations
1b0ec638e85f0e521a12b53d8b309191c40fe0d3
1.5
# Copyright Contributors to the Pyro project. # Copyright (c) 2020, YosefLab. # SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause """ The data preprocessing code in this script is adapted from: https://github.com/YosefLab/scvi-tutorials/blob/50dd3269abfe0c375ec47114f2c20725a016736f/seed_labeling.ipynb """ import m...
[ "torch.zeros", "torch.cat", "torch.nn.functional.one_hot", "torch.randperm", "torch.from_numpy", "torch.distributions.Poisson", "torch.where" ]
1.5.0
akihironitta/pyro
0ab6e474330942ff4ec2a87a6cc0c671943fc5cd
1.9
import os import glob import random import cv2 import numpy as np import torch import matplotlib.pyplot as plt import open3d from skimage import io, img_as_float32 from scipy import ndimage from torch_geometric.data import Data, DataListLoader from torch_geometric.loader import DataLoader as GraphLevelDataLoader from t...
[ "torch.zeros", "torch.cat", "torch.from_numpy", "torch.tensor", "torch.reshape" ]
1.9.1
johnpeterflynn/surface-texture-inpainting-net
b2de05eaa47c9bcca53b9aee12b6012ac2c05156
1.3
import os import random import sys from unittest.mock import patch import numpy as np import pytest import torch import torch.nn as nn from torch.optim import SGD from torch.utils.data import BatchSampler, DataLoader, RandomSampler import ignite.distributed as idist from ignite.engine import Events from ignite.engine...
[ "torch.nn.Linear", "torch.utils.data.RandomSampler", "torch.cuda.is_available", "torch.load", "torch.randint_like", "torch.norm", "torch.manual_seed", "torch.randint", "torch.utils.data.DataLoader", "torch.nn.Flatten", "torch.device", "torch.nn.Sequential", "torch.cuda.device_count", "torc...
1.3
Juddd/ignite
00a208a4e7a7783e9ddac18931085fca2f0dec47
1.3
import os import pytest import torch from ignite.distributed.comp_models import has_xla_support if not has_xla_support: pytest.skip("Skip if no XLA support", allow_module_level=True) else: from ignite.distributed.comp_models.xla import _XlaDistModel @pytest.mark.tpu @pytest.mark.skipif(not has_xla_support,...
[ "torch.nn.Linear", "torch.rand", "torch.tensor" ]
1.3
Juddd/ignite
00a208a4e7a7783e9ddac18931085fca2f0dec47
1.3
import torch import math from . import Encoder, Decoder, STFTFB # noqa from .stft_fb import perfect_synthesis_window from . import transforms from ..dsp.consistency import mixture_consistency def griffin_lim(mag_specgram, stft_enc, angles=None, istft_dec=None, n_iter=6, momentum=0.9): """Estimates matching phas...
[ "torch.rand_like" ]
1.3.0
mcernak/asteroid
ed25e166a3bd338547248938116ba614ecfa4b3e
1.3
import torch from .. import complex_nn from ..filterbanks.transforms import from_torchaudio from ..masknn.recurrent import DCCRMaskNet from .dcunet import BaseDCUNet class DCCRNet(BaseDCUNet): """DCCRNet as proposed in [1]. Args: architecture (str): The architecture to use, must be "DCCRN-CL". ...
[ "torch.nn.functional.pad" ]
1.3.0
mcernak/asteroid
ed25e166a3bd338547248938116ba614ecfa4b3e
1.0
""" Inference algorithms and utilities used in the RSA example models. Adapted from: http://dippl.org/chapters/03-enumeration.html """ from __future__ import absolute_import, division, print_function import collections import six import torch from six.moves import queue import pyro import pyro.distributions as dis...
[ "torch.zeros", "torch.rand", "torch.stack", "torch.is_tensor", "torch.tensor", "torch.pow" ]
1.0.0
gavincangan/pyro
d9115a6da7edd7e3fecd6b89a850cc137d7e7e9a
1.0
from __future__ import absolute_import, division, print_function import torch import torch.nn as nn from torch.distributions import constraints from pyro.distributions.torch_transform import TransformModule from pyro.distributions.util import copy_docs_from # This helper function clamps gradients but still passes th...
[ "torch.zeros", "torch.stack", "torch.nn.Sigmoid", "torch.nn.LogSigmoid", "torch.exp" ]
1.0.0
gavincangan/pyro
d9115a6da7edd7e3fecd6b89a850cc137d7e7e9a
1.0
from __future__ import absolute_import, division, print_function import logging from collections import defaultdict, namedtuple import pytest import torch import pyro.distributions as dist from pyro.contrib.gp.kernels import Cosine, Matern32, RBF, WhiteNoise from pyro.contrib.gp.likelihoods import Gaussian from pyro...
[ "torch.Size", "torch.zeros", "torch.stack", "torch.sin", "torch.arange", "torch.ones", "torch.tensor", "torch.eye", "torch.Tensor" ]
1.0.0
gavincangan/pyro
d9115a6da7edd7e3fecd6b89a850cc137d7e7e9a
1.0
from __future__ import absolute_import, division, print_function import math import torch import pyro from pyro import poutine from pyro.contrib.autoguide import mean_field_guide_entropy from pyro.contrib.oed.search import Search from pyro.contrib.util import lexpand from pyro.infer import EmpiricalMarginal, Importan...
[ "torch.stack", "torch.exp", "torch.max" ]
1.0.0
gavincangan/pyro
d9115a6da7edd7e3fecd6b89a850cc137d7e7e9a
1.8
# -*- encoding: utf-8 -*- # ----- # Created Date: 2021/7/16 # Author: Hanjing Wang # ----- # Last Modified: # Modified By: # ----- # Copyright (c) 2020 MARL @ SJTU # ----- import os import ray import copy import pytest import torch import time from malib.backend.datapool.parameter_server import ( Parameter, P...
[ "torch.nn.Linear", "torch.rand", "torch.sub", "torch.no_grad", "torch.nn.ReLU", "torch.nn.init.normal_", "torch.all" ]
1.8.1
apexrl/malib
3785309e9b695ff359131fbbecabb6b5a52ef559
1.4
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
[ "torch.abs", "torch.norm", "torch.no_grad" ]
1.4
jbuckman/pytorch-lightning
cc74fb717a7127fecd4dbb9c743ba28b40de7f64
1.4
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
[ "torch.tensor", "torch.utils.data.DataLoader" ]
1.4
jbuckman/pytorch-lightning
cc74fb717a7127fecd4dbb9c743ba28b40de7f64
1.6
import torch import torch.nn as nn from transformers import BertModel, BertPreTrainedModel class FCLayer(nn.Module): def __init__(self, input_dim, output_dim, dropout_rate=0.0, use_activation=True): super(FCLayer, self).__init__() self.use_activation = use_activation self.dropout = nn.Drop...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.cat", "torch.nn.MSELoss", "torch.nn.Tanh", "torch.nn.CrossEntropyLoss" ]
1.6.0
isotrforever/R-BERT
99e986cab12f2d91f2445c651908c8a18c8c9efe
1.0
############################################################################### # Language Modeling on Penn Tree Bank # # This file generates new sentences sampled from the language model # ############################################################################### import argparse import torch import data parse...
[ "torch.rand", "torch.no_grad", "torch.manual_seed", "torch.multinomial", "torch.cuda.is_available", "torch.load" ]
1.0
Cubbee/apex
0a991543846966d5f586540dc2441e512139e9fc
1.0
""" Group all tests cases for layers""" import pytest import torch from polaris.network.layers import SqueezeExcitation, ResidualBlock2D def test_squeeze_excitation(): X = torch.tensor([[[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]]]) se = SqueezeExcitation(channels=1, ratio=1) se.dense_linear_1....
[ "torch.tensor" ]
1.0
leelastar/leelastar-training
b6b4a36c48c418fcc0bd3ccb7f9c2e95e29f26c9
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.tanh", "torch.matmul", "torch.nn.Embedding...
1.0
reichang182/Transformer
6f90c29eaaba898919b7689ab7e2cfce1604cdb8
1.0
# coding=utf-8 # Copyright 2020, The RAG Authors 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 # # Unless r...
[ "torch.cat", "torch.log_softmax", "torch.no_grad", "torch.nn.functional.log_softmax", "torch.logsumexp" ]
1.0
reichang182/Transformer
6f90c29eaaba898919b7689ab7e2cfce1604cdb8
1.2
import os import time import logging import argparse import cv2 import numpy as np import torch import torch.backends.cudnn as cudnn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.nn as nn from util import dataset, transform, config from util.util import AverageMeter, in...
[ "torch.nn.DataParallel", "torch.no_grad", "torch.nn.functional.interpolate", "torch.utils.data.DataLoader", "torch.nn.functional.softmax", "torch.nn.CrossEntropyLoss" ]
1.2.0
youngsjjn/MemSeg
a3daf8039dc2c763d366f4bfd07c87416cf8ec81
1.2
from __future__ import absolute_import from __future__ import division import torch from torch import nn from torch.nn import functional as F import torchvision from ..utils.torchtools import weights_init_kaiming __all__ = ['ResNet50', 'ResNet101', 'ResNet50M', 'ResNet50B'] class ResNet50(nn.Module): def __ini...
[ "torch.nn.Linear", "torch.cat", "torch.nn.Dropout", "torch.nn.Sequential", "torch.nn.LeakyReLU", "torch.nn.ReLU", "torch.nn.BatchNorm1d" ]
1.2.0
Shengyuan-Z/AGRL.pytorch
6107fe0e4df5c8048a65f811bab46d2fb4624783
1.2
from __future__ import absolute_import from __future__ import division import torch import torch.nn as nn import gc import time def cur_time(): return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) def adjust_learning_rate(optimizer, base_lr, epoch, stepsize, gamma=0.1): # decay learning rate by 'gam...
[ "torch.nn.init.constant_", "torch.is_tensor", "torch.nn.init.kaiming_normal_", "torch.nn.init.normal_", "torch.nn.init.xavier_normal_" ]
1.2.0
Shengyuan-Z/AGRL.pytorch
6107fe0e4df5c8048a65f811bab46d2fb4624783
1.7
import sys import torch import argparse from datetime import timedelta import logging sys.path.append("../") sys.path.append("../../") sys.path.append("../../../") sys.path.append("../../../../") sys.path.append("../../../../../") from experiments.utils import evaluate_mnist_uncertainty from src.data import * from sr...
[ "torch.optim.lr_scheduler.CosineAnnealingLR", "torch.no_grad" ]
1.7.0
tjiagoM/quantised-bayesian-nets
c6ff1db376c366633afa2845b7527cc144ffd3b2
1.6
"""Modules containing pytorch classes to fit 3D meshes to images using differentiable rendering.""" import copy import numpy as np import scipy.sparse.linalg import scipy.spatial.transform.rotation import torch from . import CameraPytorch, LaplacianRigidEnergyPytorch, Scene3DPytorch from .triangulated_mesh_pytorc...
[ "torch.clamp", "torch.tensor", "torch.cross", "torch.optim.LBFGS", "torch.mean", "torch.sum" ]
1.6.0
synapticarbors/DEODR
e67f1792de90669b9adbf1a8103a9ca3b2c2c3dc
1.6
import numpy as np from .downloader import load_trained_model from ..parse_base import BaseParser, BaseInputExample from .spacy_extensions import ConstituentData, NonConstituentException import torch class PartialConstituentData: def __init__(self): self.starts = [np.array([], dtype=int)] self.e...
[ "torch.cuda.is_available" ]
1.6.0
boehm-e/self-attentive-parser
24a50b529d38cc182082e4e72bbf79d1b24ec1da
1.9
""" Tests ideas are taken mostly from https://github.com/dalab/hyperbolic_nn/blob/master/util.py with some changes """ import torch import random import numpy as np import pytest import warnings import itertools import geoopt from geoopt.manifolds import stereographic @pytest.fixture(scope="function", autouse=True, p...
[ "torch.zeros", "torch.rand", "torch.rand_like", "torch.arange", "torch.isnan", "torch.linspace", "torch.isfinite", "torch.ones", "torch.manual_seed", "torch.tensor", "torch.eye", "torch.zeros_like", "torch.as_tensor", "torch.empty" ]
1.9.0
leonMatzner/geoopt
4a7058e43bf78ab5012b862076a74bec175df221
1.5
''' source:https://github.com/WolffyChen/PytorchToCaffe/blob/master/pytorch_to_caffe.py ''' import torch import torch.nn as nn import traceback from Caffe import caffe_net import torch.nn.functional as F from torch.autograd import Variable from Caffe import layer_param from torch.nn.modules.utils import _pair import n...
[ "torch.batch_norm", "torch.nn.modules.utils._pair" ]
1.5.1
pandamax/carrier-of-tricks-for-classification-pytorch
283a9f644b43d4800217bd10c1ab2accf1a787c6
1.5
import torch from torch.autograd import Function from torch import nn from .alias_multinomial import AliasMethod import math class NCEFunction(Function): @staticmethod def forward(self, x, y, memory, idx, params): K = int(params[0].item()) T = params[1].item() Z = params[2].item() ...
[ "torch.rand", "torch.mul", "torch.bmm", "torch.ones", "torch.tensor" ]
1.5.0
xmengli999/self_supervised
b2d40d452d203f60330c84fb213c3ba848468366
1.10
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
[ "torch.utils.cpp_extension.load", "torch.cuda.get_device_name", "torch.utils.cpp_extension._get_build_directory" ]
1.10
One-sixth/fid-helper-pytorch
1d74e9e7e4622bd0ccb209a01a2cc10c74c73c01
1.4
import os import abc import json import logging import time from tempfile import NamedTemporaryFile import numpy as np import torch import torch.distributed as dist from pycocotools.cocoeval import COCOeval from .distributed import synchronize, is_main_process, all_gather_container # FIXME experimenting with speedup...
[ "torch.distributed.get_rank", "torch.tensor", "torch.distributed.broadcast" ]
1.4.0
SKA-INAF/efficientdet-pytorch
8967bab88288d11e5547a7efa391adc0c987be47
1.5
# Copyright (c) 2019 Eric Steinberger import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from PokerRL.rl.neural.CardEmbedding import CardEmbedding from PokerRL.rl.neural.LayerNorm import LayerNorm class MainPokerModuleFLAT_Baseline(nn.Module): def __init__(self, ...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.cat", "torch.full_like", "torch.zeros_like", "torch.nn.functional.relu" ]
1.5
EricSteinberger/DREAM
bfe21bbb0f60ab27a1af9774308efbbbd41e68c4
1.8
import torch import unittest from fusion.model import AE class TestAE(unittest.TestCase): def test_forward(self): # define parameters dim_in = 1 dim_l = 4 input_size = 32 architecture = 'DcganAutoEncoder' architecture_params = dict( input_size = input_si...
[ "torch.rand" ]
1.8.1
Mrinal18/fusion
34e563f2e50139385577c3880c5de11f8a73f220
1.3
import copy import os import torch from torch import nn from torch import optim from ray.tune import Trainable N_LBFGS_STEPS_VALIDATION = 15 class PytorchTrainable(Trainable): """Abstract Trainable class for Pytorch models, which checkpoints the model and the optimizer. Subclass must initialize self.m...
[ "torch.nn.functional.mse_loss", "torch.save", "torch.load" ]
1.3
sfox14/butterfly
13cc15cee5bdb7adaf376219aaf20fab0459e9ef
1.6
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. # Copyright 2019 Kakao Brain # # you may not use this file except in compliance with the License. # You may obtain a cop...
[ "torch.autograd.backward", "torch.get_rng_state", "torch.no_grad", "torch.enable_grad", "torch.cuda.set_rng_state", "torch.cuda.get_rng_state", "torch.set_rng_state", "torch.random.fork_rng" ]
1.6.0
zhaojuanmao/fairscale
61ece000bd1b70029270e2dccab66ffa2ca16d51
1.6
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from threading import Event, Lock, Thread from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast imp...
[ "torch.autograd.backward", "torch.cuda.current_device", "torch.cuda.device_count", "torch.distributed.rpc.rpc_async", "torch.distributed.get_rank", "torch.empty", "torch.distributed.distributed_c10d._get_global_rank" ]
1.6.0
zhaojuanmao/fairscale
61ece000bd1b70029270e2dccab66ffa2ca16d51
1.6
# coding=utf-8 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Ve...
[ "torch.cuda.manual_seed", "torch.cuda.get_rng_state", "torch.cuda.initial_seed", "torch.cuda.FloatTensor", "torch.distributed.get_rank", "torch.distributed.barrier", "torch.randn" ]
1.6.0
zhaojuanmao/fairscale
61ece000bd1b70029270e2dccab66ffa2ca16d51
1.6
import torch import torch.nn as nn import random as rd import sys sys.path.insert(0, 'networks') from Attention import TempAttention from memory_rand import MemoryRamTwoStreamModule, MemoryRamModule, MMModule class HME(nn.Module): def __init__(self, vid_encoder, qns_encoder, ans_decoder, max_len_v, max_len_q, dev...
[ "torch.nn.Linear", "torch.zeros", "torch.cat", "torch.LongTensor", "torch.nn.init.xavier_normal_" ]
1.6.0
doc-doc/NExT-OE
a45d81a48ab5ccc45ff6f7bea60597cc59bc546e
1.5
from torch import nn from torch.autograd import Variable import torch from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import numpy as np # from models.vgg_tro_channel1 import vgg16_bn from models.vgg_tro_channel3 import vgg16_bn, vgg19_bn # torch.cuda.set_device(1) DROP_OUT = False LSTM = Fa...
[ "torch.nn.Linear", "torch.zeros", "torch.cat", "torch.nn.utils.rnn.pad_packed_sequence", "torch.nn.Dropout2d" ]
1.5.1
MattAlexMiracle/SmartPatch
c485cb433d8e085d6eae10a335ee19f5e6c1a41c
1.7
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 3 13:23:59 2021 @author: th """ import torch from torch.nn import ReLU, Linear, Softmax, SmoothL1Loss, Tanh, LeakyReLU from torch_geometric.nn import GCNConv, global_max_pool, global_mean_pool, SGConv, GNNExplainer, SAGEConv, GATConv, FastRGCNCon...
[ "torch.nn.CrossEntropyLoss", "torch.reshape", "torch.abs", "torch.tensor", "torch.max", "torch.square", "torch.nn.MSELoss", "torch.no_grad" ]
1.7.1
arahangua/gnn_prediction_sn
3b3b8da07ee920c94f1a88fab87472860eec6322
1.9
import os import json import random import argparse from tqdm import tqdm import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.nn.init as weight_init from torch.utils.data impo...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.cuda.manual_seed_all", "torch.relu", "torch.no_grad", "torch.manual_seed", "torch.nn.functional.mse_loss", "torch.cuda.is_available", "torch.tensor", "torch.utils.data.DataLoader" ]
1.9.0
dohnlee/qufa2021
5fb42caee09ec228358e49768e32c75e3c0094ce
1.1
# -*- coding: UTF-8 -*- # @Author : Chenyang Wang # @Email : THUwangcy@gmail.com import os import logging import torch import torch.nn as nn import numpy as np import torch.nn.functional as F from datetime import datetime from models.BaseModel import SequentialModel class TiMiRecLight(SequentialModel): runne...
[ "torch.nn.Linear", "torch.nn.functional.normalize", "torch.nn.Dropout", "torch.nn.GRU", "torch.isnan", "torch.nn.functional.softmax", "torch.nn.Sequential", "torch.arange", "torch.nn.functional.log_softmax", "torch.nn.ReLU", "torch.nn.KLDivLoss", "torch.load", "torch.nn.Embedding" ]
1.1.0
Andrewnar/ReChorus
55ceb37beb7b9967a4d18d9899075a8d88d11ddb
1.6
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @file : model.py @author: zijun @contact : zijun_sun@shannonai.com @date : 2020/11/17 14:57 @version: 1.0 @desc : """ import torch from torch import nn from transformers import AutoModel, AutoConfig from datasets.collate_functions import collate_to_max_length cla...
[ "torch.nn.Linear", "torch.mul", "torch.tanh", "torch.nn.functional.softmax", "torch.index_select" ]
1.6.0
kco4776/Self_Explaining_Structures_Improve_NLP_Models
dbc2d852cbe8bffd22b18425e9a4bac00d557eeb
1.6
print("importing") from datasets import load_dataset from datasets import load_metric from transformers import AutoTokenizer, AutoModelForSequenceClassification from transformers import TrainingArguments, DefaultFlowCallback, PrinterCallback from transformers import Trainer import torch from torch import nn import num...
[ "torch.tensor" ]
1.6.0
Dorcoh4/BARTScore
e24fd22b80a01ef142ce43e24ec585f1ee8c1ff2
1.0
import argparse import numpy as np import json import torch from torchvision import datasets, transforms from _params import add_common_params, add_decentralized_params from _train_utils import test, plot_learning_curve from _node import Node from _byzantine_node import ByzantineNode from _data_utils import default_t...
[ "torch.from_numpy", "torch.manual_seed", "torch.cuda.is_available" ]
1.0.1
aprilpear/holdout-sgd
fa81bce57fb98aef262536fb2d7a26567d3143f7
1.1
import logging import time logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%Y/%m/%d %H:%M:%S', level=logging.INFO, ) logger = logging.getLogger("Main") import os,random import numpy as np import torch from utils_glue import output_modes, processors from pyt...
[ "torch.utils.data.ConcatDataset", "torch.device", "torch.cuda.manual_seed_all", "torch.utils.data.RandomSampler", "torch.distributed.init_process_group", "torch.utils.data.DistributedSampler", "torch.utils.data.SequentialSampler", "torch.no_grad", "torch.cuda.device_count", "torch.manual_seed", ...
1.1
johnson7788/TextBrewer
fa7fa4d4a2a8debde5b148d448238f3b4fa1aa9a
1.1
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2020/12/23 4:56 下午 # @File : main.trainer_predict_api.py # @Author: johnson # @Contact : github: johnson7788 # @Desc : import logging logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%Y/%m/%d %H:%M:%S', ...
[ "torch.no_grad", "torch.utils.data.SequentialSampler", "torch.cuda.device_count", "torch.cuda.is_available", "torch.tensor", "torch.utils.data.DataLoader", "torch.load", "torch.utils.data.TensorDataset" ]
1.1
johnson7788/TextBrewer
fa7fa4d4a2a8debde5b148d448238f3b4fa1aa9a
1.0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (C) IBM Corporation 2019 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
[ "torch.nn.Linear", "torch.nn.MaxPool2d", "torch.nn.functional.log_softmax", "torch.nn.Conv2d", "torch.nn.functional.relu" ]
1.0.1
aasseman/pytorchpipe
9cb17271666061cb19fe24197ecd5e4c8d32c5da
1.0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (C) IBM Corporation 2019 # # 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.no_grad", "torch.cuda.device_count" ]
1.0.1
aasseman/pytorchpipe
9cb17271666061cb19fe24197ecd5e4c8d32c5da
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.device", "torch.cuda.is_available", "torch.tensor" ]
1.4
Scitator/MONAI
a42b563acf0c7504cee18ee84c8af2eff6e948a7
1.4
import glob import json import os import random from torch.utils import data from torch.nn import CrossEntropyLoss from torch.utils.data import Subset from datasets.episode import Episode from datasets.wsd_dataset import WordWSDDataset, MetaWSDDataset from datasets.ner_dataset import NERSampler, read_examples_from_fi...
[ "torch.utils.data.DataLoader" ]
1.4.0
muralinba12/MetaLearningForNER
61b5159059e486b8e0b50fcd8089554bc26249f6
1.1
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.nn.functional as F class PointNetEncoder(nn.Module): def __init__(self, in_channel=64): super(PointNetEncoder, self).__init__() self.conv1 = torch.nn.Conv1d(in_channel, 128, 1) self.conv2 = tor...
[ "torch.rand", "torch.cat", "torch.nn.Sigmoid", "torch.nn.Conv1d", "torch.max", "torch.nn.BatchNorm1d" ]
1.1
wyddmw/RotPred
18ca1a565fdbf90e8016e51ed5a3b84dc12109f3
1.7
# Copyright (c) 2021. TsumiNa. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. from collections import OrderedDict from pathlib import Path from scipy.special import softmax import numpy as np import pandas as pd import pytest from shutil i...
[ "torch.from_numpy", "torch.equal", "torch.Tensor" ]
1.7.0
mori0711/XenonPy
e36ca0ea112b45ee629cd980c88e80cd6c96c514
1.1
import json import pprint import random import time import torch import torch.multiprocessing as mp from models.nn.resnet import Resnet from data.preprocess import Dataset from importlib import import_module class Eval(object): # tokens STOP_TOKEN = "<<stop>>" SEQ_TOKEN = "<<seg>>" TERMINAL_TOKENS = [...
[ "torch.multiprocessing.Process", "torch.device" ]
1.1.0
caisarl76/alfred
b73bdc1651e14c02440938b639fa3c7f3ab3d321
1.8
import torch import torch.nn as nn import torch.distributed as dist from torch.utils.tensorboard import SummaryWriter import torch.multiprocessing as mp import torch.distributed as dist import torch.utils.data.distributed import argparse import os import json from models.StyleSpeech import StyleSpeech fr...
[ "torch.distributed.init_process_group", "torch.no_grad", "torch.multiprocessing.spawn", "torch.nn.parallel.DistributedDataParallel", "torch.randperm", "torch.cuda.device_count", "torch.cuda.set_device" ]
1.8.1
ishine/StyleSpeech-1
f939cf9cb981db7b738fa9c9c9a7fea2dfdd0766
1.0
""" Checker functions """ import numpy as np import torch PI = 3.1415 DIM = 64.0 SCALE = 255.0 FIXED_CIRCLE = False class CentroidFunction(torch.nn.Module): def __init__(self, bs, ch, sx, sy): super(CentroidFunction, self).__init__() self.x_lin = torch.nn.Parameter(torch.linspace(0, sx, sx).expa...
[ "torch.mul", "torch.linspace", "torch.sum" ]
1.0.0
chomd90/invnet
0d359e57b66f2e738812b5d660563fb4b3ab8f4a
1.7
import torch from torch import nn import torch.nn.functional as F class ContentLoss(nn.Module): """ Content Loss for the neural style transfer algorithm. """ def __init__(self, target: torch.Tensor, device: torch.device) -> None: super(ContentLoss, self).__init__() batch_size, channe...
[ "torch.nn.functional.mse_loss", "torch.matmul" ]
1.7.0
visualCalculus/neural-style-transfer
96f98a642dc9bf7b1ae59729b3712ff467afa38d
1.0
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import re import importlib import torch from argparse import Namespace import numpy as np from PIL import Image import os import argparse import...
[ "torch.from_numpy", "torch.ByteTensor", "torch.cuda.is_available", "torch.load" ]
1.0.0
atmacvit/meronymnet
47e1a7caadc0f770439bb26a93b885f790f62804
1.0
import re import torch import torch.nn as nn import torch.nn.functional as F from models.networks.sync_batchnorm import SynchronizedBatchNorm2d import torch.nn.utils.spectral_norm as spectral_norm # Returns a function that creates a normalization function # that does not condition on semantic map def get_nonspade_norm...
[ "torch.nn.Sequential", "torch.nn.BatchNorm2d", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.nn.utils.spectral_norm", "torch.nn.InstanceNorm2d" ]
1.0.0
atmacvit/meronymnet
47e1a7caadc0f770439bb26a93b885f790f62804
1.0
#!/usr/bin/python # # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
[ "torch.zeros", "torch.cat", "torch.stack", "torch.FloatTensor", "torch.from_numpy", "torch.LongTensor", "torch.utils.data.DataLoader" ]
1.0.0
atmacvit/meronymnet
47e1a7caadc0f770439bb26a93b885f790f62804
1.0
import json, os, random, math from collections import defaultdict import torch from torch.utils.data import Dataset import torchvision.transforms as T import numpy as np import PIL from skimage.transform import resize as imresize import pycocotools.mask as mask_utils from random import shuffle from data.preprocess im...
[ "torch.cat", "torch.stack", "torch.FloatTensor", "torch.from_numpy", "torch.LongTensor" ]
1.0.0
atmacvit/meronymnet
47e1a7caadc0f770439bb26a93b885f790f62804
1.0
# coding=utf-8 # Copyright 2021 The UCLA NLP Authors and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
[ "torch.nn.Linear", "torch.zeros", "torch.nn.Dropout", "torch.nn.LayerNorm", "torch.cat", "torch.nn.LogSoftmax", "torch.nn.Softmax", "torch.gather", "torch.arange", "torch.nn.Tanh", "torch.nn.CrossEntropyLoss", "torch.ones", "torch.nn.KLDivLoss", "torch.matmul", "torch.nn.Embedding" ]
1.0
diiogofernands/transformers
f5cd27694a0c7d0036954c8350f774a5c1181a57
1.7
import torch from kge import Config, Dataset from kge.model.kge_model import RelationalScorer, KgeModel class ComplExScorer(RelationalScorer): r"""Implementation of the ComplEx KGE scorer. Reference: Théo Trouillon, Johannes Welbl, Sebastian Riedel, Éric Gaussier and Guillaume Bouchard: Complex Embedding...
[ "torch.cat" ]
1.7.1
alexgaskell10/encoded_kge
2959c058125515a3e0e0b811ffe8086d6699006c
1.7
import os from collections import OrderedDict import sys import torch import csv import yaml import socket import copy from kge.job import Trace from kge import Config ## EXPORTED METHODS ##################################################################### def add_dump_parsers(subparsers): # 'kge dump' can ha...
[ "torch.load" ]
1.7.1
alexgaskell10/encoded_kge
2959c058125515a3e0e0b811ffe8086d6699006c
1.3
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence, pack_sequence, PackedSequence from stanza.models.common.biaffine import BiaffineScorer from stanza.models.common.hlstm import HighwayLSTM from stanza.models.co...
[ "torch.nn.Linear", "torch.nn.utils.rnn.PackedSequence", "torch.nn.Dropout", "torch.cat", "torch.zeros", "torch.nn.ModuleList", "torch.from_numpy", "torch.randn", "torch.nn.utils.rnn.pack_padded_sequence", "torch.nn.CrossEntropyLoss" ]
1.3.0
danielhers/stanza
d747a7b781da203c286ec51e3842fecb8b0abb15
0.4
### execute this function to train and test the vae-model from vaemodel import Model import numpy as np import pickle import torch import os import argparse def str2bool(v): if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): return Fa...
[ "torch.save" ]
0.4.1
sanixa/CADA-VAE-pytorch
9383c3067ce84f351c72a285d6da5724dcd710a6
1.4
import torch import argparse import os import torch.nn as nn import torch.nn.functional as F import torchvision from auto_LiRPA import BoundedModule, BoundedTensor from auto_LiRPA.perturbations import * parser = argparse.ArgumentParser() args, unknown = parser.parse_known_args() class Flatten(nn.Module): def _...
[ "torch.nn.Linear", "torch.Size", "torch.cuda.manual_seed_all", "torch.nn.Sequential", "torch.manual_seed", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.allclose", "torch.randn", "torch.empty_like" ]
1.4
Qiming-Wu/auto_LiRPA
7e1fbf12d857ef8d411d80eef1bd73d9ae4ba3be
1.9
import settings import pandas as pd from loader.DWY_Neighbor import NeighborsLoader from loader.DBP15k import DBP15kLoader from script.preprocess.get_token import Token from settings import * import numpy as np import torch class NeighborToken(object): def __init__(self, dbpToken, loader): self.loader = lo...
[ "torch.zeros" ]
1.9.0
Yasuo-orphan/SelfKG
52f71c186ab4ad2db8de6cadf4e498d6e563ee96
1.6
import numpy as np import torch import torch.nn as nn from ..loss import * class Criterion(object): def __init__(self, device=0, target_opt=['1'], loss_opt=[['WeightedBCE']], loss_weight=[[1.]], regu_opt=[], regu_weight=[]): self.device = device self.target_opt = target_opt self.loss_opt =...
[ "torch.nn.L1Loss", "torch.from_numpy" ]
1.6.0
matinraayai/pytorch_connectomics
b11a2f7e71a8d1442fb05f7a6edfaaaa7b0d9205
1.8
import json import torch from nltk.tokenize import word_tokenize from graph4nlp.pytorch.data.dataset import Text2TextDataItem, Text2TextDataset from graph4nlp.pytorch.modules.utils.padding_utils import pad_2d_vals, pad_2d_vals_no_size class CNNDataset(Text2TextDataset): def __init__( self, root_d...
[ "torch.from_numpy" ]
1.8.0
cminusQAQ/graph4nlp
d980e897131f1b9d3766750c06316d94749904fa
1.8
import torch CORENLP_TIMEOUT_SIGNATURE = "CoreNLP request timed out. Your document may be too long." def convert_adj_to_graph(graph, adj, reverse_adj, mask_off_val): slides = (adj != mask_off_val).nonzero(as_tuple=False) batch_nodes_tensor = torch.Tensor([0] + graph._batch_num_nodes).to(slides.device) b...
[ "torch.Tensor" ]
1.8.0
cminusQAQ/graph4nlp
d980e897131f1b9d3766750c06316d94749904fa
1.8
import torch import torch.nn as nn from .....data.data import from_batch from ..base import PoolingBase class MaxPooling(PoolingBase): r"""Apply max pooling over the nodes in the graph. .. math:: r^{(i)} = \max_{k=1}^{N_i}\left( x^{(i)}_k \right) """ def __init__(self, dim=None, use_linear_...
[ "torch.nn.Linear", "torch.stack", "torch.max" ]
1.8.0
cminusQAQ/graph4nlp
d980e897131f1b9d3766750c06316d94749904fa
1.5
import numpy as np import torch import torch.nn as nn from torch.distributions import Normal from rl_sandbox.constants import OBS_RMS, CPU from rl_sandbox.model_architectures.actor_critics.actor_critic import ActorCritic from rl_sandbox.model_architectures.shared import Conv2DEncoder, Flatten, Fuse, Split from rl_san...
[ "torch.nn.Linear", "torch.device", "torch.nn.LayerNorm", "torch.nn.functional.softplus", "torch.distributions.Normal", "torch.nn.ReLU", "torch.empty" ]
1.5.1
chanb/rl_sandbox_public
e55f954a29880f83a5b0c3358badda4d900f1564
1.5
import argparse import numpy as np import torch import rl_sandbox.constants as c import rl_sandbox.transforms.general_transforms as gt from rl_sandbox.agents.random_agents import UniformContinuousAgent from rl_sandbox.buffers.wrappers.torch_buffer import TorchBuffer from rl_sandbox.envs.wrappers.action_repeat import ...
[ "torch.device" ]
1.5.1
chanb/rl_sandbox_public
e55f954a29880f83a5b0c3358badda4d900f1564
1.5
import numpy as np import torch import rl_sandbox.constants as c import rl_sandbox.transforms.general_transforms as gt from rl_sandbox.agents.random_agents import UniformContinuousAgent from rl_sandbox.buffers.wrappers.torch_buffer import TorchBuffer from rl_sandbox.envs.wrappers.absorbing_state import AbsorbingState...
[ "torch.device" ]
1.5.1
chanb/rl_sandbox_public
e55f954a29880f83a5b0c3358badda4d900f1564
1.3
import os import torch def accuracy(output, target, topk=(1,)): """Computes the precision@k for the specified values of k""" maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) # first position is score; second position is pred. pred = pred.t() # .t() is T of m...
[ "torch.save" ]
1.3.0
bryant1410/Emotion-FAN
8a4ea4f0eacced38e8f4c50ad37515e84c781ab8
1.2
import math from collections import Counter from pathlib import Path from typing import List, Dict, Any, Tuple import torch import tqdm from torch.optim import Adam from torch.optim.lr_scheduler import ReduceLROnPlateau from torch.utils.tensorboard import SummaryWriter from dp.model.model import Model from dp.model.u...
[ "torch.device", "torch.isnan", "torch.no_grad", "torch.cuda.is_available", "torch.optim.lr_scheduler.ReduceLROnPlateau", "torch.isinf" ]
1.2.0
ishine/DeepPhonemizer
b8f170764c7648fe2acb552b787099ab4f941e58
0.4
import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import torch cuda = True if torch.cuda.is_available() else False Tenso...
[ "torch.nn.Linear", "torch.cat", "torch.nn.Dropout", "torch.nn.Sigmoid", "torch.nn.Sequential", "torch.nn.LeakyReLU", "torch.ones", "torch.nn.ReLU", "torch.cuda.is_available", "torch.nn.BatchNorm1d", "torch.nn.BCELoss" ]
0.4.0
EmmaNguyen/feature_adversarial_with_topology_signatures
efa7db6d0fdf5b2505d67d4341dcdb2ab05a97a7
1.0
#!/usr/bin/env python3 -u # 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. """ Run inference for pre-processed data with a trained model. """ import logging import math import os import sys ...
[ "torch.no_grad", "torch.from_numpy", "torch.cuda.is_available", "torch.flatten" ]
1.0.0
siddhu001/slue-toolkit
b8a62ef941a812ce277cf6a4af08d6065af8bec6
1.7
"""This is reservoir sampling, each sample has storage-probability 'buffer samples M / seen samples' """ import torch import torch.nn as nn import torch.optim as optim import random class Net(nn.Module): def __init__(self, n_inputs, n_outputs, n_tasks, ...
[ "torch.cat", "torch.stack", "torch.nn.CrossEntropyLoss" ]
1.7.0
kreimanlab/AugMem
cb0e8d39eb0c469da46c7c550c19229927a2bec5
1.2
import os import gc import time import torch import random import argparse import numpy as np import pandas as pd from glob import glob from tqdm import tqdm from trains import * from config import * from utils.log import * from utils.metricsTop import * from utils.functions import * from models.AMIO import AMIO from ...
[ "torch.device", "torch.no_grad", "torch.cuda.is_available", "torch.load" ]
1.2.0
thuiar/cmcnn
a18f09fa63baf74bb083779fa0a8881d55226e1a
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.tensor", "torch.randn" ]
1.6
Benjamin-Etheredge/pytorch-lightning
fe572c5911abfa2cc0b806b1c2cfe977d483c7c1
1.10
import csv import pickle import os import logging from tqdm import tqdm, trange from torch.utils.data import TensorDataset import torch.nn.functional as F import numpy as np import torch from collections import OrderedDict from transformers.utils.dummy_tokenizers_objects import BertTokenizerFast logging.basicConfig(...
[ "torch.tensor", "torch.utils.data.TensorDataset" ]
1.10
johncolezhang/DeepKE
ea4552ec42cb003a835f00fc14fb454f9a9a7183
1.8
import torch import torch.nn as nn from torch.nn.utils.rnn import PackedSequence from src.utils.mapper import configmapper def hotfix_pack_padded_sequence( input, lengths, batch_first=False, enforce_sorted=False ): lengths = torch.as_tensor(lengths, dtype=torch.int64) lengths = lengths.cpu() if enfor...
[ "torch.nn.utils.rnn.PackedSequence", "torch.nn.Embedding", "torch.nn.Dropout", "torch.nn.Linear", "torch.nn.LSTM", "torch.cat", "torch.nn.CrossEntropyLoss", "torch._C._VariableFunctions._pack_padded_sequence", "torch.as_tensor", "torch.sort" ]
1.8.1
gchhablani/financial-sentiment-analysis
b18e9072f8edb9f09d0fef697892f2462d6d44e9
1.5
import tqdm import json import torch import random import argparse from orderedset import OrderedSet from collections import defaultdict from outcomes.src.common import init_model def main(): ap = argparse.ArgumentParser() ap.add_argument("--device", default="cpu", type=str, help="cpu or number for GPU devi...
[ "torch.device", "torch.tensor" ]
1.5.1
vered1986/reporting_bias_lms
f4e3a26f41db30939c899855b413bad1ebe14d21
1.4
import os, sys import imageio from opt import get_opts import torch from collections import defaultdict from torch.utils.data import DataLoader from datasets import dataset_dict # models from models.nerf import Embedding, NeRF from models.rendering import render_rays # optimizer, scheduler, visualization from utils...
[ "torch.cat", "torch.stack", "torch.utils.data.DataLoader", "torch.no_grad" ]
1.4.0
ktiwary2/nerf_pl
99d40cba3a2d9a11d6988cb1a74cf29035a1ab5e