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.10
import os import logging import copy from tqdm import trange from datetime import datetime import numpy as np import torch from torch.utils.tensorboard import SummaryWriter from torchvision.utils import save_image from utils import ema from lib.dataset import DataLooper from lib.sde import VPSDE from lib.model.ddpm i...
[ "torch.cat", "torch.no_grad", "torch.randn_like", "torch.utils.tensorboard.SummaryWriter", "torch.nn.DataParallel" ]
1.10.0
NCIA-Diffusion/ScoreSDE
b5a562908daf66e6dcf0b791beb83f1fcb61174b
1.0
import logging import os import warnings from abc import ABC, abstractmethod from collections import defaultdict from os.path import join from typing import Iterable, List, Optional, Tuple, Union import torch from torch import nn from .composition import AdapterCompositionBlock, Fuse, Stack, parse_composition from .c...
[ "torch.zeros", "torch.nn.Embedding.from_pretrained", "torch.nn.ModuleDict", "torch.save", "torch.load", "torch.nn.Embedding" ]
1.0
rahuln/adapter-transformers
ac3284547064686d31b95e5e1b078447a2199779
1.3
import _init_paths import tensorflow as tf tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) from trainers.adnet_train_sl import adnet_train_sl import argparse from options.general2 import opts from models.ADNet import adnet from utils.get_train_videos import get_train_videos from trainers.adnet_train_rl i...
[ "torch.multiprocessing.set_start_method", "torch.nn.DataParallel" ]
1.3.1
hizb-resume/LTD-local-track-to-detect-for-VID
7147ac7c6cd4b22a956aaaabaa151e5ed5410c68
1.6
import argparse from dl_training.training import BaseTrainer from dl_training.testing import OpenBHBTester import torch import logging if __name__=="__main__": logger = logging.getLogger("SMLvsDL") parser = argparse.ArgumentParser() # Data location + saving paths parser.add_argument("--root", type=s...
[ "torch.manual_seed", "torch.cuda.is_available" ]
1.6.0
Duplums/SMLvsDL
b285717bd8d8e832b4bc9e2b42d18bd96b628def
1.8
import torch from torch import nn from torch.utils.data import DataLoader, Dataset class DatasetSplit(Dataset): def __init__(self, dataset, idxs): self.dataset = dataset self.idxs = list(idxs) def __len__(self): return len(self.idxs) def __getitem__(self, item): image, la...
[ "torch.nn.CrossEntropyLoss" ]
1.8.1
lynshao/NoisyNN
2c827dbe697f4a8d8f9b2cb8abb2aa43a749fa16
1.5
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Modules to compute the matching cost and solve the corresponding LSAP. """ import torch from scipy.optimize import linear_sum_assignment from torch import nn from util.box_ops import box_cxcywh_to_xyxy, generalized_box_iou class HungarianMatc...
[ "torch.cat", "torch.no_grad", "torch.as_tensor", "torch.cdist" ]
1.5.0
whq-hqw/detr_change
142f75cc5e0b59ca6e07928ddcbed3e461816611
1.1
import os import pytest import torch import tests.base.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.core import memory from pytorch_lightning.trainer.distrib_parts import parse_gpu_ids, determine_root_gpu_device from pytorch_light...
[ "torch.eq", "torch.cuda.device_count" ]
1.1
ashwinb/pytorch-lightning
89787947304a0db3a98a1ddd0e818a91a924e43f
1.6
import torch from torch import Tensor from torch import nn from typing import Union, Tuple, List, Iterable, Dict import os import json class Pooling(nn.Module): """Performs pooling (max or mean) on the token embeddings. Using pooling, it generates from a variable sized sentence a fixed sized sentence embeddi...
[ "torch.cat", "torch.sqrt", "torch.max", "torch.clamp", "torch.sum" ]
1.6.0
searchsolved/sentence-transformers-master
50f345322d602ebab9e6d2b5e2a98e7e9d0cf9a3
0.4
from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import torch.nn as nn from collections import OrderedDict from functools import partial from lib.models.tools.module_helper import ModuleHelper class GlobalAvgPool2d(nn.Module): ...
[ "torch.nn.Conv2d", "torch.nn.MaxPool2d" ]
0.4.1
Xlinford/ContrastiveSeg
79eec700d2efdaad4da8cf0c07674107e72078da
1.7
import json import torch from tqdm import tqdm from .consts import ARGS, DEVICE, TOKENIZER def read_data(path): data = [] with open(path, encoding='utf8') as f: for line in f: line = json.loads(line) data.append(line) return data def batchify(sentence_dict, phrase_list_sampled, batch_size=32): batches ...
[ "torch.cat", "torch.FloatTensor", "torch.no_grad" ]
1.7.0
JiachengLi1995/UCTopic
3875f2afbf6b99dfce2d5b5cd930976049746d41
1.3
""" Entry point for training and evaluating a lemmatizer. This lemmatizer combines a neural sequence-to-sequence architecture with an `edit` classifier and two dictionaries to produce robust lemmas from word forms. For details please refer to paper: https://nlp.stanford.edu/pubs/qi2018universal.pdf. """ import loggi...
[ "torch.cuda.manual_seed", "torch.manual_seed", "torch.cuda.is_available" ]
1.3.0
rasimuvaikas/stanza
21793519a531b0e9d7151e42d180d97785c9a5b8
1.2
import torch import numpy as np import unittest from his_evaluators.metrics import register_metrics DEVICE = torch.device("cuda:0") class MetricTestCase(unittest.TestCase): @classmethod def setUpClass(cls) -> None: cls.paired_metric_dict = register_metrics(types=("ssim", "psnr", "lps"), device=DE...
[ "torch.device" ]
1.2.0
Puneet-G/Impersonator-NNProject
980cfc260feebbc873b4150326791340f6526c42
1.8
import re import pickle import numpy as np import pandas as pd import torch from string import punctuation from nltk.stem import WordNetLemmatizer from nltk.tokenize import sent_tokenize, word_tokenize from sklearn.feature_extraction.text import CountVectorizer from flask import Flask, render_template, request, jsonif...
[ "torch.Tensor", "torch.max" ]
1.8.0
Aditibansal2603/fake-news-predictor
9d4ba2ed95799ca63d0fa7f3f5ad0e6f09b9b215
1.6
''' This code is used for testing MoDL on JPEG-compressed data, for the results shown in figures 6, 7 and 8c in the paper. Before running this script you should update the following: basic_data_folder - it should be the same as the output folder defined in the script /crime_2_jpeg/data_prep/jpeg_data_prep.py (c...
[ "torch.no_grad", "torch.cuda.is_available", "torch.load" ]
1.6.0
mikgroup/subtle_data_crimes
210025d9cb8f92583f5f983be15af06b57cfea36
1.0
import os import random import time import numpy as np import torch import torch.optim as optim from torch.utils.data import DataLoader from crossView import PVA_model, Argoverse from opt import get_args import tqdm from datetime import datetime from utils import mean_IU, mean_precision import wandb def readlines(f...
[ "torch.cuda.manual_seed", "torch.cuda.manual_seed_all", "torch.no_grad", "torch.optim.Adam", "torch.save", "torch.manual_seed", "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.load" ]
1.0.0
zzx9636/cross-view
9a7e874be607eefa7bd34934e274cc376e99f65f
1.2
import datetime import logging import math import os import time import traceback from typing import Dict, Optional, Tuple, Union, Iterable, Any import torch import torch.distributed as dist import torch.optim.lr_scheduler from torch.nn.parallel import DistributedDataParallel from allennlp.common import Params from a...
[ "torch.no_grad", "torch.distributed.barrier", "torch.nn.parallel.DistributedDataParallel", "torch.isnan" ]
1.2.0
loopylangur/allennlp
0fc695b08a0376317e45ae0a45584aa9eb14beb6
1.2
from typing import Dict, List, TypeVar, Generic import warnings import torch import numpy from allennlp.common import Registrable from allennlp.data.tokenizers.token import Token from allennlp.data.vocabulary import Vocabulary TokenType = TypeVar("TokenType", int, List[int], numpy.ndarray) class TokenIndexer(Gener...
[ "torch.LongTensor" ]
1.2.0
loopylangur/allennlp
0fc695b08a0376317e45ae0a45584aa9eb14beb6
1.9
from logger import coil_logger import torch.nn as nn import torch import importlib from configs import g_conf from coilutils.general import command_number_to_index from .building_blocks import Conv from .building_blocks import Branching from .building_blocks import FC from .building_blocks import Join from .building_...
[ "torch.nn.Sequential", "torch.nn.init.xavier_uniform_", "torch.nn.init.constant_" ]
1.9.0
PDillis/coiltraine
a682aa62af5f6ecb95a837d33b70d893d3d261f6
1.0
# coding=utf-8 # Copyright 2018 The Microsoft Research Asia LayoutLM Team Authors and the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/...
[ "torch.nn.Linear", "torch.zeros", "torch.nn.Dropout", "torch.nn.LayerNorm", "torch.nn.Softmax", "torch.arange", "torch.nn.Tanh", "torch.nn.CrossEntropyLoss", "torch.ones", "torch.matmul", "torch.nn.Embedding" ]
1.0
timpal0l/transformers
d86d57faa3b6511c6e4d9139535d77b695b9af8a
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.nn.Linear", "torch.zeros", "torch.Size", "torch.stack", "torch.eq", "torch.nn.init.constant_", "torch.isfinite", "torch.cuda.device_count", "torch.cuda.is_available", "torch.tensor", "torch.utils.data.DataLoader", "torch.load", "torch.equal" ]
1.4
pollenjp/pytorch-lightning
06f83492919c4c72a989f9bb8f271b92b479648b
1.8
from torchflare.batch_mixers.mixers import cutmix, mixup, get_collate_fn import torch x = torch.randn(4, 3, 256, 256) targets = torch.tensor([0, 1, 0, 1]) ds = torch.utils.data.TensorDataset(x, targets) def test_mixup(): dl = torch.utils.data.DataLoader(ds, batch_size=2) batch = next(iter(dl)) op, y = ...
[ "torch.is_tensor", "torch.randn", "torch.tensor", "torch.utils.data.DataLoader", "torch.utils.data.TensorDataset" ]
1.8.0
earlbabson/torchflare
15db06d313a53a3ec4640869335ba87730562b28
1.4
import torch, numpy as np, scipy.sparse as sp from torch.nn import functional as F from tqdm import tqdm def adjacency(H): """ construct adjacency for recursive hypergraph arguments: H: recursive hypergraph """ A = np.eye(H['n']) E = H['D0'] for k in tqdm(E): e = list(E[k...
[ "torch.Size", "torch.sparse.FloatTensor", "torch.from_numpy" ]
1.4.0
naganandy/G-MPNN-R
04564c059e6e8cfc08edb27403dfe6bb89ba8bab
0.3
import math from typing import Tuple, List, Dict, Any import bnn import numpy as np import torch from bnn import BDropout, CDropout from torch import Tensor from torch.nn import Module, functional as F from .ssm_cem import CemSSM from ..ssm_pytorch import utilities from ..utils import get_device, assert_shape class...
[ "torch.nn.functional.mse_loss", "torch.randn_like" ]
0.3.2
oscarkey/safe-exploration
32f0582a7b54ab7d4c1d415afbcf5e9554e8bcec
0.4
"""Trainining script for WaveNet vocoder usage: train.py [options] options: --dump-root=<dir> Directory contains preprocessed features. --checkpoint-dir=<dir> Directory where to save model checkpoints [default: checkpoints]. --hparams=<parmas> Hyper parameters [default: ]. -...
[ "torch.cuda.is_available", "torch.LongTensor", "torch.load", "torch.nn.CrossEntropyLoss", "torch.FloatTensor", "torch.nn.parallel.scatter", "torch.utils.data.DataLoader", "torch.tensor", "torch.device", "torch.zeros", "torch.nn.parallel.gather", "torch.cuda.device_count", "torch.nn.parallel....
0.4.1
bnelo12/wavenet_vocoder
68de8b8abf37fb3eec41817704f06c859925f7a5
1.10
# Copyright 2021 solo-learn development team. # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to use, # copy, modify, merge, publ...
[ "torch.nn.Linear", "torch.nn.functional.normalize", "torch.nn.Identity", "torch.zeros", "torch.max", "torch.no_grad", "torch.enable_grad", "torch.clamp", "torch.nn.ReLU", "torch.autograd.grad", "torch.nn.functional.cross_entropy", "torch.nn.functional.cosine_similarity", "torch.zeros_like", ...
1.10.0
pantheon5100/DeACL
32cf8182f2ef271fab7453bc5cc1ddea6dfa3c22
1.9
import torch import torch.nn as nn import argparse import numpy as np from torch.utils.data import DataLoader , Dataset import pandas as pd from tqdm import tqdm from transformers import ( BertTokenizer, AdamW , get_linear_schedule_with_warmup , T5Tokenizer, T5ForConditionalGeneration) devi...
[ "torch.cuda.is_available", "torch.tensor", "torch.utils.data.DataLoader" ]
1.9.0
abdouaziz/wolof-translation
505324f8a7c5a91a42e2c775495fc3bdebc8f761
1.7
# MIT License # Copyright (c) 2019 Sebastian Penhouet # GitHub project: https://github.com/Spenhouet/tensorboard-aggregator # ============================================================================== """Aggregates multiple tensorbaord runs""" # python scripts/aggregator.py -r result/CAModel-all-4e-nict-coref-ocz-...
[ "torch.utils.tensorboard.summary.Summary.Value", "torch.utils.tensorboard.FileWriter", "torch.utils.tensorboard.writer.Event" ]
1.7.1
nobu-g/cohesion-analysis
bf2e22c1aff51f96fd2aaef6359839646548c3be
1.4
import os import sys import torch import numpy as np from tqdm import tqdm from torch.utils.data import DataLoader from neat_eo.core import load_config, check_classes, check_channels from neat_eo.tiles import tiles_from_dir, tile_label_from_file, tiles_from_csv def add_parser(subparser, formatter_class): parser ...
[ "torch.utils.data.DataLoader" ]
1.4.0
hzitoun/neat-EO
3519f1b2a5b4eb6b1b8ec38bce0e722efb61a94b
1.3
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch_geometric.nn import GCNConv, GATConv from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.inits import glorot, uniform from torch_geometric.utils import softmax import math class HGTC...
[ "torch.nn.Linear", "torch.nn.functional.sigmoid", "torch.nn.Dropout", "torch.cos", "torch.zeros", "torch.nn.ModuleList", "torch.sin", "torch.arange", "torch.nn.functional.gelu", "torch.ones", "torch.Tensor", "torch.nn.Embedding" ]
1.3.0
zheng-da/pyHGT
b654495053c82edcc8a7e1e00b7873ac93e6e59d
1.0
import numpy as np import time import torch import torch.nn as nn def move_data_to_device(x, device): if 'float' in str(x.dtype): x = torch.Tensor(x) elif 'int' in str(x.dtype): x = torch.LongTensor(x) else: return x return x.to(device) def do_mixup(x, mixup_lambda): """...
[ "torch.rand", "torch.cat", "torch.no_grad", "torch.LongTensor", "torch.Tensor" ]
1.0.1
tontsam/audioset_tagging_cnn
223f0a92fb753a34ac145a64c6713ee497fbda0c
1.4
import pytest import torch from torchts.nn.loss import masked_mae_loss, mis_loss, quantile_loss @pytest.fixture def y_true(): data = [1, 2, 3] return torch.tensor(data) @pytest.fixture def y_pred(): data = [1.1, 1.9, 3.1] return torch.tensor(data) def test_masked_mae_loss(y_true, y_pred): """...
[ "torch.tensor" ]
1.4
JudyJin/torchTS
2856e1bae8be3b9fdc23dcc2e8339674f1558ba5
0.6
""" Lovasz-Softmax and Jaccard hinge loss in PyTorch Maxim Berman 2018 ESAT-PSI KU Leuven (MIT License) """ from __future__ import print_function, division from typing import Optional import torch import torch.nn.functional as F from torch.autograd import Variable from torch.nn.modules.loss import _Loss from .constan...
[ "torch.movedim", "torch.nn.functional.relu", "torch.sort", "torch.autograd.Variable" ]
0.6.3
MikePham05/segmentation_models.pytorch
f61acfedf5e5b122430abb71181126bf1a288a94
0.4
import pytest import torch import torch.nn import numpy as np import copy from memcnn.models.affine import AffineAdapterNaive, AffineAdapterSigmoid from memcnn import ReversibleBlock def set_seeds(seed): np.random.seed(seed) torch.manual_seed(seed) @pytest.mark.parametrize('coupling', ['additive', 'affine']...
[ "torch.zeros", "torch.rand", "torch.cat", "torch.nn.MSELoss", "torch.nn.BatchNorm2d", "torch.manual_seed", "torch.autograd.grad", "torch.nn.Conv2d", "torch.equal", "torch.exp", "torch.mean", "torch.chunk" ]
0.4.0
hzy5660251/memcnn
1293468e4ee4ed83fcf9da36940065bbe72dd54b
0.3
# python -m unittest -v test/torch_test.py import unittest from unittest import TestCase import random import syft as sy import numpy as np from syft.core.frameworks.torch import utils as torch_utils from syft.core.frameworks import encode from syft.core.frameworks.torch.tensor import _GeneralizedPointerTensor impo...
[ "torch.nn.Linear", "torch.cat", "torch.stack", "torch.ones", "torch.LongTensor", "torch.IntTensor", "torch.FloatTensor", "torch.ByteTensor", "torch.manual_seed", "torch.nn.functional.relu", "torch.ge", "torch.nn.functional.conv2d", "torch.equal", "torch.zeros", "torch.max", "torch.clam...
0.3.1
jjmachan/PySyft
41a525443881bfd94ccb488d7a24765c1778ac05
1.7
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # Copyright (c) Megvii Inc. All rights reserved. import math from loguru import logger import torch import torch.nn as nn import torch.nn.functional as F from yolox.utils import bboxes_iou, meshgrid from .losses import IOUloss from .network_blocks import BaseConv, DWCon...
[ "torch.zeros", "torch.cat", "torch.stack", "torch.cuda.amp.autocast", "torch.nn.ModuleList", "torch.min", "torch.arange", "torch.no_grad", "torch.nn.L1Loss", "torch.cuda.empty_cache", "torch.full", "torch.nn.BCEWithLogitsLoss", "torch.zeros_like", "torch.log", "torch.exp", "torch.topk"...
1.7
zhanglirong1999/YOLOX
8b96c9c954e773a68cb439506bedd3b80406cc7d
1.7
import os from options.train_options import TrainOptions from models import create_model from util.visualizer import save_images from util import html from PIL import Image import string import torch import torchvision import torchvision.transforms as transforms import coremltools as ct from util import util import ...
[ "torch.cat", "torch.no_grad", "torch.jit.trace" ]
1.7.1
zengxinzhy/colorization-pytorch
a41e61dfc0d99532728af3cbfd21efbdaf6086c5
1.7
from abc import ABC, abstractmethod from typing import Union, Sized, List, Tuple from copy import deepcopy import torch from torch import nn as nn from ..nn.linear import DenseLinear from ..nn.conv2d import DenseConv2d from .utils import collect_leaf_modules, is_parameterized class BaseModel(nn.Module, ABC): de...
[ "torch.no_grad", "torch._C._nn._parse_to" ]
1.7.1
jiangyuang/ModelPruningLibrary
9c8ba5a3c5d118f37768d5d42254711f48d88745
0.4
from easydict import EasyDict as edict from pathlib import Path import torch from torch.nn import CrossEntropyLoss def get_config(training=True): conf = edict() conf.data_path = Path('models/data') conf.work_path = Path('weights/') conf.model_path = conf.work_path / 'models' conf.log_path = conf.w...
[ "torch.cuda.is_available", "torch.nn.CrossEntropyLoss" ]
0.4.0
zakerifahimeh/FaceLib
bf8eadc26baf04907e3800ada02896ac7056080c
1.4
import torch from torchvision import datasets, transforms import numpy as np from os.path import join from .namers import attack_file_namer def tiny_imagenet(args): data_dir = join(args.directory, 'data') train_dir = join(data_dir, "original_datasets", "tiny-imagenet-200", "train") ...
[ "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.Tensor", "torch.utils.data.TensorDataset" ]
1.4.0
canbakiskan/sparse_coding_frontend
1f62b54824785aa441317ddab1baa3012f2fb401
1.4
from os.path import join import matplotlib.pyplot as plt import torch from ..models.resnet import ResNetWide from ..utils.read_datasets import cifar10 from ..utils.plot_settings import * from ..utils.get_modules import load_frontend import numpy as np from ..parameters import get_arguments args = get_arguments() devi...
[ "torch.device", "torch.norm" ]
1.4.0
canbakiskan/sparse_coding_frontend
1f62b54824785aa441317ddab1baa3012f2fb401
1.6
import logging import os import time from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data.dataset import Dataset from ...tokenization_roberta import RobertaTokenizer, RobertaTokenizerFast fr...
[ "torch.save", "torch.load" ]
1.6.0
jsteggink/trankit
61ef593999bfa29751990d0d4bcf259daed05db4
1.7
import torch import torch.nn as nn import torch.nn.functional as F from dmb.modeling.stereo.layers.basic_layers import conv_bn, conv_bn_relu, BasicBlock from dmb.modeling.stereo.layers.basic_layers import conv_in_relu, BasicBlock_IN class PSM_Encoder_Instance(nn.Module): """ Backbone proposed in PSMNet. A...
[ "torch.cat", "torch.nn.Sequential", "torch.nn.AvgPool2d", "torch.no_grad", "torch.nn.Conv2d" ]
1.7.1
jiaw-z/FCStereo
f76c3317e0951986b49a3bb794028a8ae067d410
1.9
#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################################ # # Copyright (c) 2019 Baidu.com, Inc. All Rights Reserved # ################################################################################ """ File: source/encoders/embedder.py """ import l...
[ "torch.nn.init.uniform_", "torch.tensor" ]
1.9
LinjianLi/Seq2Seq-PyTorch
671bd10ac1a2620fb4d5ceaacdff9c0e9f4738a2
0.3
""" Loss Utils. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch from . import geom_utils import numpy as np def mask_dt_loss(proj_verts, dist_transf): """ proj_verts: B x N x 2 (In normalized coordinate [-1, 1]) dist_transf...
[ "torch.cat", "torch.stack", "torch.gather", "torch.autograd.Variable", "torch.norm", "torch.unsqueeze", "torch.abs", "torch.zeros", "torch.max", "torch.log", "torch.nn.functional.normalize", "torch.nn.L1Loss", "torch.nn.functional.grid_sample", "torch.mean" ]
0.3.1
MayankR/cmr
6c898a5294954899334d430ec71e0a0692a0d99e
0.3
""" Mesh net model. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl import app from absl import flags import os import os.path as osp import numpy as np import torch import torchvision import torch.nn as nn from torch.autograd import Variable ...
[ "torch.nn.Linear", "torch.nn.functional.normalize", "torch.cat", "torch.nn.LeakyReLU", "torch.FloatTensor", "torch.nn.functional.log_softmax", "torch.ones", "torch.nn.functional.grid_sample", "torch.LongTensor", "torch.nn.functional.relu", "torch.Tensor", "torch.nn.functional.tanh" ]
0.3.1
MayankR/cmr
6c898a5294954899334d430ec71e0a0692a0d99e
1.5
import torch from torch import nn, einsum import torch.nn.functional as F import math from einops import rearrange, repeat from einops.layers.torch import Rearrange from siren.init import siren_uniform_ def sine_init(x): siren_uniform_(x, mode='fan_in', c=6) class Sine(nn.Module): def __init__(s...
[ "torch.zeros", "torch.nn.Linear", "torch.nn.Dropout", "torch.sin", "torch.nn.Parameter", "torch.nn.functional.linear", "torch.nn.GELU" ]
1.5.0
cankocagil/TT-SRN
83eb03a9393442e6b09aa736862b3a2d5bdcf5b6
1.1
from typing import List, Tuple, Any import numpy as np from collections import defaultdict from e2cnn.gspaces import * from e2cnn.nn import FieldType from e2cnn.nn import GeometricTensor from ..equivariant_module import EquivariantModule import torch from torch.nn import Parameter __all__ = ["GatedNonLinearit...
[ "torch.sigmoid", "torch.LongTensor", "torch.allclose", "torch.empty", "torch.randn" ]
1.1
steven-lang/e2cnn
48f49760766ec958b52d0dd7b02483886dfa2096
1.0
# coding=utf-8 # Copyright 2020 Google 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 by...
[ "torch.zeros_like", "torch.tensor" ]
1.0
suliuzh/transformers
f34372a9ff99f6bc8619ac83dc07f7afe6b92141
1.0
# coding=utf-8 # Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.cat", "torch.nn.MSELoss", "torch.arange", "torch.ones", "torch.nn.CrossEntropyLoss" ]
1.0
suliuzh/transformers
f34372a9ff99f6bc8619ac83dc07f7afe6b92141
1.0
# as due to their complexity multi-gpu tests could impact other tests, and to aid debug we have those in a separate module. import logging import os import sys from pathlib import Path import pytest import torch from transformers.testing_utils import TestCasePlus, require_torch_multigpu from .utils import load_json...
[ "torch.cuda.is_available" ]
1.0
suliuzh/transformers
f34372a9ff99f6bc8619ac83dc07f7afe6b92141
1.7
import torch import torch.nn as nn from time import time import numpy as np from models.pytorch_revgrad import RevGrad class DoubleConvBN(nn.Module): """(convolution => [BN] => ReLU) * 2""" def __init__(self, in_channels, out_channels, kernel_size, dropout): super().__init__() self.conv1 = n...
[ "torch.nn.Linear", "torch.cat", "torch.nn.Dropout", "torch.nn.MaxPool2d", "torch.nn.BatchNorm2d", "torch.nn.ConvTranspose2d", "torch.nn.Upsample", "torch.nn.Conv2d", "torch.nn.functional.softmax", "torch.nn.functional.pad" ]
1.7.0
neurips2021vat/Variance-Aware-Training
2dcd017ef06e81e299448bdd9da65fa682835127
1.7
import torch import torch.nn as nn from time import time import numpy as np class DoubleConvBN(nn.Module): """(convolution => [BN] => ReLU) * 2""" def __init__(self, in_channels, out_channels, kernel_size, dropout): super().__init__() self.conv1 = nn.Conv2d( in_channels, out_chan...
[ "torch.nn.Linear", "torch.cat", "torch.nn.Dropout", "torch.nn.MaxPool2d", "torch.nn.BatchNorm2d", "torch.nn.ConvTranspose2d", "torch.nn.Upsample", "torch.nn.Conv2d", "torch.nn.functional.pad", "torch.mean" ]
1.7.0
neurips2021vat/Variance-Aware-Training
2dcd017ef06e81e299448bdd9da65fa682835127
1.7
# basic libs import numpy as np import torch import cv2 import imutils # pytorch import torch from torch.utils.data import Dataset import albumentations as A # custom modules np.random.seed(42) class Dataset_train(Dataset): def __init__(self, volums_list, aug, n_classes, dataset): sel...
[ "torch.tensor" ]
1.7.0
neurips2021vat/Variance-Aware-Training
2dcd017ef06e81e299448bdd9da65fa682835127
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.isfinite" ]
1.4
simran2905/pytorch-lightning
024cf23c67fb92fabb2d238bd33d73b24aafa7a9
1.1
from typing import Tuple, Optional from torch import Tensor from torch.distributions import MultivariateNormal import numpy as np from torch.distributions.multivariate_normal import _batch_mv from torch.distributions.utils import _standard_normal def bmat_idx(*args) -> Tuple: """ Create indices for tensor a...
[ "torch.distributions.multivariate_normal._batch_mv", "torch.distributions.utils._standard_normal" ]
1.1
Suhwan-Dev/torch-kalman
f310c42e264d1642819e4c49a8b0212209a18a85
1.1
import torch from torch import Tensor from torch.nn import Parameter class Bounded: def __init__(self, lower: float, upper: float): self.lower = lower self.range = upper - lower self.parameter = Parameter(torch.randn(1)) def get_value(self) -> Tensor: return torch.sigmoid(self...
[ "torch.sigmoid", "torch.randn" ]
1.1
Suhwan-Dev/torch-kalman
f310c42e264d1642819e4c49a8b0212209a18a85
1.0
import json import logging import numpy as np import os import torch from ..utils.various import create_missing_folders, load_and_check logger = logging.getLogger(__name__) class Estimator: """ Abstract class for any ML estimator. Subclassed by ParameterizedRatioEstimator, DoubleParameterizedRatioEstimator...
[ "torch.save", "torch.tensor", "torch.load" ]
1.0.0
sbrass/madminer
df664344d1a43551ee9ecd91fe2dc0bccb4d529f
1.5
from __future__ import absolute_import from __future__ import division import cv2 import numpy as np import torch from PIL import Image, ImageOps def dortmund_distort(img, random_limits=(0.8, 1.1)): """ Creates an augmentation by computing a homography from three points in the image to three randomly gen...
[ "torch.from_numpy" ]
1.5.0
basbeu/PyLaia
d14458484b56622204b1730a7d53220c5d0f1bc1
1.8
"""Torch module for GCN.""" import torch import torch.nn as nn import torch.nn.functional as F from grb.utils.normalize import GCNAdjNorm class GCN(nn.Module): r""" Description ----------- Graph Convolutional Networks (`GCN <https://arxiv.org/abs/1609.02907>`__) Parameters ---------- in...
[ "torch.nn.Linear", "torch.zeros", "torch.nn.Dropout", "torch.nn.LayerNorm", "torch.nn.ModuleList", "torch.max", "torch.sum", "torch.nn.init.calculate_gain", "torch.nn.init.xavier_normal_", "torch.sparse.mm" ]
1.8.0
sigeisler/grb
c89e21076dc05d1edb87dfe2eff20c29ba6bd0c1
1.8
import dgl import torch.nn as nn import torch.nn.functional as F from dgl.nn.pytorch import GATConv from grb.utils.normalize import GCNAdjNorm class GAT(nn.Module): r""" Description ----------- Graph Attention Networks (`GAT <https://arxiv.org/abs/1710.10903>`__) Parameters ---------- i...
[ "torch.nn.Dropout", "torch.nn.LayerNorm", "torch.nn.ModuleList" ]
1.8.0
sigeisler/grb
c89e21076dc05d1edb87dfe2eff20c29ba6bd0c1
1.8
"""Torch module for APPNP.""" import torch import torch.nn as nn import torch.nn.functional as F from grb.utils.normalize import GCNAdjNorm class APPNP(nn.Module): r""" Description ----------- Approximated Personalized Propagation of Neural Predictions (`APPNP <https://arxiv.org/abs/1810.05997>`__) ...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.nn.LayerNorm", "torch.nn.ModuleList", "torch.sparse.FloatTensor", "torch.spmm" ]
1.8.0
sigeisler/grb
c89e21076dc05d1edb87dfe2eff20c29ba6bd0c1
1.10
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Sep 17 10:33:24 2021 @author: Jose Antonio """ #of the paper Towards Char... using GNNs import torch_geometric.nn as pyg_nn import torch import torch.nn as nn import torch.nn.functional as F from torch_scatter.composite import scatter_softmax class ...
[ "torch.nn.Linear", "torch.nn.functional.sigmoid", "torch.nn.Dropout", "torch.unsqueeze", "torch.nn.functional.relu" ]
1.10.1
Antolin1/DMG-Python
ba3942e13006e1a32f3fe9f1b29615311f667274
1.4
# AdamP # Copyright (c) 2020-present NAVER Corp. # MIT license import torch from torch.optim.optimizer import Optimizer import math class AdamP(Optimizer): """ Paper: "AdamP: Slowing Down the Slowdown for Momentum Optimizers on Scale-invariant Weights" Copied from https://github.com/clovaai...
[ "torch.zeros_like" ]
1.4.0
Rhcsky/KoSpeech
dbff78140d150dcc71d14d65f81c011847e9574d
1.4
# Copyright (c) 2021, Soohwan Kim. 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 appli...
[ "torch.no_grad", "torch.cat", "torch.LongTensor", "torch.stack" ]
1.4.0
Rhcsky/KoSpeech
dbff78140d150dcc71d14d65f81c011847e9574d
1.9
# %% [markdown] # ## Text Classification with LM-BFF. # In this tutorial, we do sentiment analysis with automatic template and verbalizer generation. We use SST-2 as an example. # %% [markdown] # ### 1. load dataset # %% # import argparse # parser = argparse.ArgumentParser("") # parser.add_argument("--lr", type=float...
[ "torch.no_grad", "torch.argmax", "torch.nn.CrossEntropyLoss" ]
1.9.0
creativeautomaton/OpenPrompt
bd9ea544ab144d94af32d245101ba35c9d5a5a65
1.10
from utilities.utils import build_windowed_data from utilities.utils import load_h5_df_train_test_dataset, get_data, cast_sleep_stages from sleep_stage_config import * from sklearn.model_selection import train_test_split import torch from torch.utils.data import Dataset, DataLoader import pandas as pd import numpy as ...
[ "torch.from_numpy", "torch.cuda.is_available" ]
1.10.2
bzhai/Ubi-SleepNet
27837827dec608d06659421d073872fb1f68453e
1.1
import torch import torch.nn as nn import spconv from spconv.modules import SparseModule from collections import OrderedDict class ResidualBlock(SparseModule): def __init__(self, in_channels, out_channels, norm_fn, indice_key=None): super().__init__() if in_channels == out_channels: s...
[ "torch.nn.ReLU", "torch.cat", "torch.nn.Identity" ]
1.1
thangvubk/SphereRPN
9b154256774437bb23d81e22990d350555d39b81
1.7
import os import torch from collections import OrderedDict import glob class Saver(object): def __init__(self, args): self.args = args self.directory = os.path.join('run', args.train_dataset, args.checkname) self.runs = sorted(glob.glob(os.path.join(self.directory, 'experiment_*'))) ...
[ "torch.save" ]
1.7.0
dumpmemory/Transformer-Explainability
951e112d24c1a642ceefeb0dd03a607040305383
1.4
# --------------------------------------------------------------- # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the NVIDIA Source Code License # for OSCAR. To view a copy of this license, see the LICENSE file. # -----------------------------------------------------------...
[ "torch.zeros", "torch.arange" ]
1.4.0
NVlabs/oscar
df778a4173a118f10627cb2ef4021c26303231fc
1.0
import os import subprocess import sys import torch from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CUDA_HOME # ninja build does not work unless include_dirs are abs path this_dir = os.path.dirname(os.path.abspath(__file__)) def get_cuda_bare_metal_ve...
[ "torch.cuda.is_available", "torch.utils.cpp_extension.CUDAExtension", "torch.__version__.split", "torch.version.cuda.split" ]
1.0
DevinCheung/ColossalAI
632e622de818697f9949e35117c0432d88f62c87
1.0
#!/usr/bin/env python # -*- encoding: utf-8 -*- import math import numbers import torch import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init from torch import Tensor from torch.nn.parameter import Parameter from typing import Tuple import importlib from c...
[ "torch.Size", "torch.no_grad", "torch.nn.init.ones_", "torch.nn.functional.linear", "torch.nn.init.normal_", "torch.nn.init.calculate_gain", "torch.nn.init.uniform_", "torch.nn.init.zeros_", "torch.empty", "torch.Tensor" ]
1.0
DevinCheung/ColossalAI
632e622de818697f9949e35117c0432d88f62c87
1.0
import torch def get_test_devices(): """Creates a string list with the devices type to test the source code. CUDA devices will be test only in case the current hardware supports it. Return: list(str): list with devices names. """ devices = ["cpu"] if torch.cuda.is_available(): ...
[ "torch.cuda.is_available" ]
1.0.0
kajal-puri/torchgeometry
36c4992d5f741a65a1f558266c588e37c24462da
1.6
from typing import Optional from typing import Type import torch from scipy.sparse import coo_matrix from .indexing import SizeType from .indexing import unroll_index def torch_coo_to_scipy_coo(m: torch.sparse.FloatTensor) -> coo_matrix: """Convert torch :class:`torch.sparse.FloatTensor` tensor to. :class:...
[ "torch.cat", "torch.is_tensor", "torch.repeat_interleave", "torch.tensor", "torch.sparse_coo_tensor", "torch.zeros_like" ]
1.6.0
jvrana/caldera
a346324e77f20739e00a82f97530dda4906f59dd
1.6
"""test_train_networks.py. Inststructions for creating a new test case. loader, getter, network """ import functools from collections import OrderedDict from contextlib import contextmanager from typing import Any from typing import Callable from typing import Dict from typing import Optional from typing import Tuple...
[ "torch.zeros", "torch.nn.Linear", "torch.nn.MSELoss", "torch.no_grad", "torch.nn.ReLU", "torch.tensor" ]
1.6.0
jvrana/caldera
a346324e77f20739e00a82f97530dda4906f59dd
1.8
""" single channel speech enhancement for wind noise reduction. refer to "A Convolutional Recurrent Neural Network for Real-Time Speech Enhancement" . Authors * Wang Wei 2021 """ import torch import torch.nn as nn class CNN_Block(torch.nn.Module): def __init__(self, in_channels, out_channels...
[ "torch.zeros", "torch.rand", "torch.cat", "torch.nn.ModuleList", "torch.nn.BatchNorm2d", "torch.nn.ConvTranspose2d", "torch.nn.Conv2d", "torch.nn.RNN", "torch.nn.ELU" ]
1.8.0
wangwei2009/speechbrain
ebbac4561a9c9101786e0ab0b1105017eb655fc8
1.8
import torch import torch.nn as nn import os import sys # from show import show_params, show_model import torch.nn.functional as F from .conv_stft import ConvSTFT, ConviSTFT from .complexnn import ComplexConv2d, ComplexConvTranspose2d, NavieComplexLSTM, complex_cat, ComplexBatchNorm class DCCRN(nn.Module): de...
[ "torch.nn.Linear", "torch.cat", "torch.stack", "torch.nn.LSTM", "torch.nn.ModuleList", "torch.nn.BatchNorm2d", "torch.log10", "torch.squeeze", "torch.nn.functional.pad", "torch.reshape", "torch.sum", "torch.sqrt", "torch.manual_seed", "torch.abs", "torch.cos", "torch.nn.Sequential", ...
1.8.0
wangwei2009/speechbrain
ebbac4561a9c9101786e0ab0b1105017eb655fc8
1.3
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
[ "torch.manual_seed", "torch.rand", "torch.randint", "torch.tensor" ]
1.3.1
alanhdu/metrics
b168272eaf1ff08b9447e75338753f9c2abf0859
1.3
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
[ "torch.cat" ]
1.3.1
alanhdu/metrics
b168272eaf1ff08b9447e75338753f9c2abf0859
1.0
import dataclasses import json import os import warnings from dataclasses import dataclass, field from enum import Enum from typing import Any, Dict, List, Optional, Tuple from .file_utils import cached_property, is_torch_available, is_torch_tpu_available, torch_required from .trainer_utils import EvaluationStrategy f...
[ "torch.device", "torch.distributed.init_process_group", "torch.cuda.device_count", "torch.cuda.set_device", "torch.cuda.is_available" ]
1.0
xiye17/transformers
924989e70d9425e3276ca76f148a0fcd4bbd58cf
1.10
import argparse import random from copy import deepcopy import torch import torch.backends from torch import optim from torch.hub import load_state_dict_from_url from torch.nn import CrossEntropyLoss from torchvision import datasets from torchvision.models import vgg16 from torchvision.transforms import transforms fro...
[ "torch.manual_seed", "torch.cuda.is_available", "torch.nn.CrossEntropyLoss", "torch.hub.load_state_dict_from_url" ]
1.10.0
llv22/baal_tf2.4_mac
6eed225f8b57e61d8d16b1868ea655384c566700
1.9
import pytest import torch import torch.nn.functional as F from lean_transformer.utils import pad_to_multiple, GELU import numpy as np @pytest.mark.forked def test_pad_to_multiple(): x = torch.randn(3, 3) assert pad_to_multiple(x, multiple=3, dims=0) is x assert pad_to_multiple(x, multiple=3, dims=1) is ...
[ "torch.linspace", "torch.randn" ]
1.9.0
krunt/lean_transformer
90abdb87bb08566eaba0a45bc29ec6a3220333ac
1.3
import torch.nn as nn from utils.builder import get_builder from args import args from collections import OrderedDict # Binary activation function with gradient estimator import torch class F_BinAct(torch.autograd.Function): @staticmethod def forward(ctx, inp): # Save input for backward ctx.save_for_bac...
[ "torch.nn.Linear", "torch.nn.MaxPool2d", "torch.nn.Sequential", "torch.nn.BatchNorm2d", "torch.clamp", "torch.sign", "torch.abs", "torch.nn.Conv2d", "torch.nn.AdaptiveAvgPool2d" ]
1.3.0
zhanzheng8585/biprop
ce6a364c8323f102bd41ebb332e1e841ec78c79d
1.1
import math import torch from torch.optim.optimizer import Optimizer from .types import Betas2, OptFloat, OptLossClosure, Params __all__ = ('AdaMod',) class AdaMod(Optimizer): r"""Implements AccSGD algorithm. It has been proposed in `Adaptive and Momental Bounds for Adaptive Learning Rate Methods`__. ...
[ "torch.zeros_like", "torch.min", "torch.full_like" ]
1.1.0
tkon3/pytorch-optimizer
e5578453b79143331c30fd76b08721b45dce86d3
1.7
""" Implement torch iterable dataset - build vocab ordered by freq for """ from tqdm import tqdm import torch import torch.utils.data from torch.utils.data.dataloader import DataLoader import os import sys import pickle5 as pickle #import pickle import math from collections import defaultdict SPLITS = ['train', 'v...
[ "torch.cat", "torch.utils.data.get_worker_info", "torch.tensor" ]
1.7.1
SimengSun/revisit-nplm
bbe1cdaecf1d7d104d27b1035a591ebbd3b5141e
1.4
import math import os import random import torch import torch.utils.data import numpy as np from librosa.core import load from librosa.util import normalize from librosa.filters import mel as librosa_mel_fn MAX_WAV_VALUE = 32768.0 def load_wav(full_path, sampling_rate=None): if os.path.splitext(full_path)[1] != ...
[ "torch.min", "torch.max", "torch.hann_window", "torch.FloatTensor", "torch.clamp", "torch.from_numpy", "torch.exp" ]
1.4.0
Hiroshiba/hifi-gan
17601a07573309ee305c58bf87a041f267b1c0c8
1.6
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. # Copyright 2020 Petuum, Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without...
[ "torch.distributed.get_world_size", "torch.autograd.Variable._execution_engine.queue_callback", "torch.distributed.is_initialized", "torch.distributed.all_reduce" ]
1.6.0
ncilfone/fairscale
b434b7354898febf718f23c7ff21368a6e0bbe1a
1.6
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. # pylint: disable=missing-module-docstring # pylint: disable=missing-class-docstring # pylint: disable=missing-function-d...
[ "torch.nn.Linear", "torch.rand", "torch.cuda.is_available" ]
1.6.0
ncilfone/fairscale
b434b7354898febf718f23c7ff21368a6e0bbe1a
1.1
import pickle import numpy as np import torch from detection.src.yolov3.utils.datasets import ListDataset class DetectionSetDataManager(): """ Data Manager used for YOLOMAML """ def __init__(self, n_way, n_support, n_query, n_episode, image_size): """ Args: n_way (int): ...
[ "torch.utils.data.DataLoader", "torch.tensor" ]
1.1.0
artificially-ai/FewShotVision
909bc414ea27ef0300091e1dd6baba4fb063324b
1.7
#!/usr/bin/env python # -*- coding:utf-8 -*- """ @author: romanshen @file: distributions.py @time: 2021/05/07 @contact: xiangqing.shen@njust.edu.cn """ import torch # Priors def gaussian_prior(name, log2pi, mu, sigma, device): """ Args: *args: {"mu": , "sigma":, "log2pi"} Returns: log_gaussi...
[ "torch.cuda.is_available", "torch.tensor", "torch.log", "torch.randn", "torch.sum" ]
1.7.1
RomanShen/radial-bnn
7c8bc85397c1461a6fd5ea9adf0631f9ade27f6c
1.1
from __future__ import division import torch import torch.nn as nn from .base import BaseDetector from .test_mixins import RPNTestMixin from .. import builder from ..registry import DETECTORS from mmdet.core import (build_assigner, bbox2roi, bbox2result, build_sampler, merge_aug_masks) @DETE...
[ "torch.zeros", "torch.cat", "torch.nn.ModuleList", "torch.no_grad", "torch.ones" ]
1.1
WangY0906/mmdetection-for-study
c89703006a2a5250f4d1c71e0aad958d72526885
1.4
import torch import torch.nn as nn import torch.nn.functional as F import hdvw.models.layers as layers import hdvw.models.gates as gates class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_channels, channels, stride=1, groups=1, width_per_group=64, rate=0.3, sd=0.0, ...
[ "torch.nn.Sequential", "torch.nn.functional.dropout", "torch.nn.Identity" ]
1.4
shaoshitong/hdvw
fbb39da9ad8a765f74225eec7e9614978c740dde
1.6
import torch import numpy as np import math def bbox_iou(box1, box2, x1y1x2y2=True, GIoU=False, DIoU=False, CIoU=False, eps=1e-9): # Returns the IoU of box1 to box2. box1 is 4, box2 is nx4 box2 = box2.T # 4xn # Get the coordinates of bounding boxes if x1y1x2y2: # x1, y1, x2, y2 = box1 ...
[ "torch.min", "torch.max", "torch.no_grad", "torch.atan", "torch.tensor" ]
1.6.0
cheind/pytorch-blender-dr
fd2e449dd81723bb1978f005736104f27cc1770b
1.3
import os import pytest import torch import torch.distributed as dist import ignite.distributed as idist from ignite.distributed.utils import has_native_dist_support from tests.ignite.distributed.utils import ( _test_distrib_all_gather, _test_distrib_all_reduce, _test_distrib_barrier, _test_distrib_br...
[ "torch.distributed.get_world_size", "torch.distributed.get_rank", "torch.cuda.is_available", "torch.cuda.device_count" ]
1.3
jkhenning/ignite
2485fd42c6ef4d3e97fd606a52f8c6e5d940357e
1.3
import numbers from typing import Callable, Optional, Sequence, Tuple, Union import torch from ignite.exceptions import NotComputableError from ignite.metrics.metric import Metric, reinit__is_reduced, sync_all_reduce from ignite.metrics.metrics_lambda import MetricsLambda __all__ = ["ConfusionMatrix", "mIoU", "IoU",...
[ "torch.zeros", "torch.device", "torch.bincount", "torch.argmax" ]
1.3
jkhenning/ignite
2485fd42c6ef4d3e97fd606a52f8c6e5d940357e
1.5
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors, The HuggingFace Inc. Team and deepset 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 m...
[ "torch.stack", "torch.from_numpy", "torch.nn.BatchNorm1d", "torch.mean" ]
1.5.0
bvanaken/FARM
09767092457e73860c3a604b5060562c2004f03d
1.4
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 r""" The pyro.infer.autoguide.initialization module contains initialization functions for automatic guides. The standard interface for initialization is a function that inputs a Pyro trace ``site`` dict and returns an appropriatel...
[ "torch.no_grad", "torch.distributions.transform_to" ]
1.4.0
ludkinm/pyro
d24c808a9d86d79c43a99990fe9e418ce5976613
1.4
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ An example to use Pyro Gaussian Process module to classify MNIST and binary MNIST. Follow the idea from reference [1], we will combine a convolutional neural network (CNN) with a RBF kernel to create a "deep" kernel: >>> ...
[ "torch.nn.Linear", "torch.Size", "torch.cat", "torch.no_grad", "torch.ones", "torch.nn.Conv2d" ]
1.4.0
ludkinm/pyro
d24c808a9d86d79c43a99990fe9e418ce5976613
1.4
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import argparse import torch from torch.distributions import constraints import pyro import pyro.distributions as dist from pyro.contrib.autoname import named from pyro.infer import SVI, JitTrace_ELBO, Trace_ELBO from pyro.optim ...
[ "torch.zeros", "torch.tensor", "torch.ones" ]
1.4.0
ludkinm/pyro
d24c808a9d86d79c43a99990fe9e418ce5976613
1.8
import torch import torch.nn as nn class MNIST(nn.Module): def __init__(self): super(MNIST, self).__init__() self.shared_encoder = torch.nn.Sequential( nn.Conv2d(in_channels=1, out_channels=32, kernel_size=5, padding=2), nn.ReLU(inplace=True), nn.MaxPo...
[ "torch.nn.Linear", "torch.rand", "torch.cat", "torch.nn.MaxPool2d", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.nn.Flatten" ]
1.8.1
tdye24/LightningFL
48bb4a452082411e051cdb3a2e98ede6bbc91bbf
1.7
import torch def rel_positions_grid(grid_sizes): """Generates a flattened grid of (x,y,...) coordinates in a range of -1 to 1. sidelen: int dim: int """ tensors = [] for size in grid_sizes: tensors.append(torch.linspace(-1, 1, steps=size)) # tensors = tuple(dim * [torch.linspace(-1...
[ "torch.meshgrid", "torch.linspace" ]
1.7.1
boczekbartek/flexconv
610b5be3a846bcc1436275daaad89482b6b8e7cc