version
stringclasses
21 values
code
stringlengths
225
174k
apis
list
full_version
stringlengths
1
6
repo_name
stringlengths
10
107
hexsha
stringlengths
40
40
1.1
import time import torch from hpc_rll.origin.rnn import get_lstm from hpc_rll.torch_utils.network.rnn import LSTM from testbase import mean_relative_error, times assert torch.cuda.is_available() use_cuda = True seq_len = 64 batch_size = 3 input_size = 1792 hidden_size = 384 num_layers = 3 norm_type = 'LN' dropout = 0...
[ "torch.rand", "torch.cat", "torch.cuda.synchronize", "torch.cuda.is_available", "torch.flatten", "torch.randn" ]
1.1.0
sailxjx/DI-engine
c6763f8e2ba885a2a02f611195a1b5f8b50bff00
1.1
from typing import Optional, Dict, Union import copy import torch import torch.nn as nn from ding.utils import SequenceType, MODEL_REGISTRY from .vac import VAC @MODEL_REGISTRY.register('ppg') class PPG(nn.Module): mode = ['compute_actor', 'compute_critic', 'compute_actor_critic'] def __init__( s...
[ "torch.nn.ReLU" ]
1.1.0
sailxjx/DI-engine
c6763f8e2ba885a2a02f611195a1b5f8b50bff00
1.1
import os import torch import numpy as np import nn.vnn as vnn import collections from torch import nn from torch.nn import functional as F from torch.nn.utils.rnn import pad_sequence, pack_padded_sequence, pad_packed_sequence from model.seq2seq import Module as Base from models.utils.metric import compute_f1, compute_...
[ "torch.device", "torch.nn.Dropout", "torch.nn.functional.sigmoid", "torch.nn.LSTM", "torch.nn.MSELoss", "torch.cat", "torch.stack", "torch.nn.utils.rnn.pad_sequence", "torch.nn.functional.cross_entropy", "torch.nn.utils.rnn.pad_packed_sequence", "torch.tensor", "torch.nn.BCEWithLogitsLoss", ...
1.1.0
shivgarg/alfred_transformers
3eab07d3a218eb9b809dec8b7120b92ebd00c890
1.0
# -*- coding: utf-8 -*- # file: text_classifier.py # author: yangheng <yangheng@m.scnu.edu.cn> # Copyright (C) 2020. All Rights Reserved. import json import os import pickle import random import numpy import torch from findfile import find_file from termcolor import colored from torch.utils.data import DataLoader from...
[ "torch.cuda.manual_seed", "torch.no_grad", "torch.softmax", "torch.manual_seed", "torch.tensor", "torch.utils.data.DataLoader", "torch.load" ]
1.0
yangheng95/PyABSA
f5b46047a58fa8054a0469486be3f1cada933814
1.4
from typing import Any, Dict, List, Optional, Type import gym import torch as th from torch import nn from stable_baselines3.common.policies import BasePolicy, register_policy from stable_baselines3.common.torch_layers import BaseFeaturesExtractor, FlattenExtractor, NatureCNN, create_mlp from stable_baselines3.common...
[ "torch.nn.Sequential" ]
1.4.0
LucasAlegre/stable-baselines3
6b598323ae070bb0a998d25230f6e11eca4cbe61
1.4
import io import os import pathlib import warnings from collections import OrderedDict from copy import deepcopy import gym import numpy as np import pytest import torch as th from stable_baselines3 import A2C, DDPG, DQN, PPO, SAC, TD3 from stable_baselines3.common.base_class import BaseAlgorithm from stable_baseline...
[ "torch.allclose", "torch.rand_like" ]
1.4.0
LucasAlegre/stable-baselines3
6b598323ae070bb0a998d25230f6e11eca4cbe61
1.5
import torch import torch.distributions as td class GMM2D(td.MixtureSameFamily): def __init__(self, mixture_distribution, component_distribution): super(GMM2D, self).__init__(mixture_distribution, component_distribution) def mode_mode(self): mode_k = torch.argmax(self.mixture_distribution.pro...
[ "torch.distributions.MultivariateNormal", "torch.argmax", "torch.distributions.MixtureSameFamily" ]
1.5.0
StanfordASL/MATS
b31a86eb56728fc6025c71c7202ab425b078e3e5
1.0
""" Adapted from the pytorch-lamb library at https://github.com/cybertronai/pytorch-lamb """ import torch from torch.optim import Optimizer from colossalai.registry import OPTIMIZERS @OPTIMIZERS.register_module class Lamb(Optimizer): r"""Implements Lamb algorithm. It has been proposed in `Large Batch Optimi...
[ "torch.zeros_like" ]
1.0
xdjiangkai/ColossalAI
4a3d3446b04065fa1c89b78cba673e96115c6325
1.1
import os import numpy as np import torch from tensorboardX import SummaryWriter import distributed from models.reporter_ext import ReportMgr, Statistics from others.logging import logger from others.utils import test_rouge, rouge_results_to_str def _tally_parameters(model): n_params = sum([p.nelement() for p i...
[ "torch.no_grad", "torch.save", "torch.nn.BCELoss" ]
1.1.0
Katarina11/PreSumm
616e72f038d512e9e9112af375d66a0b2e3db6cd
0.4
""" Common routines for models in PyTorch. """ __all__ = ['HSwish', 'get_activation_layer', 'conv1x1', 'conv3x3', 'depthwise_conv3x3', 'ConvBlock', 'conv1x1_block', 'conv3x3_block', 'conv7x7_block', 'dwconv3x3_block', 'dwconv5x5_block', 'PreConvBlock', 'pre_conv1x1_block', 'pre_conv3x3_block'...
[ "torch.sigmoid", "torch.cat", "torch.nn.functional.relu6", "torch.nn.Sigmoid", "torch.nn.BatchNorm2d", "torch.split", "torch.transpose", "torch.nn.ReLU", "torch.nn.ReLU6", "torch.nn.Conv2d", "torch.nn.InstanceNorm2d", "torch.nn.AdaptiveAvgPool2d" ]
0.4.0
HyperGAN/imgclsmob
88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3
1.6
###################################### #######ORIGINAL IMPLEMENTATION######## ###################################### # FROM https://github.com/kunhe/FastAP-metric-learning/blob/master/pytorch/FastAP_loss.py # This code is copied directly from the official implementation # so that we can make sure our implementation ret...
[ "torch.isnan", "torch.ones", "torch.eye", "torch.sum", "torch.autograd.Variable", "torch.abs", "torch.randint", "torch.tensor", "torch.zeros", "torch.linspace", "torch.mm", "torch.randn", "torch.isclose", "torch.isinf", "torch.cumsum", "torch.pow", "torch.nn.functional.normalize", ...
1.6.0
cwkeam/pytorch-metric-learning
63e4ecb781c5735ad714f61a3eecc55f72496905
1.6
import unittest import numpy as np import torch from pytorch_metric_learning.distances import CosineSimilarity, LpDistance from pytorch_metric_learning.miners import BatchHardMiner from .. import TEST_DEVICE, TEST_DTYPES, WITH_COLLECT_STATS from ..zzz_testing_utils.testing_utils import angle_to_coord class TestBat...
[ "torch.arange", "torch.cuda.empty_cache", "torch.LongTensor", "torch.equal", "torch.randn", "torch.sum" ]
1.6.0
cwkeam/pytorch-metric-learning
63e4ecb781c5735ad714f61a3eecc55f72496905
1.6
import math import numpy as np import scipy.special import torch from ..distances import CosineSimilarity from ..utils import common_functions as c_f from ..utils import loss_and_miner_utils as lmu from .base_metric_loss_function import BaseMetricLossFunction from .mixins import WeightRegularizerMixin class LargeMa...
[ "torch.zeros", "torch.arange", "torch.no_grad", "torch.clamp", "torch.tensor", "torch.mean", "torch.Tensor", "torch.nn.CrossEntropyLoss", "torch.sum" ]
1.6.0
cwkeam/pytorch-metric-learning
63e4ecb781c5735ad714f61a3eecc55f72496905
1.6
import unittest import torch from pytorch_metric_learning.miners import EmbeddingsAlreadyPackagedAsTriplets from pytorch_metric_learning.samplers import FixedSetOfTriplets from pytorch_metric_learning.utils import common_functions as c_f class TestFixedSetOfTriplet(unittest.TestCase): def test_fixed_set_of_trip...
[ "torch.randint", "torch.all", "torch.randn", "torch.utils.data.DataLoader" ]
1.6.0
cwkeam/pytorch-metric-learning
63e4ecb781c5735ad714f61a3eecc55f72496905
1.8
import torch import torch.nn as nn class ImprovedSNL(nn.Module): def __init__(self, in_channels, transfer_channels, stage_num=2): super(ImprovedSNL, self).__init__() self.in_channels = in_channels self.transfer_channels = transfer_channels self.stage_num = stage_num ...
[ "torch.sqrt", "torch.relu", "torch.nn.init.constant_", "torch.nn.BatchNorm2d", "torch.nn.init.kaiming_normal_", "torch.bmm", "torch.nn.Conv2d", "torch.nn.init.normal_", "torch.sum" ]
1.8.1
ustbjdl1021/improved_snl_unet
7f7bf092153e1a535337b80bd1b673eff3ddec52
1.0
from typing import Dict, List import torch import torch.nn.functional as F def compute_loss(states: torch.Tensor, actions: torch.Tensor, next_states: torch.Tensor, log_probs_old: torch.Tensor, ext_returns: torch.Tensor, ext_advant...
[ "torch.nn.functional.mse_loss", "torch.exp", "torch.min", "torch.clamp" ]
1.0.1
KnwSondess/Regym
825c7dacf955a3e2f6c658c0ecb879a0ca036c1a
1.0
import regym from regym.rl_algorithms.agents import build_PPO_Agent from regym.rl_loops.singleagent_loops import rl_loop from regym.environments import parse_environment from test_fixtures import ppo_rnd_config_dict_ma from tqdm import tqdm from tensorboardX import SummaryWriter import os import math import copy impo...
[ "torch.multiprocessing.set_start_method", "torch.load" ]
1.0.1
KnwSondess/Regym
825c7dacf955a3e2f6c658c0ecb879a0ca036c1a
1.8
import warnings import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule from ..registry import NECKS @NECKS.register_module class FPN(nn.Module): def __init__(self, in_channels, out_channels, num_outs, ...
[ "torch.nn.functional.relu", "torch.nn.functional.interpolate", "torch.nn.functional.max_pool2d", "torch.nn.ModuleList" ]
1.8.0
Turoad/CLRNet
51e082db12973943bddefd76fd0d431fcb3350ff
1.6
# Copyright (c) Facebook, Inc. and its affiliates. import importlib import logging import os import pickle import re from collections import OrderedDict from copy import deepcopy from dataclasses import asdict, dataclass from enum import Enum from typing import Any import torch import torchvision from mmf.common.regis...
[ "torch.nn.Linear", "torch.nn.Identity", "torch.cat", "torch.prod", "torch.flatten", "torch.nn.Sequential", "torch.from_numpy", "torch.nn.Conv2d", "torch.hub.load_state_dict_from_url", "torch.load", "torch.nn.functional.relu", "torch.nn.Embedding", "torch.hub.load" ]
1.6.0
facebookresearch/pythia
079740bee4b357a7b1b866d35e2f1fad6edba8a4
0.4
import logging import os import math from tqdm import tqdm import numpy as np import torch from torch.utils.data import Dataset logger = logging.getLogger(__name__) def isfloat(value): try: float(value) return True except ValueError: return False def seq_collate(data): (obs_se...
[ "torch.cat", "torch.from_numpy", "torch.LongTensor" ]
0.4.1
szhaofelicia/sgan
ead42d4bb3b1278c4c9ffcae8fa9c2dc036a52ff
1.0
#!/usr/bin/env python3 import torch import unittest from gpytorch.lazy import NonLazyTensor, DiagLazyTensor, AddedDiagLazyTensor from test.lazy._lazy_tensor_test_case import LazyTensorTestCase class TestAddedDiagLazyTensor(LazyTensorTestCase, unittest.TestCase): seed = 0 should_test_sample = True def cr...
[ "torch.tensor", "torch.randn" ]
1.0.0
cdgreenidge/gpytorch
d4cc610963bd812052e43e3aed84fb8b2ec94aa6
1.1
import os import torch import torch.nn as nn from collections import deque from onmt.utils.logging import logger from copy import deepcopy def build_model_saver(model_opt, opt, model, fields, optim): model_saver = ModelSaver(opt.save_model, model, model_...
[ "torch.save" ]
1.1
UKPLab/emnlp2019-dualgraph
0c58fb7f3ad3b9da3b92b2d2841558807fc79fd0
3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Dict import torch from detectron2.layers import ShapeSpec, cat from detectron2.modeling import ROI_HEADS_REGISTRY from detectron2.modeling.poolers import ROIPooler from detectron2.modeling.roi_heads.fast_rcnn import FastRCNNOutput...
[ "torch.no_grad" ]
3
hsk9767/mesh_rcnn_copy
6dd4d9ea8af33c03a084e34c7d16eeaddfe924ae
1.3
import torch from torch import nn from torch.distributions import Categorical class SoftmaxCategoricalHead(nn.Module): def forward(self, logits): return torch.distributions.Categorical(logits=logits) # class MultiSoftmaxCategoricalHead(nn.Module): # def forward(self, logits): # return Indepe...
[ "torch.unbind", "torch.distributions.Categorical", "torch.argmax" ]
1.3.0
tkelestemur/pfrl
388855fb30313185d43ae0d0f4b694be647a5c43
1.6
import argparse import os import pandas as pd import numpy as np import torch as t from torch.optim import Adam import pickle5 as pickle import json import random from sample import sample_with_input, sample_with_beam from utils.batch_loader import BatchLoader, clean_str from model.paraphraser import Par...
[ "torch.device" ]
1.6.0
nlindqv/pytorch_RVAE
d9e58134965f69aad557fb3bd2478500a51210f8
1.4
import sys import os import torch import torch.onnx import torch.distributed as dist import torch.nn as nn import onnxruntime from datetime import datetime from torch.utils.data import DataLoader import torch.multiprocessing as mp from pepper_variant.modules.python.models.dataloader_predict import SequenceDataset from...
[ "torch.zeros", "torch.nn.Softmax", "torch.distributed.destroy_process_group", "torch.distributed.init_process_group", "torch.no_grad", "torch.multiprocessing.spawn", "torch.add", "torch.from_numpy", "torch.utils.data.DataLoader", "torch.onnx.export", "torch.nn.ZeroPad2d", "torch.set_num_thread...
1.4.0
Samteymoori/pepper
734d226de47a855952e3b58145c1fcfbe221d3b4
1.7
""" Evaluate """ import re import math import datetime import random import torch from torch.nn import functional as F from torch.utils.data import DataLoader import matplotlib.pyplot as plt from loss import iou_loss, HairMattingLoss, acc_loss, F1_loss from utils import create_multi_figure USE_CUDA = torch.cuda.is_a...
[ "torch.device", "torch.cuda.is_available", "torch.utils.data.DataLoader" ]
1.7.1
eric91sanchez/hair_seg
4f688daac0ec4ea906ff0462ae51634293e35447
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.zeros", "torch.device", "torch.load", "torch.ones" ]
1.6
lsqshr/pytorch-lightning
c6b68883879e38719688865aceac746477f0a9b9
1.2
import torch from torch.utils.data import DataLoader from torch import nn from pytorch_transformers import AdamW, WEIGHTS_NAME, WarmupLinearSchedule import csv import numpy as np import os import logging from fp16 import FP16_Module, FP16_Optimizer from parallel import DataParallelModel, DataParallelCriterion from coll...
[ "torch.no_grad", "torch.nn.CrossEntropyLoss", "torch.load", "torch.ones" ]
1.2.0
jojotenya/LAMOL
03c31d9f0c7bf71295bc2d362ddf40a7656956e1
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.cuda.empty_cache" ]
1.4
MasaYan24/pytorch-lightning
046ac714f6955ed14b831657ea1b7b16bc28ac93
0.4
""" Assorted utilities for working with neural networks in AllenNLP. """ # pylint: disable=too-many-lines from collections import defaultdict from typing import Any, Dict, List, Optional, Sequence, Tuple, TypeVar import logging import math import warnings import torch from allennlp.common.checks import ConfigurationE...
[ "torch.zeros", "torch.cos", "torch.cat", "torch.stack", "torch.arange", "torch.max", "torch.gather", "torch.sin", "torch.cuda.LongTensor", "torch.nn.functional.log_softmax", "torch.nn.functional.softmax", "torch.zeros_like", "torch.matmul", "torch.exp", "torch.sum" ]
0.4.1
threefoldo/allennlp
9fcc79566cc148cce9f967a7962ac03bc300f011
1.5
# -*- coding: utf-8 -*- # @Author: Wenwen Yu # @Created Time: 7/12/2020 9:50 PM import os import numpy as np from numpy import inf import torch import torch.distributed as dist from torch.nn.parallel import DistributedDataParallel as DDP from src.utils import inf_loop from src.utils.metrics import MetricTracker, Spa...
[ "torch.distributed.get_world_size", "torch.device", "torch.nn.SyncBatchNorm.convert_sync_batchnorm", "torch.no_grad", "torch.save", "torch.nn.parallel.DistributedDataParallel", "torch.cuda.device_count", "torch.cuda.set_device", "torch.cuda.is_available", "torch.distributed.all_reduce", "torch.l...
1.5.1
minhhoangbui/PICK-pytorch
c74d2d1e5d1f8c7e837ea9776146bc84a7ecf30a
1.1
#!/usr/bin/env python3 import argparse import logging from pathlib import Path import sys from typing import List from typing import Optional from typing import Sequence from typing import Tuple from typing import Union import humanfriendly import numpy as np import torch from tqdm import trange from typeguard import ...
[ "torch.get_default_dtype", "torch.cat", "torch.stack", "torch.unbind", "torch.no_grad", "torch.as_tensor" ]
1.1.0
arceushui/Keyword-Spotting-Alibaba
10e718491075dee8f875c7860385bc4eef22a790
1.4
import time, os, json, time import numpy as np import torch from torch._C import device import torch.distributed as dist from torch.autograd import Variable def test_model(model, test_data, dev): correct, total = 0, 0 model.eval() with torch.no_grad(): for data, target in test_data: d...
[ "torch.isnan", "torch.distributed.init_process_group", "torch.no_grad", "torch.autograd.Variable", "torch.zeros_like", "torch.distributed.gather", "torch.tensor", "torch.distributed.scatter", "torch.sum" ]
1.4.0
HarliWu/From-Deterioration-to-Acceleration-A-Calibration-Approach-to-Rehabilitating-Step-Asynchronism-in-Fe
3a2f7196a2ca0446ce7ff7c8d15a0fa56a1d91d4
1.0
import torch from torch.utils.data import Dataset, ConcatDataset, Sampler import torch.distributed as dist import math import os import sys import shelve from glob import glob import numpy as np import uuid from termcolor import colored from collections import Counter, OrderedDict import random from .. import util fro...
[ "torch.distributed.is_available", "torch.distributed.get_world_size", "torch.is_tensor", "torch.distributed.get_rank", "torch.sort" ]
1.0.0
bayesianbrad/pyprob
a426fc51c1d6da13052979c21af447f9c4023642
1.7
import pandas as pd from pymethylprocess.MethylationDataTypes import MethylationArray from sklearn.metrics import mean_absolute_error, r2_score import warnings warnings.filterwarnings("ignore") from pybedtools import BedTool import numpy as np from functools import reduce from torch.utils.data import Dataset, DataLoade...
[ "torch.manual_seed", "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.load" ]
1.7.0
Christensen-Lab-Dartmouth/MethylCapsNet
17b6b19809c5e1984de804eb34cc7494210f91a6
1.3
import os from unittest.mock import MagicMock, call import pytest import torch from ignite.contrib.handlers.polyaxon_logger import * from ignite.engine import Engine, Events, State os.environ["POLYAXON_NO_OP"] = "1" def test_output_handler_with_wrong_logger_type(): wrapper = OutputHandler("tag", output_transf...
[ "torch.Tensor", "torch.tensor" ]
1.3
nzare/ignite
b53c6aeef87754b3cd3638c91172b386dc73af12
1.3
from pathlib import Path from datetime import datetime import fire import torch import torch.nn as nn import torch.optim as optim import ignite import ignite.distributed as idist from ignite.engine import Events, Engine, create_supervised_evaluator from ignite.metrics import Accuracy, Loss from ignite.handlers impor...
[ "torch.cuda.get_device_name", "torch.nn.CrossEntropyLoss" ]
1.3
nzare/ignite
002b595daa8a8345286c5e096c33e278948686a7
1.3
import os import pytest import torch import ignite.distributed as idist from ignite.engine import Engine, Events from ignite.handlers import EarlyStopping def do_nothing_update_fn(engine, batch): pass def test_args_validation(): trainer = Engine(do_nothing_update_fn) with pytest.raises(ValueError, m...
[ "torch.distributed.get_world_size", "torch.cuda.device_count", "torch.manual_seed", "torch.ones", "torch.randint", "torch.tensor", "torch.distributed.all_reduce", "torch.distributed.get_rank" ]
1.3
nzare/ignite
b53c6aeef87754b3cd3638c91172b386dc73af12
1.6
from __future__ import absolute_import import sys import numpy as np import torch from torch import nn import os from collections import OrderedDict from torch.autograd import Variable import itertools from .base_model import BaseModel from scipy.ndimage import zoom import fractions import functools import skimage.tr...
[ "torch.autograd.Variable", "torch.optim.Adam", "torch.clamp", "torch.load", "torch.mean", "torch.nn.DataParallel" ]
1.6.0
markveillette/high-fidelity-generative-compression
d88b4d7f1212efa8611e91737ff6bf00bbf36670
1.6
import abc import torch import torch.nn as nn import torch.nn.functional as F import numpy as np # Custom from src.helpers import maths MIN_SCALE = 0.11 MIN_LIKELIHOOD = 1e-9 MAX_LIKELIHOOD = 1e4 TAIL_MASS = 2**(-9) PRECISION_P = 16 # Precision of rANS coder # TODO: Unit tests lower_bound_toward = maths.LowerBou...
[ "torch.floor" ]
1.6.0
markveillette/high-fidelity-generative-compression
d88b4d7f1212efa8611e91737ff6bf00bbf36670
1.0
import torch import torch.nn as nn class LayerNorm(nn.Module): """ Layer Normalization. https://arxiv.org/abs/1607.06450 """ def __init__(self, hidden_size, eps=1e-6): super(LayerNorm, self).__init__() self.eps = eps self.gamma = nn.Parameter(torch.ones(hidden_size)) ...
[ "torch.zeros", "torch.rsqrt", "torch.ones" ]
1.0
krevas/ET-BERT
464ce3e7942d4450f55021e267ceb9dd48a36b1f
1.5
#! /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. r""" Multi-objective optimization benchmark problems. References .. [Deb2005dtlz] K. Deb, L. Thiele, M. Laumanns...
[ "torch.Size", "torch.cos", "torch.cat", "torch.stack", "torch.min", "torch.sin", "torch.arange", "torch.split", "torch.linspace", "torch.tensor", "torch.eye", "torch.exp" ]
1.5
NTR0314/botorch
f0310c9a415947f3264dac7f3438744784843323
1.2
import torch import torch.nn as nn from torchvision.transforms import ToTensor, ToPILImage class Generator(nn.Module): def __init__(self): super().__init__() self.conv_block = nn.Sequential( nn.ConvTranspose2d(100, 512, 4, 1, 0), ...
[ "torch.nn.Tanh", "torch.nn.BatchNorm2d", "torch.nn.ConvTranspose2d", "torch.nn.ReLU", "torch.randn" ]
1.2.0
y3sar/painter_gan
374fb91927ca584b4ef3fd8ba10922c7b5201780
1.1
#!/usr/bin/env python3 import torch import unittest from gpytorch.kernels import RBFKernelGrad from gpytorch.test.base_kernel_test_case import BaseKernelTestCase class TestRBFKernelGrad(unittest.TestCase, BaseKernelTestCase): def create_kernel_no_ard(self, **kwargs): return RBFKernelGrad(**kwargs) d...
[ "torch.zeros", "torch.Size", "torch.norm", "torch.cuda.is_available", "torch.tensor" ]
1.1
techshot25/gpytorch
092d523027a844939ba85d7ea8c8c7b7511843d5
1.1
#!/usr/bin/env python3 import warnings import torch def psd_safe_cholesky(A, upper=False, out=None, jitter=None): """Compute the Cholesky decomposition of A. If A is only p.s.d, add a small jitter to the diagonal. Args: :attr:`A` (Tensor): The tensor to compute the Cholesky decomposition ...
[ "torch.cholesky", "torch.isnan" ]
1.1
techshot25/gpytorch
b4aee6f81a3428172d4914e7e0fef0e71cd1f519
1.1
#!/usr/bin/env python3 import torch import unittest from gpytorch.kernels import PolynomialKernel from gpytorch.test.base_kernel_test_case import BaseKernelTestCase class TestPolynomialKernel(unittest.TestCase, BaseKernelTestCase): def create_kernel_no_ard(self, **kwargs): return PolynomialKernel(power=2...
[ "torch.zeros", "torch.rand", "torch.Size", "torch.norm", "torch.tensor" ]
1.1
techshot25/gpytorch
092d523027a844939ba85d7ea8c8c7b7511843d5
1.1
#!/usr/bin/env python3 import torch import warnings from .kernel import Kernel from ..lazy import MatmulLazyTensor, RootLazyTensor from ..constraints import Positive class LinearKernel(Kernel): r""" Computes a covariance matrix based on the Linear kernel between inputs :math:`\mathbf{x_1}` and :math:`\ma...
[ "torch.is_tensor", "torch.as_tensor", "torch.equal", "torch.zeros" ]
1.1
techshot25/gpytorch
092d523027a844939ba85d7ea8c8c7b7511843d5
0.4
# coding: utf-8 import torch from torch import nn import math import numpy as np from torch.nn import functional as F def position_encoding_init(n_position, d_pos_vec, position_rate=1.0, sinusoidal=True): ''' Init the sinusoid position encoding table ''' # keep dim 0 for padding t...
[ "torch.nn.Linear", "torch.cos", "torch.sigmoid", "torch.nn.functional.glu", "torch.nn.ConvTranspose1d", "torch.stack", "torch.sin", "torch.nn.functional.dropout", "torch.from_numpy", "torch.nn.functional.embedding", "torch.nn.utils.weight_norm", "torch.nn.Embedding" ]
0.4.0
tripzero/deepvoice3_pytorch
90027d27dab2889d856f9db9ffaf39d4f70b3067
0.4
import os import json import argparse import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from collections import OrderedDict from sg2im.utils import timeit, bool_flag, LossManager from sg2im.utils import int_tuple, float_tuple, str_tuple from sg2im.data.vg import...
[ "torch.nn.functional.binary_cross_entropy_with_logits", "torch.nn.functional.gumbel_softmax", "torch.zeros", "torch.ones", "torch.utils.data.DataLoader", "torch.matmul", "torch.randn" ]
0.4.0
louis2889184/sg2im
6df2095bf58703c7d6d74bf47535a7cf45690bc0
1.5
import copy from dataclasses import dataclass from typing import List, Optional import torch from torch.nn import CrossEntropyLoss, Module from torch.utils.data import DataLoader def federated_averaging(models: List[Module]) -> Module: global_model = copy.deepcopy(models[0]) global_weights = global_model.sta...
[ "torch.div", "torch.nn.CrossEntropyLoss" ]
1.5.0
dawidkski/federated-faceid
95b1f4b7da0e8baf1cac35edf3b49528c650c491
0.4
""" This file is for models creation, which consults options and creates each encoder and decoder accordingly. """ import re import torch import torch.nn as nn from torch.nn.init import xavier_uniform_ import onmt.inputters as inputters import onmt.modules from onmt.encoders.rnn_encoder import RNNEncoder from onmt.enc...
[ "torch.nn.LogSoftmax", "torch.device", "torch.nn.init.xavier_uniform_", "torch.load" ]
0.4.1
Nazukixv/OpenNMT-py
6265ddbbe9053b018714ac1fb4be9ec8adbaa128
1.4
import os import os.path as osp import numpy as np import torch import torch.nn as nn import torch.optim as optim import torchvision.transforms as T from torch.utils.data import DataLoader from tensorboardX import SummaryWriter from data.segmentation import SegmentDataset from model.segmentation.fcn import FCN32 from...
[ "torch.device", "torch.save", "torch.no_grad", "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.load", "torch.nn.CrossEntropyLoss" ]
1.4.0
johnnylord/trytry-segmentation
a88d75571ddba92bd10ac2d7303bee9426188b62
1.6
import argparse from random import choice from pathlib import Path # torch import torch from torch.optim import Adam from torch.nn.utils import clip_grad_norm_ # vision imports from PIL import Image from torchvision import transforms as T from torch.utils.data import DataLoader, Dataset from torchvision.datasets im...
[ "torch.save", "torch.utils.data.DataLoader" ]
1.6
Atica57/DALLE-pytorch
4fa108271aeb1972fcb118390ec15b656f2c328a
1.3
import time import random import numpy as np from pathlib import Path from PIL import Image, ImageDraw, ImageFont, ImageFilter import torch from torch.utils.data import Dataset from src import config def draw_grapheme(grapheme, font_path, size=(137, 236)): height, width = size image = Image.new('RGB', (widt...
[ "torch.no_grad", "torch.tensor" ]
1.3.1
lRomul/argus-bengali-ai
e64374230f5390a17305769126ff4bfc9a2a8644
1.4
import main from common import Task, STOP, GNN_TYPE from attrdict import AttrDict from experiment import Experiment import torch override_params = { 2: {'batch_size': 64, 'eval_every': 1000}, 3: {'batch_size': 64}, 4: {'batch_size': 1024}, 5: {'batch_size': 1024}, 6: {'batch_size': 1024}, 7: {'...
[ "torch.cuda.empty_cache" ]
1.4.0
urialon/bottleneck
481fbb95edc6ae711da40b6305b40c12ce6a6d29
1.0
# coding=utf-8 # Copyright 2021 The Fairseq 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.cat", "torch.stack", "torch.nn.ModuleList", "torch.nn.init.kaiming_normal_", "torch.bmm", "torch.ones", "torch.nn.CrossEntropyLoss", "torch.nn.functional.ctc_loss", "torch.nn.LayerNorm", "torch.nn.Conv1d", "torch.nn.init.constant_", "torch.FloatTensor", "torch.ten...
1.0
bugface/transformers
ba286fe7d51db12ad663effac83bed8199dd7141
1.0
# coding=utf-8 # Copyright Studio Ousia 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 required b...
[ "torch.nn.Linear", "torch.zeros", "torch.nn.Dropout", "torch.nn.LayerNorm", "torch.cat", "torch.arange", "torch.gather", "torch.nn.Tanh", "torch.nn.CrossEntropyLoss", "torch.ones", "torch.nn.functional.cross_entropy", "torch.nn.functional.softmax", "torch.zeros_like", "torch.matmul", "to...
1.0
bugface/transformers
ba286fe7d51db12ad663effac83bed8199dd7141
1.0
#!/usr/bin/env python3 # Copyright 2018 CMU 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 requir...
[ "torch.zeros", "torch.device", "torch.distributed.init_process_group", "torch.utils.data.SequentialSampler", "torch.nn.parallel.DistributedDataParallel", "torch.cuda.device_count", "torch.ones", "torch.cuda.set_device", "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.ones_like",...
1.0
bugface/transformers
ba286fe7d51db12ad663effac83bed8199dd7141
1.0
# coding=utf-8 # Copyright 2018 Google T5 Authors and 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 requ...
[ "torch.zeros", "torch.cat", "torch.isnan", "torch.ones", "torch.manual_seed", "torch.all", "torch.onnx.export", "torch.allclose" ]
1.0
bugface/transformers
ba286fe7d51db12ad663effac83bed8199dd7141
0.3
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Tuple import torch import torch.distributions as dist from beanmachine.ppl.inference.proposer.single_site...
[ "torch.distributions.Gamma", "torch.tensor", "torch.ones_like", "torch.where" ]
0.3
horizon-blue/beanmachine-1
b13e4e3e28ffb860947eb8046863b0cabb581222
0.3
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import beanmachine.ppl as bm from beanmachine.ppl.inference import BMGInference from torch import tensor from torch.distrib...
[ "torch.distributions.Normal", "torch.tensor", "torch.distributions.Beta" ]
0.3
horizon-blue/beanmachine-1
b13e4e3e28ffb860947eb8046863b0cabb581222
1.6
# coding=utf-8 # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
[ "torch.cuda.is_available" ]
1.6.0
wakafengfan/CPM-1-Finetune
b2c30bd94df31bcd6ee75ba90c347113563d4075
1.5
""" This file handles the details of the loss function during training. This includes: LossComputeBase and the standard NMTLossCompute, and sharded loss compute stuff. """ from __future__ import division from itertools import count import torch import torch.nn as nn import random as rnd import table d...
[ "torch.nn.NLLLoss", "torch.cuda.is_available", "torch.where" ]
1.5.0
GT-SALT/Disfluency-Generation-and-Detection
72126172b466aa74277f3cf0f73b915e5dbeefbb
1.0
import os import shutil import pickle import traceback import json import logging import math import time import psutil from time import sleep from copy import deepcopy from multiprocess import Process, Manager, cpu_count from multiprocess.queues import Queue from multiprocess.synchronize import Lock from typing import...
[ "torch.multiprocessing.set_start_method", "torch.multiprocessing.get_start_method", "torch.set_num_threads" ]
1.0
CogStack/CAT
5ac04d2676aede13f8e8d0ab408472c3c6d46a86
1.6
import os import re import shutil from subprocess import check_output, run, PIPE import numpy as np import torch import logging logger = logging.getLogger(__name__) def get_gpu_memory_map(): result = check_output( ["nvidia-smi", "--query-gpu=memory.used", "--format=csv,nounits,noheader"] ) return...
[ "torch.zeros", "torch.cuda.is_available" ]
1.6.0
akrouriad/rlberry
dde4e2cbafca05fdef1df07646bb6368059eeadf
1.1
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # Modifications copyright (C) 2020 Zi-Yi Dou # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compli...
[ "torch.cuda.manual_seed_all", "torch.nn.utils.rnn.pad_sequence", "torch.no_grad", "torch.utils.data.SequentialSampler", "torch.manual_seed", "torch.cuda.is_available", "torch.utils.data.DataLoader" ]
1.1.0
gitlost-murali/awesome-align
39fb45ca85a98e005447bddb52c48e65ce7d399b
1.8
import copy import os import pdb import random from typing import Dict, List, Text, TypeVar import torch import torch.nn as nn import torch.nn.functional as F from elvis.modeling.models import build_net from elvis.modeling.models.layers import FC, MLP from elvis.utils.vlp_objectives import optimal_transport_dist from...
[ "torch.nn.functional.cross_entropy", "torch.save", "torch.ones" ]
1.8.1
seo-95/elvis
a89c759acdf6ce64c7e6863aeb68dc0ba3293fed
1.4
import numpy as np import math import functools import torch import torch.nn as nn from torch.nn import init import torch.optim as optim import torch.nn.functional as F from torch.nn import Parameter as P import layers from sync_batchnorm import SynchronizedBatchNorm2d as SyncBatchNorm2d # Architectures for G # Att...
[ "torch.cat", "torch.nn.ModuleList", "torch.nn.AvgPool2d", "torch.split", "torch.std", "torch.nn.init.xavier_uniform_", "torch.nn.ReLU", "torch.mean", "torch.squeeze", "torch.nn.init.normal_", "torch.nn.init.orthogonal_", "torch.set_grad_enabled" ]
1.4
twice154/Spatial-Self-modulation-on-BigGAN
6ca691231bf7e8fd388a08b5ce6b4e30a50dd57b
1.7
from collections import OrderedDict import numpy as np import torch from torch import nn as nn import torch.nn.functional as F import torch.optim as optim import itertools import rlkit.torch.utils.pytorch_util as ptu from rlkit.core.trainer import Trainer from rlkit.core.eval_util import create_stats_ordered_dict c...
[ "torch.mean", "torch.min" ]
1.7.0
Ericonaldo/ILSwiss
efd25d457fd1578005c6fbc45cae29e9ab64a99d
1.0
import argparse import os import os.path as osp import shutil import tempfile import mmcv import torch import torch.distributed as dist from mmcv.runner import load_checkpoint, get_dist_info from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmdet.apis import init_dist from mmdet.core import res...
[ "torch.no_grad", "torch.distributed.barrier", "torch.full", "torch.distributed.broadcast" ]
1.0
lizhe960118/CenterNet
d1a0d13974e2316c6d127ca7860866cdd93bcfa7
1.0
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import math from ..registry import LOSSES # def gaussian_radius(det_size, min_overlap=0.7): # height, width = det_size # a1 = 1 # b1 = (height + width) # c1 = width * height * (1 - min_overlap) / (1 + min_overlap...
[ "torch.nn.functional.l1_loss", "torch.log", "torch.pow" ]
1.0
lizhe960118/CenterNet
d1a0d13974e2316c6d127ca7860866cdd93bcfa7
1.0
import torch import torch.nn as nn from mmcv.cnn import normal_init import numpy as np import cv2 import math #import torch.nn.functional as F from mmdet.core import multi_apply, multiclass_nms, distance2bbox, force_fp32 from ..builder import build_loss from ..registry import HEADS from ..utils import bias_init_with_p...
[ "torch.cat", "torch.nn.ModuleList", "torch.meshgrid", "torch.nn.init.constant_", "torch.nn.Conv2d", "torch.arange", "torch.nn.functional.max_pool2d" ]
1.0
lizhe960118/CenterNet
d1a0d13974e2316c6d127ca7860866cdd93bcfa7
1.0
import torch import torch.nn as nn from mmcv.cnn import normal_init from mmdet.core import multi_apply, multiclass_nms, distance2bbox, force_fp32 from ..builder import build_loss from ..registry import HEADS from ..utils import bias_init_with_prob, Scale, ConvModule INF = 1e8 @HEADS.register_module class FCOSHead(n...
[ "torch.cat", "torch.sqrt", "torch.stack", "torch.arange", "torch.nn.ModuleList", "torch.nn.Conv2d", "torch.meshgrid" ]
1.0
lizhe960118/CenterNet
d1a0d13974e2316c6d127ca7860866cdd93bcfa7
1.0
import torch import torch.nn as nn from ..registry import LOSSES def _neg_loss(pred, gt): ''' Modified focal loss. Exactly the same as CornerNet. Runs faster and costs a little bit more memory Arguments: pred (batch x c x h x w) => (batch, c, num_points) gt_regr (batch x c x h x w) ''' ...
[ "torch.log", "torch.pow" ]
1.0
lizhe960118/CenterNet
d1a0d13974e2316c6d127ca7860866cdd93bcfa7
1.0
import torch import torch.nn as nn from mmcv.cnn import normal_init import numpy as np import cv2 import math #import torch.nn.functional as F from mmdet.core import multi_apply, multiclass_nms, distance2bbox, force_fp32 from ..builder import build_loss from ..registry import HEADS from ..utils import bias_init_with_p...
[ "torch.cat", "torch.nn.ModuleList", "torch.meshgrid", "torch.nn.init.constant_", "torch.nn.Conv2d", "torch.arange", "torch.nn.functional.max_pool2d" ]
1.0
lizhe960118/CenterNet
d1a0d13974e2316c6d127ca7860866cdd93bcfa7
3
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from common_testing import TestCaseMixin, get_random_cuda_device from pytorch3d.ops...
[ "torch.zeros", "torch.rand", "torch.randperm", "torch.manual_seed", "torch.eye" ]
3
jkxing/pytorch3d
71dbebe8010a0dac3e56be464778aa48fbd3bcd3
3
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import functools import unittest import torch from common_testing import TestCaseMixin, get_random_cuda_device f...
[ "torch.device", "torch.cuda.synchronize", "torch.arange", "torch.ones", "torch.manual_seed", "torch.randint", "torch.randn_like", "torch.tensor", "torch.full", "torch.ones_like", "torch.eye", "torch.all", "torch.randn" ]
3
jkxing/pytorch3d
71dbebe8010a0dac3e56be464778aa48fbd3bcd3
1.9
''' CrossLink Network ''' import torch import torch.nn as nn import torch.nn.functional as F def swish(x): return x * x.sigmoid() def mish(x): return x * torch.tanh(F.softplus(x)) class CrossLinkBlock(nn.Module): '''Cross-Link Block''' def __init__(self, in_channels, out_channels, kernel_size, p...
[ "torch.nn.Linear", "torch.nn.functional.softplus", "torch.nn.MaxPool2d", "torch.nn.Sequential", "torch.nn.BatchNorm2d", "torch.nn.functional.dropout", "torch.nn.functional.adaptive_avg_pool2d", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.randn" ]
1.9.1
angseung/torch_cifar10
3160f749f3bffd941d6c0fb98ddaad63d4e5641d
1.6
import os import torch import numpy as np import unittest import timeit import functools from tinygrad.tensor import Tensor, DEFAULT_DEVICE, Device def helper_test_op(shps, torch_fxn, tinygrad_fxn, atol=1e-6, rtol=1e-3, grad_atol=1e-6, grad_rtol=1e-3, forward_only=False, vals=None, a=-0.5, b=20): torch.manual_seed(0...
[ "torch.reshape", "torch.nn.LogSoftmax", "torch.nn.functional.relu6", "torch.nn.functional.avg_pool2d", "torch.nn.functional.softplus", "torch.nn.functional.interpolate", "torch.sign", "torch.manual_seed", "torch.abs", "torch.tensor", "torch.nn.functional.hardswish", "torch.nn.functional.pad", ...
1.6.0
baheytharwat/tinygrad
acf652c3c524ee3214e9ce58d41113738cb833ae
1.0
#coding:utf-8 import torch from learner_util import get_ner_BIO class Metric(object): def __call__(self, predictions, gold_labels, mask=None): """ metric的抽象类 :params predictions 预测结果的tensor :params gold_labels 实际结果的tensor ...
[ "torch.ones_like" ]
1.0.0
waterzxj/UNF
5eda8e7c60116735f595f4b21b24547708b36cf5
1.0
#coding:utf-8 """ Embedding类的抽象 """ import os import sys import torch from torch import nn import torch.nn.functional as F from modules.module_util import init_tensor from modules.base_type import InitType, FAN_MODE, ActivationType class BaseEmbedding(nn.Module): """ Emebdding类的基类 :params dim int类型,embe...
[ "torch.nn.Dropout", "torch.empty", "torch.nn.Embedding" ]
1.0.0
waterzxj/UNF
5eda8e7c60116735f595f4b21b24547708b36cf5
1.0
#coding:utf-8 import os import json import torch from torch import nn import torch.nn.functional as F from models.model_util import Config from models.dpcnn import DpCnn from models.fasttext import FastText from models.leam import LEAM from models.self_attention import SelfAttention from models.textcnn import TextCn...
[ "torch.LongTensor" ]
1.0.0
waterzxj/UNF
5eda8e7c60116735f595f4b21b24547708b36cf5
1.3
from functools import partial from typing import List, Union, Callable import torch from pytorch_toolbelt.modules import ABN, ACT_RELU, ACT_SWISH from pytorch_toolbelt.modules import encoders as E from pytorch_toolbelt.modules.decoders import DecoderModule from pytorch_toolbelt.modules.encoders import EncoderMo...
[ "torch.nn.ReLU", "torch.cat", "torch.nn.Upsample", "torch.nn.Conv2d" ]
1.3
mayankj/xView2-Solution
804aa15a3d9f28c7c1d73e50ce0ed0c359a0493e
1.3
from __future__ import absolute_import import argparse import collections import gc import json import os from datetime import datetime import torch from catalyst.dl import SupervisedRunner, OptimizerCallback, SchedulerCallback from catalyst.dl.callbacks import CriterionAggregatorCallback, AccuracyCallback from catal...
[ "torch.cuda.empty_cache", "torch.utils.data.DataLoader" ]
1.3
mayankj/xView2-Solution
804aa15a3d9f28c7c1d73e50ce0ed0c359a0493e
1.10
import torch from torch import cat from torch.nn import Conv2d from torch.nn import Linear from torch.nn import Module from torch.nn import ConvTranspose2d from torch.nn import LeakyReLU from torch.nn import Tanh from torch.nn import MaxPool2d from torch import zeros_like class ConvMPN(Module): def __init__(self)...
[ "torch.nn.Linear", "torch.zeros", "torch.cat", "torch.max", "torch.nn.Tanh", "torch.nn.LeakyReLU", "torch.nn.ConvTranspose2d", "torch.nn.Conv2d", "torch.zeros_like", "torch.where" ]
1.10.0
athatheo/House-GANs-Reproduction
00cc807f1e74f88eef5ed81615bfd87a39c52f94
1.5
# ------------------------------------------------------------------------ # Copyright (c) 2021 megvii-model. All Rights Reserved. # ------------------------------------------------------------------------ # Modified from Deformable DETR (https://github.com/fundamentalvision/Deformable-DETR) # Copyright (c) 2020 SenseT...
[ "torch.nn.Linear", "torch.cat", "torch.nn.Dropout", "torch.nn.LayerNorm", "torch.arange", "torch.nn.init.constant_", "torch.ones", "torch.nn.MultiheadAttention", "torch.nn.ReLU", "torch.meshgrid", "torch.nn.init.uniform_", "torch.nn.Embedding" ]
1.5.0
Honghe/AnchorDETR
fc3d45441241cd689b28878d3aa4b0bffb33a8b8
1.3
import logging from pathlib import Path from typing import Any, Optional, Tuple, Union import gym import torch import pickle as pkl from rltoolkit import config, utils from rltoolkit.buffer import Memory from rltoolkit.stats_logger import StatsLogger from rltoolkit.tensorboard_logger import TensorboardWriter logger ...
[ "torch.zeros", "torch.device", "torch.ones", "torch.cuda.is_available", "torch.tensor" ]
1.3.1
raznem/sac_ppo
c18e9bd32a70fcc4bc413565c6b885d7560b8b5a
1.8
#Linear Module to use with ZeRO Stage 3 to allow for parameter memory release #after the module execution during forward #Instead of saving variables using save_for_backward, we save variable ids #Allowing us to retrieve the variable without creating pointer to it #Which allows for underlying tensor to be garbage colle...
[ "torch.nn.init._calculate_fan_in_and_fan_out", "torch.tensor", "torch.nn.init.uniform_", "torch.distributed.get_rank", "torch.Tensor" ]
1.8
manuelciosici/DeepSpeed
3da841853ca07abf3a09e7bd325a576c4e642c11
1.8
import copy import torch import deepspeed import deepspeed.ops.transformer as transformer_inference from .replace_policy import HFBertLayerPolicy, HFGPT2LayerPolicy, HFGPTJLayerPolicy from .replace_policy import replace_policies from ..constants import INFERENCE_GENERIC_MODE, INFERENCE_SPECIALIZED_MODE from ..runtime.w...
[ "torch.distributed.get_world_size", "torch.cat", "torch.split", "torch.nn.Parameter", "torch.cuda.current_device", "torch.distributed.all_reduce", "torch.distributed.get_rank", "torch.empty", "torch.matmul", "torch.nn.Embedding", "torch.chunk" ]
1.8
manuelciosici/DeepSpeed
3da841853ca07abf3a09e7bd325a576c4e642c11
1.1
from __future__ import absolute_import, division, print_function import torch from pyro.distributions.torch import RelaxedOneHotCategorical, RelaxedBernoulli from pyro.distributions.util import copy_docs_from from torch.distributions.utils import clamp_probs @copy_docs_from(RelaxedOneHotCategorical) class RelaxedOn...
[ "torch.Size", "torch.distributions.utils.clamp_probs", "torch.zeros_like" ]
1.1.0
ruohoruotsi/pyro
b54a4b42b9474eb3ecee11505e45fde85b1cdc54
1.1
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from . import box_utils from . import center_utils try: from itertools import ifilterfalse except ImportError: # py3k from itertools import filterfalse as ifilterfalse class SigmoidFo...
[ "torch.sigmoid", "torch.nonzero", "torch.nn.functional.smooth_l1_loss", "torch.isnan", "torch.nn.functional.l1_loss", "torch.norm", "torch.autograd.Variable", "torch.clamp", "torch.from_numpy", "torch.nn.functional.mse_loss", "torch.abs", "torch.nn.functional.cross_entropy", "torch.log", "...
1.1
jialeli1/From-Voxel-to-Point
b4dba9c4e9cd83e04199d9224f6ec7bf06b71f93
1.3
""" # -*- coding: utf-8 -*- ----------------------------------------------------------------------------------- # Author: Nguyen Mau Dung # DoC: 2020.08.17 # email: nguyenmaudung93.kstn@gmail.com ----------------------------------------------------------------------------------- # Description: The configurations of the...
[ "torch.device", "torch.cuda.device_count" ]
1.3.0
wangx1996/CenterPillarNet
4be3d53265b8ecb1f9572612fa87f7acd8c57669
1.3
""" # -*- coding: utf-8 -*- ----------------------------------------------------------------------------------- # Author: Nguyen Mau Dung # DoC: 2020.08.17 # email: nguyenmaudung93.kstn@gmail.com ----------------------------------------------------------------------------------- # Description: This script for training ...
[ "torch.load", "torch.tensor", "torch.no_grad" ]
1.3.0
wangx1996/CenterPillarNet
4be3d53265b8ecb1f9572612fa87f7acd8c57669
1.6
# Copyright 2020 LMNT, Inc. 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 ag...
[ "torch.device", "torch.no_grad", "torch.clamp", "torch.from_numpy", "torch.randn_like", "torch.tensor", "torch.load", "torch.randn" ]
1.6.0
egaebel/diffwave
c5d7d8d90b662f208ecdfba616782559146dc116
1.6
import unittest import os import shutil import random import pickle import numpy as np 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.utils.data import DataLoader import torch.multiprocessing as mp import torch.dis...
[ "torch.nn.Linear", "torch.cuda.manual_seed", "torch.manual_seed", "torch.utils.data.DataLoader", "torch.nn.functional.relu", "torch.device", "torch.cuda.manual_seed_all", "torch.nn.parallel.DistributedDataParallel", "torch.nn.functional.log_softmax", "torch.cuda.device_count", "torch.cuda.set_de...
1.6.0
mv1388/AIToolbox
1060435e6cbdfd19abcb726c4080b663536b7467
1.2
import torch import torch.nn as nn import torch.nn.functional as F from api.models.utils.distribution import sample_from_discretized_mix_logistic from api.models.utils.display import * from api.models.utils.dsp import * import os import numpy as np from pathlib import Path from typing import Union class ResBlock(nn.M...
[ "torch.nn.Linear", "torch.cat", "torch.stack", "torch.nn.GRU", "torch.nn.ModuleList", "torch.distributions.Categorical", "torch.load", "torch.nn.Conv1d", "torch.as_tensor", "torch.nn.functional.relu", "torch.zeros", "torch.nn.Conv2d", "torch.nn.functional.softmax", "torch.nn.GRUCell", "t...
1.2.0
elainevoice/backend
9b5fef59001fd6c2040affc80cd5cb9690c73795
1.8
import torch import numpy as np from tqdm import tqdm from sklearn import cluster #bol_norm True -> Divide by norm of feature def same_score(v_ortho_dict, features, labels, bol_norm=False): features = torch.from_numpy(features).cuda() scores = torch.zeros(features.shape[0]) for indx, feat in enumerate...
[ "torch.zeros", "torch.dot", "torch.eq", "torch.norm", "torch.nn.CrossEntropyLoss", "torch.from_numpy", "torch.sort", "torch.tensor", "torch.load", "torch.mean" ]
1.8.0
Kthyeon/FINE
ae8a24a4a2514feafd9a9ed394af87f397708ccf
1.8
# https://github.com/AlanChou/Truncated-Loss/blob/master/TruncatedLoss.py import torch import torch.nn as nn import torch.nn.functional as F import math import numpy as np __all__=['GCELoss', 'GCE_GTLoss'] class GCELoss(nn.Module): def __init__(self, q=0.7, k=0.5, trainset_size=50000, truncated=False): s...
[ "torch.gt", "torch.unsqueeze", "torch.ones", "torch.from_numpy", "torch.nn.functional.softmax", "torch.mean", "torch.nn.CrossEntropyLoss", "torch.sum" ]
1.8.0
Kthyeon/FINE
ae8a24a4a2514feafd9a9ed394af87f397708ccf
1.1
# ***************************************************************************** # 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.LSTMCell", "torch.stack", "torch.nn.ModuleList", "torch.max", "torch.nn.functional.dropout", "torch.nn.init.xavier_uniform_", "torch.nn.utils.rnn.pad_packed_sequence", "torch.nn.BatchNorm1d", "torch.nn.utils.rnn.pack_padded_sequence", "torch.nn.functiona...
1.1.0
HudsonHuang/tacotron2
fa55a0b633abe358e1258e1dc3b40d85e17b3450