version
stringclasses
25 values
code
stringlengths
75
178k
apis
list
full_version
stringlengths
1
6
repo_name
stringlengths
9
78
hexsha
stringlengths
40
40
0.4
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 ...
[ "torch.tensor" ]
0.4.1
z422684562/pytorch-pretrained-BERT
5cd0a3db927b3b9232187674aad98d04f505cece
1.5
import logging import re from itertools import zip_longest from typing import List, Generator, TypeVar, Union import torch from numpy import ndarray from transformers import BertTokenizer, AlbertTokenizer, BertModel, AlbertModel from bio_embeddings.embed.embedder_interfaces import EmbedderWithFallback # https://stac...
[ "torch.no_grad", "torch.tensor" ]
1.5.1
konstin/bio_embeddings
a7de49fd8e152f8e735283818e6f2e2de7b824c8
1.6
import unittest from .. import TEST_DTYPES, TEST_DEVICE import torch from pytorch_metric_learning.losses import MultiSimilarityLoss from pytorch_metric_learning.utils import common_functions as c_f class TestMultiSimilarityLoss(unittest.TestCase): def test_multi_similarity_loss(self): for dtype in TEST_DT...
[ "torch.log", "torch.isclose", "torch.matmul", "torch.LongTensor" ]
1.6.0
RaunakRahi/pytorch-metric-learning
1525e5b7bd840967b344b3da5667297295042361
1.8
from typing import List, Any import pytorch_lightning.core.lightning as pl import torch import torch.nn.functional as F import numpy as np from allennlp.modules import ConditionalRandomField from allennlp.modules.conditional_random_field import allowed_transitions from torch import nn from torch.utils.data import Da...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.optim.AdamW", "torch.nn.LSTM", "torch.cat", "torch.nn.functional.log_softmax", "torch.utils.data.DataLoader", "torch.nn.functional.softmax", "torch.nn.functional.leaky_relu" ]
1.8.0
Mckysse/AGAN
67dd049828681a1ea6acb6bf3e7247651109c17b
0.1
# Copyright 2019 The Forte Authors. 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 ...
[ "torch.nn.Linear", "torch.zeros", "torch.nn.Dropout", "torch.cat", "torch.arange", "torch.max", "torch.no_grad", "torch.softmax", "torch.ones", "torch.topk", "torch.clamp_min", "torch.sum" ]
0.1.4
bhaskar2443053/forte
95fabd94126d45c0db07cdcc197049ed1859d228
1.7
""" full training (train rnn-ext + abs + RL) """ import argparse import json import pickle as pkl import os from os.path import join, exists from itertools import cycle from toolz.sandbox.core import unzip from cytoolz import identity import torch from torch import optim from torch.optim.lr_scheduler import ReduceLRO...
[ "torch.cuda.is_available", "torch.optim.lr_scheduler.ReduceLROnPlateau" ]
1.7.0
aniket03/fast_abs_rl
8e97d2a24ea8c867c7a0ed181265db325ee0da1b
1.2
import torch.nn.functional as F import torch import os import shutil def save_checkpoint(state, save): if not os.path.exists(save): os.makedirs(save) filename = os.path.join(save, 'checkpoint.path.tar') torch.save(state, filename) class KeyValueMemory(object): """ kv is a ...
[ "torch.nn.functional.one_hot", "torch.stack", "torch.norm", "torch.save", "torch.squeeze", "torch.matmul", "torch.exp", "torch.sum" ]
1.2.0
RuiLin0212/BATMANN
5c5cc3334090fc0442bfd2ffdd41bdcab88cbea2
1.5
# # Author: penhe@microsoft.com # Date: 04/25/2019 # """ Winograd Schema Challenge model for common sense reasoning """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from concurrent.futures import ThreadPoolExecutor import csv import os import json impor...
[ "torch.nn.Linear", "torch.sigmoid", "torch.nn.Dropout", "torch.nn.LogSoftmax", "torch.zeros", "torch.isnan", "torch.max", "torch.gather", "torch.nn.functional.logsigmoid", "torch.matmul", "torch.tensor", "torch.isinf", "torch.ones_like", "torch.zeros_like", "torch.log", "torch.exp" ]
1.5.0
anlewy/mt-dnn
eeb6f01ce0630e61a52b8c9c6f7537cd34978e45
1.0
import torch import torchvision import torch.optim as optim from torch.optim import lr_scheduler import torch.nn as nn from torchsummary import summary # set device device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") # base densenet model model = torchvision.models.resnet18(pretrained=True) num_f...
[ "torch.nn.Linear", "torch.cuda.is_available", "torch.optim.lr_scheduler.StepLR", "torch.nn.CrossEntropyLoss" ]
1.0.0
oranges0da/food101
2a54f9d3da4de4d408183912947f25b016bd6d81
1.6
# # Simple MLP and CNN models # import torch import torch.nn as nn from torch.distributions import Categorical from gym import spaces # # Utility functions # from rlberry.agents.torch.utils.training import model_factory, activation_factory def default_twinq_net_fn(env): """ Returns a default Twinq network ...
[ "torch.nn.Linear", "torch.zeros", "torch.distributions.Categorical", "torch.nn.ModuleList", "torch.nn.Softmax", "torch.nn.init.constant_", "torch.nn.init.xavier_uniform_", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.transpose" ]
1.6.0
riccardodv/rlberry
8bb03772cda1e13c57de0e1da7bc7356a3014cfb
1.1
# -*- coding: utf-8 -*- import torch import random import inspect from itertools import islice, repeat import os def split_corpus(path, shard_size, default=None): """yield a `list` containing `shard_size` line of `path`, or repeatly generate `default` if `path` is None. """ if path is not None: ...
[ "torch.cuda.manual_seed", "torch.arange", "torch.clamp", "torch.manual_seed", "torch.matmul" ]
1.1.0
sakrnference/data-to-text-hierarchical
da88d2d4491266fccc39ac1cc1fbb56bd7bbc30c
1.2
#!/usr/bin/env python3 import typing from typing import Optional, Tuple, Union, Any, List, Callable, cast import warnings import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from torch.nn import Module from torch.utils.hooks import RemovableHandle import numpy as np from .._ut...
[ "torch.cat", "torch.no_grad", "torch.max" ]
1.2
kolvia/captum
4b6280296dbc740df09afdc592b74e27e0b7ce88
1.8
import json import os import librosa import numpy as np from torch.utils.data import Dataset from text import text_to_sequence from utils.tools import pad_1D class Dataset(Dataset): def __init__( self, filename, preprocess_config, train_config, sort=False, drop_last=False ): self.dataset_nam...
[ "torch.utils.data.Dataset", "torch.cuda.is_available", "torch.utils.data.DataLoader" ]
1.8.1
Seungwoo0326/WaveGrad2-1
3b202201348449b89353f28bce1596ca7939a810
0.4
#!/usr/bin/env python3 # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of the following repo: # https://github.com/facebookresearch/poincare-embeddings. # import torch as th from torch.optim.optimi...
[ "torch.sum" ]
0.4.1
prokolyvakis/hyperkg
db0b8eee78424dde31f8f691b0c6dd07c376ce73
1.7
import torch from torch.utils import data from torch.utils.data.dataset import Dataset import os from plyfile import PlyData import numpy as np from utils import split class SemanticKittiDataset(Dataset): def __init__(self, sequence, data_folder): super(SemanticKittiDataset, self).__init__() self...
[ "torch.utils.data.random_split", "torch.from_numpy", "torch.utils.data.DataLoader" ]
1.7.0
KASCedric/PointNet
51d494249cc5a308a94cd703f607e636f47ee9ac
1.5
import hashlib import inspect import logging import os import re from abc import abstractmethod from collections import Counter from pathlib import Path from typing import List, Union, Dict, Optional import gensim import numpy as np import torch from bpemb import BPEmb from torch import nn from transformers import Aut...
[ "torch.cat", "torch.nn.LSTM", "torch.stack", "torch.enable_grad", "torch.nn.utils.rnn.pack_padded_sequence", "torch.nn.LayerNorm", "torch.FloatTensor", "torch.tensor", "torch.zeros_like", "torch.zeros", "torch.device", "torch.min", "torch.max", "torch.unique", "torch.no_grad", "torch.n...
1.5.0
seyyaw/flair
46569a611c6acff739e3c04e78d64f824011e483
1.8
from __future__ import print_function import argparse import os import pickle from sys import stdout as sysout import torch import torchvision import src.archs as archs from src.utils.cluster.cluster_eval import cluster_subheads_eval from src.utils.cluster.data import _create_mapping_loader from src.utils.cluster.tr...
[ "torch.nn.DataParallel", "torch.load" ]
1.8.0
MihaiAnton/tudelft-iic-reproduction
342247c444aa1f8b09ea18e3ff9135258d599373
1.8
from __future__ import print_function from src.utils.segmentation.general import set_segmentation_input_channels from src.utils.segmentation.data import segmentation_create_dataloaders from src.utils.segmentation.IID_losses import IID_segmentation_loss, \ IID_segmentation_loss_uncollapsed from src.utils.segmentatio...
[ "torch.nn.DataParallel", "torch.zeros" ]
1.8.0
MihaiAnton/tudelft-iic-reproduction
342247c444aa1f8b09ea18e3ff9135258d599373
1.3
# # Adapted from https://github.com/marcotcr/lime/blob/master/doc/notebooks/Tutorial%20-%20images%20-%20Pytorch.ipynb # import copy import numpy as np import torch from lime import lime_image from lime.wrappers.scikit_image import SegmentationAlgorithm from interpretability.explanation_methods.utils import Expla...
[ "torch.no_grad", "torch.from_numpy" ]
1.3.1
moboehle/B-cos
5f9218f6773534c80367793d1cd767742869764a
1.0
#!/usr/bin/env python3 # encoding: utf-8 """ Copyright (c) 2021, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause """ # Copyright 2017 Johns Hopkins University (Shinji Watanabe) ...
[ "torch.distributed.get_world_size", "torch.device", "torch.is_tensor", "torch.save", "torch.no_grad", "torch.from_numpy", "torch.sum", "torch.cuda.set_device", "torch.cuda.is_available", "torch.tensor", "torch.load", "torch.distributed.get_rank", "torch.distributed.barrier", "torch.topk" ]
1.0.1
salesforce/TransformerASR
1de0c16573bc6f47c0b16d3f07af0f670db8f30f
1.0
"""Vanilla Policy Gradient (REINFORCE).""" import collections import copy from dowel import tabular import numpy as np import torch import torch.nn.functional as F from garage import log_performance, TrajectoryBatch from garage.misc import tensor_utils as tu from garage.np.algos.rl_algorithm import RLAlgorithm from g...
[ "torch.distributions.kl.kl_divergence", "torch.no_grad", "torch.nn.functional.softplus" ]
1.0.0
maciejwolczyk/garage-1
c78843115a51d63f86bca0f3518d8f68fb81bce3
1.4
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from audio_separation.rl.ppo.ddppo_utils import distributed_mean_and_var EPS_PPO = 1e-5 class PPO(nn.Module): def __init__( self, actor_critic, clip_param, ppo_epoch, num_mini_b...
[ "torch.min", "torch.nn.utils.clip_grad_norm_", "torch.nn.functional.l1_loss", "torch.max", "torch.no_grad", "torch.optim.Adam", "torch.nn.parallel.DistributedDataParallel", "torch.clamp", "torch.cuda.is_available", "torch.exp" ]
1.4.0
SAGNIKMJR/move2hear-active-AV-separation
3c6887aeb94b2a07983469bfd517ca277bd4124a
1.2
import numpy as np import torch import torch.backends.cudnn as cudnn import torch.optim as optim from torch.utils.data import DataLoader from tqdm import tqdm from nets.frcnn import FasterRCNN from trainer import FasterRCNNTrainer from utils.dataloader import FRCNNDataset, frcnn_dataset_collate from utils.utils import...
[ "torch.optim.lr_scheduler.StepLR", "torch.no_grad", "torch.from_numpy", "torch.utils.data.DataLoader", "torch.nn.DataParallel" ]
1.2.0
boyob/Faster-RCNN
43625f6e9a19e7860ceb3478ba3c43fd430f3d8f
1.7
import torch import torch.nn as nn import torch.optim as optim from collections import deque from .. import epiopt class PPO(nn.Module): def __init__(self, actor_critic, clip_param, ppo_epoch, num_mini_batch, value_l...
[ "torch.min", "torch.max", "torch.clamp", "torch.exp", "torch.mean" ]
1.7.1
thaihungle/EPGT
0c0196d9c4137f52f4d05888ad753cb915a5c761
1.6
import math import typing import torch from torch import nn from torch.nn import functional as F from vits_train.commons import subsequent_mask from vits_train.modules import LayerNorm class Encoder(nn.Module): def __init__( self, hidden_channels: int, filter_channels: int, n_hea...
[ "torch.sigmoid", "torch.nn.Dropout", "torch.relu", "torch.nn.ModuleList", "torch.nn.Conv1d", "torch.arange", "torch.no_grad", "torch.nn.init.xavier_uniform_", "torch.unsqueeze", "torch.abs", "torch.ones_like", "torch.nn.functional.softmax", "torch.nn.functional.pad", "torch.matmul", "tor...
1.6.0
mbarnig/vits-train
cfb8a0fc91daad868fe3d062ebf85d62edbd7506
1.0
#!/usr/bin/python import torch import torchvision dummy_input = torch.randn(10, 3, 224, 224, device='cpu') # or cuda model = torchvision.models.alexnet(pretrained=True).cpu() # or cuda() input_names = ["actual_input_1"] + ["learned_%d" % i for i in range(16)] output_names = ["output1"] torch.onnx.export(model, du...
[ "torch.randn", "torch.onnx.export" ]
1.0.1
rajattyagipvr/ml-pytorch-training
aeb992d1035f25a9920ce5dbab01f18fc29a687c
1.2
#! /usr/bin/python # -*- encoding: utf-8 -*- ## Fast re-implementation of the GE2E loss (https://arxiv.org/abs/1710.10467) ## Numerically checked against https://github.com/cvqluu/GE2E-Loss import torch import torch.nn as nn import torch.nn.functional as F import time, pdb, numpy class GE2ELoss(nn.Module): def ...
[ "torch.stack", "torch.nn.CrossEntropyLoss", "torch.repeat_interleave", "torch.clamp", "torch.tensor", "torch.nn.functional.cosine_similarity", "torch.mean" ]
1.2.0
Jungjee/voxceleb_trainer
52fc63eff4ab3c86016a076bde52e7bcd0e5c3da
1.10
import sys sys.path.append("..") def print_as_comment(obj): print("\n".join(f"# {line}" for line in str(obj).splitlines())) if __name__ == "__main__": import torch torch.manual_seed(42) # --- Prepare instruments from pfhedge.instruments import BrownianStock from pfhedge.instruments impor...
[ "torch.manual_seed" ]
1.10.0
vishalbelsare/pfhedge
bc4ae304f9dc887b0e4d581f8ad42700a4eea9ad
1.8
import sys import shutil, os from shutil import copyfile import sklearn from sklearn import metrics from collections import OrderedDict import numpy as np import random import pdb from sklearn.metrics import roc_curve, auc, roc_auc_score, f1_score from sklearn.preprocessing import LabelBinarizer from sklearn.model_sel...
[ "torch.nn.Linear", "torch.cuda.is_available", "torch.load", "torch.nn.CrossEntropyLoss", "torch.sigmoid", "torch.nn.MaxPool2d", "torch.autograd.Variable", "torch.utils.data.DataLoader", "torch.nn.ReLU", "torch.cuda.empty_cache", "torch.nn.Conv2d", "torch.no_grad", "torch.from_numpy" ]
1.8.1
yaweiwang1232/EDCNN
9f86adafe8cbefe37dc6b4929f5eded55dcf391c
1.9
import torch from torch import Tensor def generate_mask(*size: int, mask_prob: float) -> Tensor: """ Args: *size (int): Shape of the expected values. mask_prob (float): The probability of masking. Returns: Tensor: If True, these features should be masked. Otherwise, th...
[ "torch.rand" ]
1.9.0
pfnet-research/deep-table
a19c0c3048484017d5f24806604c3b3470bcf550
1.9
""" The models implemented here are the architectures to use the original EmbraceNets and the proposed EmbraceNet +. """ import torch import torch.nn as nn import torch.nn.functional as F from .utils.componets import WeightedSum, EmbraceNet import numpy as np class ModelOne(nn.Module): ''' EembraceNet ''' def...
[ "torch.nn.Linear", "torch.device", "torch.cat", "torch.nn.Dropout", "torch.stack", "torch.nn.Sequential", "torch.nn.Parameter", "torch.ones", "torch.nn.ReLU", "torch.sum" ]
1.9.0
WGraterol64/SentiLib
79401f8275e2ad438033b6810a4da2ae8a763d7a
1.9
from __future__ import division import os import sys import cv2 import numpy as np import torch from torchvision.transforms import transforms sys.path.append(os.path.join(os.getcwd(), 'models', 'detectors', 'yolo')) from .utils.YOLOmodels import Darknet from .utils.YOLOutils import load_classes, non_max_suppression...
[ "torch.zeros", "torch.device", "torch.stack", "torch.no_grad", "torch.squeeze", "torch.load", "torch.empty" ]
1.9.0
WGraterol64/SentiLib
79401f8275e2ad438033b6810a4da2ae8a763d7a
1.9
""" The model implemented here is the same as https://github.com/machine-perception-robotics-group/attention_branch_network (ResNet) The functions for creating the model and loading the imagenet weights have been redone. """ import torch import torch.nn as nn import torch.utils.model_zoo as model_zoo import math f...
[ "torch.nn.Linear", "torch.nn.MaxPool2d", "torch.nn.Sigmoid", "torch.nn.AvgPool2d", "torch.nn.BatchNorm2d", "torch.nn.Sequential", "torch.nn.init.kaiming_normal_", "torch.nn.init.constant_", "torch.nn.ReLU", "torch.nn.Conv2d" ]
1.9.0
WGraterol64/SentiLib
79401f8275e2ad438033b6810a4da2ae8a763d7a
1.4
import torch import numpy as np from copy import deepcopy from typing import Dict, Tuple, Union, Optional from tianshou.policy import BasePolicy from tianshou.exploration import BaseNoise, GaussianNoise from tianshou.data import Batch, ReplayBuffer, to_torch_as class DDPGPolicy(BasePolicy): """Implementation of ...
[ "torch.no_grad" ]
1.4.0
youkaichao/tianshou
a9f9940d17e0ec464611f9fa535de391e62fe8bd
1.0
from typing import Any, Callable, Optional import torch import torch.nn.functional as F import torch.nn as nn from torch.utils.data import DataLoader, TensorDataset from tqdm import tqdm from autoencoders.dae import DenoisingAutoencoder from autoencoders.sdae import StackedDenoisingAutoEncoder def train( dataset...
[ "torch.cat", "torch.nn.Dropout", "torch.nn.MSELoss", "torch.nn.functional.dropout", "torch.nn.ReLU", "torch.utils.data.DataLoader" ]
1.0.0
viniciusdsmello/pt-autoencoders
c06a12cdf71ef9301543c07c7af96d9740e264b8
1.2
import copy from pathlib import Path import shutil import tempfile import torch from tonks.ensemble.models import BertResnetEnsembleForMultiTaskClassification def test_exporting_and_loading_works_correctly(): image_task_dict = { 'task1_task2': { 'fake_attribute1': 10, 'fake_attri...
[ "torch.equal", "torch.load" ]
1.2.0
vanderveld/tonks
e87afbd9614b276b443b4a7527fd1fda01a8be4c
1.0
# coding=utf-8 # Copyright 2021, Google 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/LICENSE-2.0 ...
[ "torch.nn.Linear", "torch.cat", "torch.isnan", "torch.finfo", "torch.bmm", "torch.nn.CrossEntropyLoss", "torch.nn.LayerNorm", "torch.tensor", "torch.zeros", "torch.nn.functional.dropout", "torch.clamp", "torch.isinf", "torch.nn.functional.softmax", "torch.arange", "torch.no_grad", "tor...
1.0
Nativeatom/transformers
8df267588e1ce30b8270eeaefbcc9011d6e06b12
1.8
import pytorch_lightning as pl import torch from pytorch_lightning import loggers as pl_loggers # from pytorch_lightning.callbacks import ModelCheckpoint from data.RACEDataModule import RACEDataModule from model.BertForRace import BertForRace if __name__ == '__main__': tb_logger = pl_loggers.TensorBoardLogger('....
[ "torch.cuda.is_available" ]
1.8.0
iamNCJ/bert-race-pytorch-lightning
93abcc5d5c80790e16114fb021870593cb60f1f2
1.0
import time from threading import Thread,Event import numpy as np import torch import time from espnet.asr.pytorch_backend.asr_init import load_trained_model import torchaudio import argparse import pickle from espnet.nets.pytorch_backend.nets_utils import pad_list from online_inference import online_inference def lo...
[ "torch.cat", "torch.cuda.manual_seed_all", "torch.manual_seed", "torch.std_mean", "torch.as_tensor" ]
1.0.1
NCTUMLlab/Chi-Hang-Leong-Online_Compressive_Transformer_for_Speech_Recognition
3f159ba9cf1ca9baabf0782d8acef4bb7332d8b9
1.8
# !/usr/bin/env python # coding=UTF-8 """ @Author: WEN Hao @LastEditors: WEN Hao @Description: @Date: 2021-11-19 @LastEditTime: 2022-04-01 预置模型,roberta_chinanews """ import os from typing import NoReturn, Optional, Union, Sequence, List import torch import numpy as np import transformers from ..hf_model import Hugg...
[ "torch.no_grad" ]
1.8.1
Yzx835/AISafety
eb09551814898c7f6d86641b47faf7845c948640
1.5
from machin.frame.algorithms import DQN from machin.utils.logging import default_logger as logger from machin.model.nets import static_module_wrapper, dynamic_module_wrapper import torch as t import torch.nn as nn import gym # configurations env = gym.make("CartPole-v0") observe_dim = 4 action_num = 2 max_episodes = 1...
[ "torch.nn.Linear", "torch.no_grad", "torch.tensor", "torch.nn.MSELoss" ]
1.5.0
lethaiq/machin
7873cada457328952310394afeedcad4bb6a7c4a
1.3
# https://github.com/NVIDIA/apex/blob/master/examples/imagenet/main_amp.py import csv import argparse import os import random import shutil import time import warnings import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim ...
[ "torch.nn.Linear", "torch.arange", "torch.distributed.init_process_group", "torch.nn.CrossEntropyLoss", "torch.ones", "torch.nn.ReLU", "torch.cuda.set_device", "torch.utils.data.DataLoader", "torch.randn" ]
1.3.0
RunxinXu/pytorch-distributed
be1e34fee968142dc4e9b5adaf8a14b34943388d
1.6
r""" Ensemble classification with Forest and Qiskit devices ======================================================= .. meta:: :property="og:description": We demonstrate how two QPUs can be combined in parallel to help solve a machine learning classification problem, using PyTorch and PennyLa...
[ "torch.nn.functional.softmax", "torch.max", "torch.argmax" ]
1.6.0
brettkoonce/qml
fe78edd7e724ee18acf6ea5c30fd96aafe179e09
1.1
import copy import torch import torch.nn as nn from transformers import BertModel, BertConfig from torch.nn.init import xavier_uniform_ from models.decoder import TransformerDecoder from models.encoder import Classifier, ExtTransformerEncoder from models.optimizers import Optimizer def build_optim(args, model, check...
[ "torch.nn.LogSoftmax", "torch.nn.Linear", "torch.is_tensor", "torch.no_grad", "torch.nn.init.xavier_uniform_", "torch.nn.Embedding" ]
1.1.0
sajastu/RedSumm2021
4c08d6a1f48a64774635512b16afb9c312331ce7
1.4
import ipdb import torch import collections import random from torch import nn from torch.utils.data import Dataset from pytorch_lightning import Trainer, seed_everything class ChurnPredictToyDataset(Dataset): def __init__(self, data_size, seq_len, vocab_size, input_size, mask_zero_prob=0.05, ...
[ "torch.zeros", "torch.bincount", "torch.stack", "torch.argsort", "torch.full_like", "torch.randint", "torch.full", "torch.tensor", "torch.bernoulli", "torch.empty", "torch.nn.Embedding" ]
1.4.0
fuxiAIlab/PMTC
bea55d821bc8adf64044194a0b72d8ce913a6213
1.4
# 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.from_numpy", "torch.load" ]
1.4.0
fuxiAIlab/PMTC
bea55d821bc8adf64044194a0b72d8ce913a6213
1.7
import pickle import numpy as np import cv2 import torch import torch.nn as nn from torch.utils.data import Dataset from torch.utils.data import DataLoader import math import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.distribu...
[ "torch.nn.Linear", "torch.nn.BatchNorm2d", "torch.nn.init.kaiming_normal_", "torch.set_printoptions", "torch.cuda.is_available", "torch.eye", "torch.exp", "torch.reshape", "torch.sum", "torch.sigmoid", "torch.mul", "torch.gather", "torch.nn.MaxPool2d", "torch.unsqueeze", "torch.manual_se...
1.7.1
kyungjaelee/robosuite
0d73fcca9ed8e638632f4bd7b0f1b8ebf4640fb1
1.1
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from dataset.dataset_configs import STICKS from tools.so3 import so3_exponential_map, rand_rot from tools.functions import masked_kp_mean, \ ...
[ "torch.cat", "torch.stack", "torch.nn.BatchNorm2d", "torch.bmm", "torch.clamp", "torch.nn.ReLU", "torch.from_numpy", "torch.nn.Conv2d", "torch.eye", "torch.tensor", "torch.nn.Softplus" ]
1.1.0
tusharc31/c3dpo_nrsfm
bffe61ddd84eb2aab8d6f18c3534107f616d0fd2
0.4
#!/usr/bin/env python # USAGE: import sys import torch corr_file = sys.argv[1] network = int(sys.argv[2]) layer = int(sys.argv[3]) out = sys.argv[4] correlations = torch.load(corr_file) correlations = correlations[network][layer][0] maxs, _ = torch.max( torch.abs(correlations) * (1 - torch.eq( torch....
[ "torch.arange", "torch.save", "torch.abs", "torch.eye", "torch.load", "torch.sort" ]
0.4.0
oserikov/opennmt-inspection
0686a43aceb2620272ecda44ad08ba3bc9cb6e9b
1.8
""" This code is extended from Jin-Hwa Kim, Jaehyun Jun, Byoung-Tak Zhang's repository. https://github.com/jnhwkim/ban-vqa This code is modified from ZCYang's repository. https://github.com/zcyang/imageqa-san """ import torch import torch.nn as nn from torch.nn.utils.weight_norm import weight_norm from bc import BCNet...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.nn.Softmax", "torch.nn.ModuleList", "torch.nn.Tanh", "torch.sum" ]
1.8.0
gdemelo/PubMedCLIP
1c0892af2b640e7e6c3ac7846c12a596418eda2a
1.5
import torch import torch.nn as nn from torch.autograd import Function from losses.sigma.polynomial.divide_conquer import divide_and_conquer from losses.sigma.polynomial.multiplication import Multiplication from losses.sigma.polynomial.grad import d_logS_d_expX from itertools import combinations def CNK(n,k): comb...
[ "torch.zeros", "torch.max", "torch.ones", "torch.Tensor", "torch.exp" ]
1.5.0
satya77/transformer_rankers
0d2c20bd26041d887fb65102020a0b609ec967fc
1.6
# MIT License # # Copyright (c) 2021 Soohwan Kim and Sangchun Ha and Soyoung Cho # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights...
[ "torch.nn.Embedding" ]
1.6.0
CanYouImagine/openspeech
10307587f08615224df5a868fb5249c68c70b12d
1.0
""" This script trains sentence transformers with a triplet loss function. As corpus, we use the wikipedia sections dataset that was describd by Dor et al., 2018, Learning Thematic Similarity Metric Using Triplet Networks. See docs/pretrained-models/wikipedia-sections-modesl.md for further details. You can get the d...
[ "torch.utils.data.DataLoader" ]
1.0.1
fhaase2/sentence-transformers
40f994e5e3ce3e2819833773117d788dfa0c7e7f
1.0
""" This examples trains BERT for the STSbenchmark from scratch. It generates sentence embeddings that can be compared using cosine-similarity to measure the similarity. """ from torch.utils.data import DataLoader import math from sentence_transformers import SentenceTransformer, SentencesDataset, LoggingHandler, loss...
[ "torch.utils.data.DataLoader" ]
1.0.1
fhaase2/sentence-transformers
40f994e5e3ce3e2819833773117d788dfa0c7e7f
1.1
import os import cv2 import sys import time import scipy import torch import argparse import numpy as np import torch.optim from formal_utils import * from skimage.transform import resize from PIL import ImageFilter, Image use_cuda = torch.cuda.is_available() # Fixing for deterministic results torch.backends.cudnn.d...
[ "torch.cuda.is_available", "torch.nn.DataParallel", "torch.nn.Softmax", "torch.manual_seed", "torch.abs", "torch.zeros_like", "torch.min", "torch.max", "torch.optim.Adam", "torch.from_numpy", "torch.ones_like", "torch.nn.UpsamplingNearest2d" ]
1.1.0
anguyen8/generative-attribution-methods
b533ac799d14e66f9da9123266b83f3c942653d0
1.4
# encoding: utf-8 """ @author : zhirui zhou @contact: evilpsycho42@gmail.com @time : 2020/4/1 17:03 """ import os import torch from torch.utils.tensorboard import SummaryWriter from deepseries.log import get_logger import numpy as np import time import copy class EarlyStopping(Exception): pass logger = get_log...
[ "torch.no_grad", "torch.utils.tensorboard.SummaryWriter" ]
1.4
EvilPsyCHo/Deep-Time-Series-Prediction
f6a6da060bb3f7d07f2a61967ee6007e9821064e
1.3
from PIL import Image import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F # efficient gradient descents import torch.optim as optim # Prevent browser caching of generated image import time #to deep copy the models import copy import os # Function to check if uploaded file...
[ "torch.nn.Sequential", "torch.nn.functional.mse_loss", "torch.nn.ReLU", "torch.tensor" ]
1.3.1
sarthakbatragatech/style_transfer
a29a43b2b161784a51dc81c75c4320abf683e67b
1.8
import torch torch.backends.cudnn.benchmark = True import torch.nn.functional as F from torch.distributions import Normal, Categorical import numpy as np from .reinforce import REINFORCE class PPO(REINFORCE): """Proximal Policy Optimization (PPO) agent. Args: batch_size (int): the number of samples...
[ "torch.distributions.Categorical", "torch.min", "torch.no_grad", "torch.distributions.Normal", "torch.normal", "torch.clamp", "torch.multinomial", "torch.nn.functional.mse_loss", "torch.tanh", "torch.argmax" ]
1.8.1
zenoengine/JORLDY
1eb867e52a03e0282a55fa612cbc5b5de701ffe7
1.2
import numpy as np import torch def format_attention(attention): squeezed = [] for layer_attention in attention: # 1 x num_heads x seq_len x seq_len if len(layer_attention.shape) != 4: raise ValueError("The attention tensor does not have the correct number of dimensions. Make sure y...
[ "torch.zeros", "torch.stack" ]
1.2.0
moinnabi/acl2019-commonsense
0dab6ac8cb58ba724a4b091172656b922dafc740
1.2
''' Adversarial Attacks on Neural Networks for Graph Data. ICML 2018. https://arxiv.org/abs/1806.02371 Author's Implementation https://github.com/Hanjun-Dai/graph_adversarial_attack This part of code is adopted from the author's implementation (Copyright (c) 2018 Dai, Hanjun and Li, Hui and T...
[ "torch.nn.Linear", "torch.Size", "torch.cat", "torch.nn.ModuleList", "torch.max", "torch.ones", "torch.mm", "torch.nn.functional.relu", "torch.mean", "torch.LongTensor", "torch.spmm", "torch.Tensor", "torch.set_grad_enabled" ]
1.2.0
shixiongjing/DeepRobust
276a7048aded2cf3a190d3851ffd4587b7d1dd49
1.2
""" Our attacking based on spectral of graph Laplacian """ import numpy as np import scipy.sparse as sp import torch from torch import optim from torch.nn import functional as F from torch.nn.parameter import Parameter from tqdm import tqdm from deeprobust.graph import utils from deeprobust.graph.global_attack impor...
[ "torch.zeros", "torch.symeig", "torch.no_grad", "torch.tril_indices", "torch.clamp", "torch.nn.functional.mse_loss", "torch.autograd.grad", "torch.tensor", "torch.eye", "torch.ones_like", "torch.nn.functional.nll_loss" ]
1.2.0
Louise-LuLin/DeepRobust
a91b2d321f45cd7b24873220bd62a60911829d2c
1.0
# Copyright 2019 The Texar Authors. 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 ...
[ "torch.device", "torch.tensor" ]
1.0.0
qinzzz/texar-pytorch
d66258a599a291418004170e62864b001b650926
1.1
import numpy as np import torch import torch.nn as nn from ....ops.iou3d_nms import iou3d_nms_utils class ProposalTargetLayer(nn.Module): def __init__(self, roi_sampler_cfg): super().__init__() self.roi_sampler_cfg = roi_sampler_cfg def forward(self, batch_dict): """ Args: ...
[ "torch.cat", "torch.max", "torch.from_numpy" ]
1.1
EmiyaNing/OpenPCDet
41ff28209cb000b51626a0ed8593b0adbe3dd447
1.9
import spacy import numpy as np import torch from sklearn.metrics.pairwise import cosine_similarity from transformers import AutoModel, AutoTokenizer from sklearn.feature_extraction.text import CountVectorizer from KinGBERT.utils import extractor_topic_rank, extractor_topical_page_rank, extractor_single_rank, extractor...
[ "torch.is_tensor", "torch.no_grad" ]
1.9.0
sokolheavy/KinGBERT
c7c91d92bd7d6cc725375d8c3d541040e8a22184
1.5
"""Mathematical functions.""" # mikael.brudfors@gmail.com # yael.balbastre@gmail.com import torch from .constants import inf, ninf def round(t, decimals=0): """ Round a tensor to the given number of decimals. Args: t (torch.tensor) Tensor. decimals (int, optional): Round to this decimal, de...
[ "torch.round", "torch.min", "torch.isnan", "torch.max", "torch.arange", "torch.lgamma", "torch.from_numpy", "torch.as_tensor", "torch.log", "torch.exp", "torch.where", "torch.sum" ]
1.5
wyli/nitorch
3ecd18944cf45fb9193c4c6ffc32953c4d1c71ac
1.0
# Borrowed from https://github.com/meetshah1995/pytorch-semseg import torch import torch.nn as nn import numpy as np import torch.nn.functional as F from torch.autograd import Variable class conv2DBatchNorm(nn.Module): def __init__( self, in_channels, n_filters, k_size, st...
[ "torch.cat", "torch.nn.MaxPool2d", "torch.nn.Sequential", "torch.nn.BatchNorm2d", "torch.nn.ReLU", "torch.nn.Upsample", "torch.nn.Conv2d", "torch.nn.MaxUnpool2d", "torch.nn.functional.pad" ]
1.0.1
vikasTmz/tk3dv
48430cbc80113ed9c51bdcd3fb577da22af66473
1.1
import configparser import os import re import string import pickle import copy import random import numpy as np import torch from torch.utils.data import DataLoader from fastNLP import Vocabulary from dataset_my import Dataset from dataloader import TrainDataLoader from utils import padding, batch_padding def _parse...
[ "torch.cat", "torch.cuda.manual_seed_all", "torch.manual_seed", "torch.cuda.is_available", "torch.tensor" ]
1.1.0
ChenZhannnnn/chenzhan
b26a9512bbd1efe86c35c91a625da40b6f94dfc7
1.1
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from mmskeleton.ops.st_gcn import ConvTemporalGraphicalBatchA, Graph """ change from 21 A矩阵对称版本 A 3*25*25 a.triu !!!! besides the max link , other link do not set 1 """ def zero(x): return 0 def iden(x...
[ "torch.nn.Linear", "torch.zeros", "torch.nn.Dropout", "torch.nn.Conv1d", "torch.nn.BatchNorm2d", "torch.softmax", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.nn.BatchNorm1d", "torch.tensor", "torch.argmax" ]
1.1
niujunyu/mmskeleton
0936b610f0c44e87f6886d34a9f43eda872ed6d8
1.7
import torch from face_detection.Config import cig def smooth_l1_loss(x, t, in_weight, sigma : float): sigma2 = sigma ** 2 diff = in_weight * (x - t) abs_diff = diff.abs() flag = (abs_diff.data < (1. / sigma2)).float() y = (flag * (sigma2 / 2.) * (diff ** 2) + (1 - flag) * (abs_diff - 0.5 ...
[ "torch.zeros" ]
1.7.0
We-Union/FaceDetection
5f0d0010fc24d801101cea0a03c95cf5a91f8f90
1.0
import unittest import torch import bert_score from transformers import __version__ as ht_version EPS = 1e-5 cands = [ "28-year-old chef found dead in San Francisco mall", "A 28-year-old chef who recently moved to San Francisco was found dead in the staircase of a local shopping center.", "The victim's br...
[ "torch.is_tensor", "torch.tensor" ]
1.0.0
karinseve/bert_score
926c516ac516411c560918dddce7755e6ea9aa70
1.9
# Copyright (c) OpenMMLab. All rights reserved. import argparse import mmcv import os import torch import warnings from mmcv import Config, DictAction from mmcv.cnn import fuse_conv_bn from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmcv.runner import (get_dist_info, init_dist, load_checkpoint,...
[ "torch.cuda.current_device" ]
1.9.0
zmehdiz97/Object-DGCNN
b1561db745575ffa0528402d66511f64670f8d7f
1.2
import copy import argparse import torch import torch.nn.functional as F from torch.nn import Parameter, ModuleDict, ModuleList, Linear, ParameterDict from torch_sparse import SparseTensor from ogb.nodeproppred import PygNodePropPredDataset, Evaluator from logger import Logger class RGCNConv(torch.nn.Module): ...
[ "torch.nn.Linear", "torch.device", "torch.nn.ModuleList", "torch.no_grad", "torch.nn.functional.dropout", "torch.nn.init.xavier_uniform_", "torch.cuda.is_available", "torch.nn.functional.relu", "torch.Tensor" ]
1.2.0
rryoung98/ogb
34a8ac53dc6dab215938b5b54caeff37a06300d6
1.6
# Copyright 2021 One Theta. 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.tensor", "torch.utils.data.DataLoader" ]
1.6.0
OneTheta/readability-transformers
3c122c98a90c67add8eafad16563b269d5e3124a
1.7
import numpy as np import torch import logging import losses import json from tqdm import tqdm import torch.nn.functional as F import math def l2_norm(input): input_size = input.size() buffer = torch.pow(input, 2) normp = torch.sum(buffer, 1).add_(1e-12) norm = torch.sqrt(normp) _output = torch.div...
[ "torch.cat", "torch.sqrt", "torch.stack", "torch.max", "torch.no_grad", "torch.sum", "torch.nn.functional.linear", "torch.Tensor", "torch.cdist", "torch.pow" ]
1.7.1
i92run/my_Proxy_Anchor_Loss
42b008b1878f33cc276cda13752f1a57b29466c8
1.1
import torch from torch.autograd import Function import torch.nn as nn import sys from typing import Optional, Any, Tuple import torch_points_kernels.points_cpu as tpcpu from .knn import knn if torch.cuda.is_available(): import torch_points_kernels.points_cuda as tpcuda def furthest_point_sample(xyz, npoint): ...
[ "torch.cuda.is_available", "torch.sqrt" ]
1.1.0
duducheng/torch-points-kernels
aed9cf56ca61fe34b4880159951760e5dcb3a1db
1.8
import sys sys.path.append('..') from utilities import labels_from_ids from dataset import BalancedBatchSampler, make_dataset from nets import EmbeddingNet from plots import extract_embeddings, plot_embeddings from losses import OnlineTripletLoss, AverageNonzeroTripletsMetric from deep_ranking_utils import HardestNega...
[ "torch.optim.lr_scheduler.StepLR", "torch.cuda.is_available", "torch.utils.data.DataLoader" ]
1.8
natashanorsker/fagprojekt
ef9a8cc2128c43d891c8a7a47e14916af2b9c602
1.7
#!/usr/bin/env python3 import os import copy import torch import os.path import argparse import numpy as np import torch.nn as nn import torch.optim as optim from torchvision import models import torch.utils.data as Data import torch.nn.functional as F from torch.autograd import Variable from torchvision.models.vgg im...
[ "torch.rand" ]
1.7.0
wang-chen/interestingness
505ed5af22cf92fe3af095b3a56cdc78078c86c6
1.8
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from LibMTL._record import _PerformanceMeter from LibMTL.utils import count_parameters class Trainer(nn.Module): r'''A Multi-Task Learning Trainer. This is a unified and extensible training framework for multi-task learning...
[ "torch.zeros", "torch.device", "torch.no_grad" ]
1.8.0
median-research-group/LibMTL
b0937ff59429a7cfbca66fe6bc3385258c2d6461
1.8
from torch.utils.data import DataLoader, Dataset import os import torch import torch.nn.functional as F import torchvision.transforms as transforms from PIL import Image class office_Dataset(Dataset): def __init__(self, dataset, root_path, task, mode): self.transform = transforms.Compose([ ...
[ "torch.utils.data.DataLoader" ]
1.8.0
median-research-group/LibMTL
b0937ff59429a7cfbca66fe6bc3385258c2d6461
1.6
import json from glob import glob import numpy as np import pytorch_lightning as pl import torch from audio_processing import random_crop from prepare_data import get_id_from_path from pytorch_lightning.loggers import TensorBoardLogger from sklearn.model_selection import train_test_split from torch.nn import functiona...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.nn.LSTM", "torch.max", "torch.nn.functional.l1_loss", "torch.nn.functional.cross_entropy", "torch.tensor", "torch.utils.data.DataLoader" ]
1.6.0
CVxTz/ReconstructionAuxLoss
0d3b6651bd72aace2f10a698ae2d907a1b4f1bd5
0.4
from __future__ import absolute_import, division, print_function import numpy as np import torch import torch.nn as nn from torch.autograd import grad class BaseFlow(nn.Module): """ """ def __init__(self, n_inputs, **kwargs): super(BaseFlow, self).__init__() self.n_inputs = n_inputs de...
[ "torch.ones_like", "torch.sum" ]
0.4.0
vischia/madminer
98c2bcfb93d0fd84ff1872b344c4d89adf51217f
0.4
import torch import numpy as np import torch.nn as nn from math import ceil from torch.autograd import Variable from semseg import caffe_pb2 from semseg.models.utils import * from semseg.loss import * icnet_specs = { "cityscapes": { "n_classes": 19, "input_size": (1025, 2049), ...
[ "torch.autograd.Variable", "torch.from_numpy", "torch.cuda.device_count", "torch.nn.Conv2d" ]
0.4.1
ManuelFritsche/flow-consistency
90625fe25855aa11c6245ca242ab8d66c41f4726
0.4
import numpy as np import torch from torch.autograd import Variable from .get_nets import PNet, RNet, ONet from .box_utils import nms, calibrate_box, get_image_boxes, convert_to_square from .first_stage import run_first_stage def detect_faces(image, min_face_size=20.0, thresholds=[0.6, 0.7, ...
[ "torch.FloatTensor" ]
0.4.0
prography/ddeep_KYJ_JSY
2da506cfd9e792a2d391de6f390b8b3b509b6c54
1.2
#! /usr/bin/python # -*- encoding: utf-8 -*- import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Parameter from models.ResNetBlocks import * class ResNetSE(nn.Module): def __init__(self, block, layers, num_filters, nOut, encoder_type='SAP', **kwargs): print('Embedding ...
[ "torch.nn.InstanceNorm1d", "torch.nn.Linear", "torch.nn.MaxPool2d", "torch.nn.Sequential", "torch.nn.AvgPool2d", "torch.nn.BatchNorm2d", "torch.FloatTensor", "torch.nn.init.kaiming_normal_", "torch.nn.init.constant_", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.nn.functional.softmax", "torch....
1.2.0
entn-at/voxceleb_trainer
b288f2a2175ff772647343567395db3b645a2124
1.2
import requests from torch import Tensor, device from typing import Tuple, List from tqdm import tqdm import sys import importlib import os import torch import numpy as np import queue def pytorch_cos_sim(a: Tensor, b: Tensor): """ Computes the cosine similarity cos_sim(a[i], b[j]) for all i and j. This fu...
[ "torch.stack" ]
1.2.0
azdaly/sentence-transformers
d365d14e6eb3a79b7589c6404020833d5bda7322
1.0
import torch from torch.autograd import Variable import time import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt def compute_test_time(network_class, input_size, max_batch_size, step_size=1, is_cuda=False): backend = "cpu" if is_cuda: backend = "cuda" model = network_class() ...
[ "torch.FloatTensor", "torch.sum" ]
1.0.1
MathGaron/pytorch_toolbox
2afd13e50ba71dfce66467a4b070d9b922668502
1.1
import torch from overrides import overrides from reclib.training.metrics.average import Average from reclib.training.metrics.metric import Metric @Metric.register("perplexity") class Perplexity(Average): """ Perplexity is a common metric used for evaluating how well a language model predicts a sample. ...
[ "torch.exp" ]
1.1.0
tingkai-zhang/reclib
3c56dd7f811ab4d4f9f692efd0ee5e171a5f818b
0.4
# coding: utf-8 import torch from joeynmt.constants import PAD_TOKEN from joeynmt.helpers import load_data, arrays_to_sentences, bpe_postprocess, \ load_config, get_latest_checkpoint, make_data_iter, \ load_model_from_checkpoint, store_attention_plots from joeynmt.metrics import bleu, chrf, token_accuracy, se...
[ "torch.no_grad", "torch.exp" ]
0.4.1
MStaniek/joeynmt
a3151cec04ace0921bb36f44abf6ea17dbe3bde6
1.4
import torch import sys sys.path.append('..') # def collate(batch): # """A custom collate function for dealing with batches of features that have a different number of associated targets # (action instances). # """ # max_len = max([len(feat) for feat,_,_ in batch]) # # features = [] # targets =...
[ "torch.Tensor", "torch.tensor" ]
1.4.0
June01/WFSAL-icmr21
86fd6e9e34483ea17e088e4c1ee8f66edf3aecce
1.6
from math import pi, log from functools import wraps import torch from torch import nn, einsum import torch.nn.functional as F from einops import rearrange, repeat # helpers def exists(val): return val is not None def default(val, d): return val if exists(val) else d def cache_fn(f): cache = None ...
[ "torch.nn.Linear", "torch.cat", "torch.nn.LayerNorm", "torch.nn.Dropout", "torch.nn.ModuleList", "torch.einsum", "torch.finfo", "torch.nn.functional.gelu", "torch.linspace", "torch.meshgrid", "torch.randn" ]
1.6
mesur-io/perceiver-pytorch
188158299f90b4e8874614dbc2cb050336e1c4df
1.5
import torch import torch.nn as nn import torch.nn.functional as F from subnet import ImageConvNet, AudioConvNet class AVENet(nn.Module): def __init__(self): super(AVENet, self).__init__() # image subnetwork self.icn = ImageConvNet() self.img_pool = nn.AdaptiveMaxPool2d(1) ...
[ "torch.nn.Linear", "torch.rand", "torch.nn.AdaptiveMaxPool2d" ]
1.5.0
kyuyeonpooh/objects-that-sound
962031567f7e5657637d5518dff4f9a44af1c7eb
1.7
import torch, torchvision import torch.nn as nn import torch.nn.functional as F from torchvision.models.resnet import Bottleneck import torch.backends.cudnn as cudnn import torch.utils.model_zoo as model_zoo from typing import List from collections import defaultdict import os from backbone import construct_backbone fr...
[ "torch.zeros", "torch.device", "torch.cat", "torch.set_default_tensor_type", "torch.nn.functional.interpolate", "torch.utils.model_zoo.load_url", "torch.nn.init.xavier_uniform_", "torch.cuda.device_count", "torch.cuda.current_device", "torch.nn.Conv2d", "torch.cuda.is_available", "torch.load",...
1.7.1
DerekRay/2020-instanceSeg
a08ad95e64726db53cc32a5f90aaa13ae3cdb6a3
1.4
import torch import numpy as np from misc.replay_memory import ReplayMemory def collect_trajectory(agents, actors, env, args): """Collect batch of trajectories Args: agents (list): Contains agents that act in the environment actors (list): Contains parameters that agents use to select action ...
[ "torch.zeros", "torch.stack", "torch.mean", "torch.sum" ]
1.4.0
dkkim93/meta-mapg
98d4d1be3f5fd628b42e451bed99004f02f553d0
1.5
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import datetime import json import random import time from pathlib import Path import numpy as np import torch from torch.utils.data import DataLoader, DistributedSampler import datasets import util.misc as utils from datasets impo...
[ "torch.device", "torch.optim.AdamW", "torch.optim.lr_scheduler.StepLR", "torch.utils.data.RandomSampler", "torch.utils.data.DistributedSampler", "torch.save", "torch.utils.data.SequentialSampler", "torch.nn.parallel.DistributedDataParallel", "torch.manual_seed", "torch.utils.data.BatchSampler", ...
1.5.0
cadgip/detr
a032506f145d0f5e7951e002b3100b30de6a7d58
1.7
import torch import gym import random import numpy as np torch.backends.cudnn.deterministic=True class Environment: def __init__(self, render=False, seed=None): self.render = render self.env_seed = seed def set_seed(self): if self.env_seed is not None: self.env.seed(self...
[ "torch.cuda.manual_seed", "torch.manual_seed", "torch.random.manual_seed", "torch.tensor" ]
1.7.0
gargiani/VRPG
429fe58b089df2f4cdedab01b05564230e2317ac
1.8
#!/usr/bin/env python3 import io import logging import multiprocessing import os import time import imghdr from pathlib import Path from typing import Union import cv2 import torch import numpy as np from loguru import logger from lama_cleaner.model_manager import ModelManager from lama_cleaner.schema import Config ...
[ "torch.device", "torch._C._jit_override_can_fuse_on_gpu", "torch.cuda.empty_cache", "torch._C._jit_set_nvfuser_enabled", "torch._C._jit_set_texpr_fuser_enabled", "torch._C._jit_override_can_fuse_on_cpu" ]
1.8.2
Sanster/lama-cleaner
20acc58435639d6438a962e392ca1cf89b9755f6
1.5
import os import re import json import math import logging import pickle import random import importlib import functools import itertools from collections import defaultdict from typing import List, Dict, Optional import numpy as np import networkx as nx import matplotlib as mpl mpl.use("Agg") import matplotlib.pyplo...
[ "torch.optim.lr_scheduler.LambdaLR" ]
1.5.1
qinyan-li/DocEE
e8d2202a44907df5f12f9a67180d849a54421ab7
1.5
# pip install pytorch-lightning # pip install neptune-client #%% from __future__ import print_function from utils.hessian_penalty.hessian_penalty_pytorch import hessian_penalty from pytorch_lightning.loggers import WandbLogger from pytorch_lightning.callbacks.progress import ProgressBar from sklearn.model_selection imp...
[ "torch.nn.Linear", "torch.randperm", "torch.cuda.is_available", "torch.exp", "torch.sum", "torch.manual_seed", "torch.randn_like", "torch.utils.data.DataLoader", "torch.zeros_like", "torch.nn.Tanh", "torch.nn.ReLU", "torch.distributions.Normal", "torch.bernoulli", "torch.ones_like" ]
1.5.1
sneakyPad/decoding-latent-space-rs
bc7bfba5d6cf5a9d72f5c5393f394dee1025441a
1.1
import torch import torch.nn as nn import numpy as np from ...utils import box_utils from .point_head_template import PointHeadTemplate from ...ops.roiaware_pool3d import roiaware_pool3d_utils class SoftmaxFocalClassificationLoss(nn.Module): """ Softmax focal cross entropy loss. """ def __init__(self...
[ "torch.nn.Softmax", "torch.max", "torch.clamp", "torch.nn.functional.cross_entropy", "torch.exp" ]
1.1
kathy-lee/astyx-pcdet
355bfd88c37e1b717482f651778c1d4cb2f647d2
0.4
# -------------------------------------------------------- # SiamMask # Licensed under The MIT License # Written by Qiang Wang (wangqiang2015 at ia.ac.cn) # -------------------------------------------------------- from __future__ import division import argparse import logging import numpy as np import cv2 from PIL impo...
[ "torch.cuda.is_available", "torch.is_tensor", "torch.from_numpy" ]
0.4.1
culdo/SiamMask
8eb80eb95c255124e7732c31f22795c7d65dd66b