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 torch import matplotlib.image as img import cv2 import dlib from imutils.face_utils import * import numpy as np # image = img.imread("extra//test.jpg") # image = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR) # opencvImage dlib_path = 'extra//shape_predictor_68_face_landmarks.dat' def get_fac...
[ "torch.tensor", "torch.max" ]
1.10.1
Leyan529/ImageClassificationPL
a4be75f4525828100d8d278e46ff5dccd829af1a
1.9
from kivymd.app import MDApp from kivy.uix.widget import Widget from kivy.uix.actionbar import ActionBar from kivy.uix.scrollview import ScrollView from kivy.uix.boxlayout import BoxLayout from kivymd.theming import ThemableBehavior from kivymd.uix.list import OneLineListItem, MDList, TwoLineListItem, ThreeLineListItem...
[ "torch.nn.CrossEntropyLoss" ]
1.9.0
tusharsarkar3/XBNet
01e385f1c0a446eb38f4dd59ee9c510170bf096b
0.4
import json import os import numpy as np import torch from zerogercrnn.lib.constants import EMPTY_TOKEN_ID, UNKNOWN_TOKEN_ID from zerogercrnn.experiments.ast_level.utils import read_non_terminals from zerogercrnn.lib.constants import EMPTY_TOKEN_ID, UNKNOWN_TOKEN_ID, EOF_TOKEN from zerogercrnn.lib.metrics import Metr...
[ "torch.nonzero", "torch.max", "torch.index_select", "torch.argmax", "torch.sum" ]
0.4.0
zerogerc/rnn-autocomplete
39dc8dd7c431cb8ac9e15016388ec823771388e4
1.1
from _warnings import warn import matplotlib from batchgenerators.utilities.file_and_folder_operations import * from sklearn.model_selection import KFold matplotlib.use("agg") from time import time, sleep import torch import numpy as np from torch.optim import lr_scheduler import matplotlib.pyplot as plt import sys fro...
[ "torch.cuda.manual_seed_all", "torch.save", "torch.no_grad", "torch.manual_seed", "torch.cuda.empty_cache", "torch.cuda.current_device", "torch.from_numpy" ]
1.1.0
mangoyuan/Unifed-Seg3d
74c82464dbe901cf18e38afb0e1b74cc159a8850
1.1
# Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
[ "torch.cuda.empty_cache" ]
1.1.0
mangoyuan/Unifed-Seg3d
74c82464dbe901cf18e38afb0e1b74cc159a8850
1.6
# Copyright (c) MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, so...
[ "torch.zeros", "torch.linspace", "torch.linalg.solve", "torch.eye", "torch.as_tensor", "torch.ones_like", "torch.solve", "torch.flip" ]
1.6
Jianrong-Lu/MONAI
c319ca8ff31aa980a045f1b913fb2eb22aadb080
1.1
import time import datetime import random import sys import logging from pathlib import Path from typing import Union from torch import cuda from torch.utils.data import Dataset, DataLoader from torch.optim.sgd import SGD try: from apex import amp except ImportError: amp = None import flair from flair.data imp...
[ "torch.cuda.is_available", "torch.utils.data.DataLoader" ]
1.1.0
azawalich/flair
f0101ab25381aefa586ecb688d4f412d5fab5de3
1.8
# -*- coding: utf-8 -*- """ Model definition functions and weight loading. """ from __future__ import print_function, division, unicode_literals from os.path import exists import torch import torch.nn as nn from torch.autograd import Variable from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence, ...
[ "torch.nn.utils.rnn.PackedSequence", "torch.nn.Linear", "torch.cat", "torch.nn.Dropout", "torch.nn.init.orthogonal", "torch.nn.init.constant", "torch.nn.Softmax", "torch.nn.init.xavier_uniform", "torch.autograd.Variable", "torch.nn.init.uniform", "torch.nn.Tanh", "torch.nn.Sigmoid", "torch.n...
1.8.2
UmaTaru/run
be29e4d41a4de3dee27cd6796801bfe51382d294
1.8
import torch from ..function import Function, InplaceFunction # TODO: no need to save all args if the grad w.r.t. some of them is not needed def _get_output(ctx, arg, inplace=False): if inplace: ctx.mark_dirty(arg) return arg else: return arg.new().resize_as_(arg) class Addmm(Inplac...
[ "torch.mv", "torch.addr", "torch.addmv", "torch.baddbmm", "torch.addbmm", "torch.addmm", "torch.ger" ]
1.8.2
UmaTaru/run
be29e4d41a4de3dee27cd6796801bfe51382d294
1.8
import torch from .Criterion import Criterion # TODO: use THNN class BCECriterion(Criterion): eps = 1e-12 def __init__(self, weights=None, sizeAverage=True): if weights is not None and weights.dim() != 1: raise ValueError("weights input should be 1D Tensor") super(BCECriterion, ...
[ "torch.mul", "torch.add", "torch.dot", "torch.sum" ]
1.8.2
UmaTaru/run
be29e4d41a4de3dee27cd6796801bfe51382d294
1.8
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ ParlAI has limited support for using models from `Fairseq <https://github.com/pytorch/fairseq>`_. Fairseq often supp...
[ "torch.manual_seed", "torch.cuda.get_device_capability" ]
1.8.2
UmaTaru/run
be29e4d41a4de3dee27cd6796801bfe51382d294
1.0
""" Utilities for working with the local dataset cache. This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp Copyright by the AllenNLP authors. """ from __future__ import absolute_import, division, print_function, unicode_literals import fnmatch import json import logging import os imp...
[ "torch.hub._get_torch_home" ]
1.0.1
cregouby/FARM
552bc07acffbce4f1f84d926c040fdd17b4ddeb3
1.6
from typing import Dict from alnlp.modules.feedforward import FeedForward from alnlp.modules.time_distributed import TimeDistributed from .highway_variational_lstm import * import torch from alnlp.modules import util from ...parsers.biaffine.biaffine import Biaffine def initializer_1d(input_tensor, initializer): ...
[ "torch.zeros", "torch.Size", "torch.cat", "torch.stack", "torch.arange", "torch.gather", "torch.max", "torch.clamp", "torch.ones", "torch.nn.functional.cross_entropy", "torch.zeros_like", "torch.mean", "torch.cumsum" ]
1.6.0
emorynlp/stem-cell-hypothesis
48a628093d93d653865fbac6409d179cddd99293
1.8
# Copyright (c) Aishwarya Kamath & Nicolas Carion. Licensed under the Apache License 2.0. All Rights Reserved # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Utilities for bounding box manipulation and GIoU. """ import torch import numpy as np from torchvision.ops.boxes import box_area from t...
[ "torch.zeros", "torch.stack", "torch.min", "torch.arange", "torch.max", "torch.meshgrid" ]
1.8.1
antoyang/TubeDETR
3c32cc92a0fdaa0c770d95a59d8764e0e212424c
1.10
# -*- coding: utf-8 -*- """ @date: 2020/11/21 下午4:16 @file: test_resnest.py @author: zj @description: """ import torch from zcls.config import cfg from zcls.config.key_word import KEY_OUTPUT from zcls.model.recognizers.resnet.resnet import ResNet def test_data(model, input_shape, output_shape): data = torch.r...
[ "torch.randn" ]
1.10.0
ZJCV/PyCls
1ef59301646b6134f2ffcc009b4fd76550fa4089
1.1
# Modified by Microsoft Corporation. # Licensed under the MIT license. import logging import torch import torch.utils.data as data from torch.autograd import Variable from utils.config import * from utils.until_temp import entityList def hasNumbers(inputString): return any(char.isdigit() for char in inputString...
[ "torch.autograd.Variable", "torch.Tensor", "torch.utils.data.DataLoader" ]
1.1.0
ngduyanhece/ConvLab
a04582a77537c1a706fbf64715baa9ad0be1301a
1.1
import torch as th import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from convlab.modules.word_policy.multiwoz.larl.latent_dialog.base_models import BaseModel from convlab.modules.word_policy.multiwoz.larl.latent_dialog.corpora import SYS, EOS, PAD, BOS from convlab.modules.word_...
[ "torch.nn.Linear", "torch.zeros", "torch.nn.Dropout", "torch.cat", "torch.nn.Tanh", "torch.pow", "torch.nn.functional.log_softmax", "torch.ones", "torch.multinomial", "torch.mm", "torch.eye", "torch.t", "torch.nn.functional.softmax", "torch.transpose", "torch.exp", "torch.mean", "tor...
1.1.0
ngduyanhece/ConvLab
a04582a77537c1a706fbf64715baa9ad0be1301a
1.3
import torch import torch.nn as nn from torch.distributions.categorical import Categorical from torch.optim import Adam import numpy as np import gym from gym.spaces import Discrete, Box from spinup.examples.pytorch.broil_rtg_pg_v2.cvar_utils import cvar_enumerate_pg from spinup.examples.pytorch.broil_rtg_pg_v2.cartpo...
[ "torch.nn.Linear", "torch.nn.Sequential", "torch.distributions.categorical.Categorical", "torch.as_tensor" ]
1.3.1
jerryzhucs21/spinningup
2992e6a8163d78c3f82a3d92c5235fda0527c398
1.6
import numpy as np import torch from torch.utils import data import sys from utils.generate_dataset import * from HypHC.datasets.triples import samples_triples class HyperLoader(data.Dataset): def __init__(self, data_dir, split_indices, restrict_labels=[0,1,2,3,4,5,6], chromosome="all"): ''' Takes ...
[ "torch.tensor" ]
1.6.0
AI-sandbox/hyperLAI
49f1a9d3c645ee0e5b0c2ed16d54ee8df0626689
0.4
import torch from torch import nn import torch.nn.functional as F from torch.autograd import Variable import numpy as np import math from sequicity.config import global_config as cfg import copy, random, time, logging from torch.distributions import Categorical from sequicity.reader import pad_sequences ...
[ "torch.nn.Linear", "torch.cat", "torch.distributions.Categorical", "torch.stack", "torch.nn.GRU", "torch.isnan", "torch.bmm", "torch.ones", "torch.LongTensor", "torch.nn.utils.rnn.pack_padded_sequence", "torch.exp", "torch.topk", "torch.autograd.Variable", "torch.FloatTensor", "torch.nn....
0.4.1
qbetterk/user-simulator
77caca30ff67b9112b1fe5e65e191c6b5e25532c
1.7
# -*- coding: utf-8 -*- ''' Author: TJUZQC Date: 2020-10-26 10:26:51 LastEditors: TJUZQC LastEditTime: 2020-11-20 19:23:55 Description: None ''' import argparse import logging import os import sys import numpy as np import torch import torch.nn as nn import yaml from torch import optim from torch.utils.data import Dat...
[ "torch.sigmoid", "torch.utils.tensorboard.SummaryWriter", "torch.utils.data.random_split", "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.nn.BCEWithLogitsLoss", "torch.load", "torch.nn.CrossEntropyLoss" ]
1.7.0
QinchengZhang/PathologySegmentation
7a2c21346739a79c33e7a7ccc081018821868eb7
1.5
import torch from torchvision import datasets, transforms import os transform = { "train": transforms.Compose( [ transforms.RandomResizedCrop(224), transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize( [0.4914, 0.4821...
[ "torch.utils.data.DataLoader" ]
1.5.1
1chimaruGin/Oject_classifier
d27ca8f47d2d0af107582c25a0756dda15361c2e
1.0
# Copyright (c) 2018, Curious AI Ltd. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Mountain View...
[ "torch.nn.functional.log_softmax", "torch.nn.functional.mse_loss", "torch.nn.functional.kl_div", "torch.nn.functional.softmax", "torch.sum" ]
1.0.0
Shuai-Xie/LP-DeepSSL
9389c6cb0b83c7ca509ce284c4d86b600ca44a9b
1.0
from typing import Union import torch from torch import nn from ..composition import AdapterCompositionBlock, parse_composition from ..model_mixin import InvertibleAdaptersMixin, ModelAdaptersMixin from .bert import BertEncoderAdaptersMixin, BertModelHeadsMixin, BertOutputAdaptersMixin, BertSelfOutputAdaptersMixin ...
[ "torch.zeros" ]
1.0
uunal/adapter-transformers
73a95a75f803e8fd243fc3d55ff3a9d557891377
1.4
import torch from .eval_reid import eval_func def euclidean_dist(x, y): m, n = x.size(0), y.size(0) xx = torch.pow(x, 2).sum(1, keepdim=True).expand(m, n) yy = torch.pow(y, 2).sum(1, keepdim=True).expand(n, m).t() dist = xx + yy dist.addmm_(1, -2, x, y.t()) dist = dist.clamp(min=1e-12).sqrt()...
[ "torch.pow" ]
1.4.0
beesk135/ReID-Survey
d1467c0ce5d3ca78640196360a05df9ff9f9f42a
1.9
# Run MIL classification use pretrained CNN models # Reference: 1.Campanella, G. et al. Clinical-grade computational pathology using weakly supervised # deep learning on whole slide images. Nat Med 25, 1301–1309 (2019). # doi:10.1038/s41591-019-0508-1. Available from http://www.nature.com/articles...
[ "torch.no_grad", "torch.nn.CrossEntropyLoss", "torch.utils.data.DataLoader", "torch.Tensor", "torch.utils.tensorboard.SummaryWriter" ]
1.9.0
Gaskell-1206/MSI_vs_MSS_Classification
be6fd8a6961624367b2bb0e1299219e940f6f418
1.4
""" COCO transforms (quick and dirty) Hacked together by Ross Wightman """ import torch from PIL import Image import numpy as np import random import math IMAGENET_DEFAULT_MEAN = (0.485, 0.456, 0.406) IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225) IMAGENET_INCEPTION_MEAN = (0.5, 0.5, 0.5) IMAGENET_INCEPTION_STD = (0.5,...
[ "torch.from_numpy" ]
1.4.0
saikrishna-pallerla/efficientdet-pytorch
dc7b790f537d28476a26af6f793acc4757becd0d
1.8
# Standard Library import json import os import shutil # Import from third library import torch # Import from local from .log_helper import default_logger as logger from .registry_factory import SAVER_REGISTRY __all__ = ['Saver'] @SAVER_REGISTRY.register('base') class Saver(object): def __init__(self, save_cf...
[ "torch.save", "torch.cuda.current_device" ]
1.8.1
scott-mao/EOD
f10e64de86c0f356ebf5c7e923f4042eec4207b1
1.8
# Standard Library import math from collections import defaultdict # Import from third library import numpy as np import torch from torch.utils.data.sampler import Sampler from eod.utils.env.dist_helper import env, get_rank, get_world_size from eod.utils.general.log_helper import default_logger as logger from eod.uti...
[ "torch.Generator", "torch.randperm" ]
1.8.1
scott-mao/EOD
f10e64de86c0f356ebf5c7e923f4042eec4207b1
0.0
from typing import Dict import dgl import dgl.function as fn # for graphs import numpy as np import torch import torch.nn as nn from dgl.nn.pytorch.glob import AvgPooling, MaxPooling from dgl.nn.pytorch.softmax import edge_softmax from einops import rearrange from packaging import version from torch import Tensor, ei...
[ "torch.nn.Linear", "torch.cat", "torch.stack", "torch.nn.ModuleList", "torch.einsum", "torch.nn.ModuleDict", "torch.ones", "torch.sum", "torch.nn.LayerNorm", "torch.FloatTensor", "torch.nn.init.normal_", "torch.nn.init.calculate_gain", "torch.nn.init.zeros_", "torch.nn.ParameterDict", "t...
0.0.24
amorehead/Equivariant-GNNs
4e81136242a4c8905b0e5fc39be5f704a42cc5e1
1.5
# Copyright 2020 - 2021 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in wri...
[ "torch.tensor" ]
1.5
dylanbuchi/MONAI
1651f1b003b0ffae8b615d191952ad65ad091277
1.5
# Copyright 2020 - 2021 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in wri...
[ "torch.randint" ]
1.5
dylanbuchi/MONAI
1651f1b003b0ffae8b615d191952ad65ad091277
1.5
# Copyright 2020 - 2021 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in wri...
[ "torch.device", "torch.autograd.gradcheck" ]
1.5
dylanbuchi/MONAI
1651f1b003b0ffae8b615d191952ad65ad091277
1.7
import copy from pathlib import Path from typing import Dict, List, Optional, Union import torch from pytorch_lightning.metrics import Accuracy from torch import Tensor, optim from torch.utils import data import pytorch_lightning as pl from pytorch_lightning.loggers import LightningLoggerBase from pytorch_lightning.c...
[ "torch.is_tensor", "torch.cuda.is_available" ]
1.7.1
iwan933/mlmi-federated-learning
e148664304dd7fbbc2cc2a6a34567533748c1720
1.5
# -*- coding: utf-8 -*- # MIT License # # Copyright 2018-2021 New York University Abu Dhabi # # 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 limitatio...
[ "torch.nn.CrossEntropyLoss" ]
1.5.1
CAMeL-Lab/CAMeLBERT_morphosyntactic_tagger
5bea542c2e731d263281d0ab16ba9c065f602f94
1.1
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2020 Nagoya University (Wen-Chin Huang) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Voice Transformer Network (Transformer-VC) related modules.""" import logging import torch import torch.nn.functional as F from espnet.nets.pytorch_backe...
[ "torch.nn.Linear", "torch.nn.functional.normalize", "torch.cat", "torch.stack", "torch.no_grad", "torch.nn.Module.__init__", "torch.tensor" ]
1.1.0
undeadyequ/espnet
8c3f85ce695153abcb9cf365180b1d7554ad565e
1.5
import os import glob import math import hydra import cv2 import numpy as np from shapely.geometry import Polygon import torch from torch.utils.data import Dataset, DataLoader import imgaug.augmenters as iaa import pyclipper import db_transforms from utils import dict_to_device, minmax_scaler_img class BaseDatasetI...
[ "torch.utils.data.DataLoader" ]
1.5.0
huyhoang17/DB_text_minimal
0d1466889b21cb74a0571a0fb3856902739ea523
1.4
import numpy as np import torch import torch.distributed as dist def tensor(x, device): if isinstance(x, torch.Tensor): return x.to(device) x = np.asarray(x, dtype=np.float) x = torch.tensor(x, device=device, dtype=torch.float32) return x def input_preprocessing(x, device): x = tensor(x...
[ "torch.zeros", "torch.distributed.destroy_process_group", "torch.arange", "torch.tensor", "torch.distributed.all_reduce", "torch.load", "torch.distributed.reduce", "torch.distributed.broadcast" ]
1.4.0
Laurans/procgen_adventure
5f88f3f647f7854c8fb2ae516f3490d89845eefa
1.4
import tensorflow as tf from sklearn.metrics import confusion_matrix import numpy as np from tools.preprocessing import preprocess_images, preprocess_single_image from tools.kfold import KFold_cross_validation_split from tools.extraction_and_metrics import extract_features, compute_confusion_matrix from .network impo...
[ "torch.load" ]
1.4.0
abdelsamea/DeTraC
ab03719b49a1a048f74f08600a6670f6757bbe60
1.3
from collections import OrderedDict import pytest import gym from gym import spaces import torch from torch import nn import torch.nn.functional as F from torch import distributions import pytorch_lightning as pl from lightning_baselines3.on_policy_models.on_policy_model import OnPolicyModel class DummyModel(On...
[ "torch.max", "torch.distributions.Normal", "torch.ones", "torch.ones_like", "torch.nn.functional.softmax", "torch.chunk" ]
1.3
HenryJia/lightning-baselines3
10d1a0eed6136978204323250e37d49915a12e14
1.7
""" Deep Reinforcement Learning: Deep Q-network (DQN) This example is based on https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On- Second-Edition/blob/master/Chapter06/02_dqn_pong.py The template illustrates using Lightning for Reinforcement Learning. The example builds a basic DQN using the classi...
[ "torch.utils.data.DataLoader" ]
1.7
zzzace2000/cairl_nodegam
90d0d56a0e7be3d1cbba6179cbfc36d626456770
0.4
import os import torch class Dictionary(object): """Build word2idx and idx2word from Corpus(train/val/test)""" def __init__(self): self.word2idx = {} # word: index self.idx2word = [] # position(index): word def add_word(self, word): """Create/Update word2idx and idx2word""" ...
[ "torch.LongTensor" ]
0.4.1
stanford-oval/word-language-model
3be3f65a198b518b66e22a910f28f83324db3825
0.4
""" Code based loosely on implementation: https://github.com/openai/baselines/blob/master/baselines/ppo2/policies.py Under MIT license. """ import numpy as np import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F import vel.util.network as net_util from vel.rl.models.backbon...
[ "torch.nn.Linear", "torch.cat", "torch.nn.init.constant_", "torch.nn.Conv2d" ]
0.4.1
tigerwlin/vel
00e4fbb7b612e888e2cbb5d8455146664638cd0b
0.4
import typing import torch import torch.nn.functional as F import torch.nn as nn from vel.api.base import SupervisedModel, ModelFactory, LinearBackboneModel from vel.metrics.accuracy import Accuracy from vel.metrics.loss_metric import Loss class MultilayerSequenceClassificationGRU(SupervisedModel): """ Multilay...
[ "torch.nn.LogSoftmax", "torch.nn.Linear", "torch.cat", "torch.nn.Dropout", "torch.nn.GRU", "torch.nn.init.kaiming_normal_", "torch.nn.functional.nll_loss", "torch.nn.init.zeros_" ]
0.4.1
tigerwlin/vel
00e4fbb7b612e888e2cbb5d8455146664638cd0b
1.8
from abc import abstractmethod import PIL import pytorch_lightning as pl import torch import torch.nn as nn import torchvision.transforms as transforms from torch.hub import load_state_dict_from_url from torchvision.models import DenseNet as _DenseNet from torchvision.models import ResNet as _ResNet from torchvision.m...
[ "torch.nn.Linear", "torch.nn.functional.cross_entropy", "torch.hub.load_state_dict_from_url", "torch.nn.Dropout" ]
1.8.0
data-centric-ai/dcbench
831ab2359d686739d0b0c7a589974ce08448e58d
0.4
# coding:utf8 import torch as t import torchvision as tv import torchnet as tnt from torch.utils import data from transformer_net import TransformerNet import utils from PackedVGG import Vgg16 from torch.nn import functional as F import tqdm import os import ipdb # from WCT2_train import WCT2 # import model from Lap...
[ "torch.device", "torch.no_grad", "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.load" ]
0.4.1
Raeyi/multipooling-AdaPECT
9632b98ff1612344de798321298f6488f1c303b0
1.5
import argparse import os import cv2 import librosa import numpy as np import soundfile as sf import torch from tqdm import tqdm from lib import dataset from lib import nets from lib import spec_utils class VocalRemover(object): def __init__(self, model, device, window_size): self.model = model ...
[ "torch.device", "torch.no_grad", "torch.from_numpy", "torch.cuda.is_available", "torch.load" ]
1.5.1
charzy/vocalremover
9bf983ab5579c36c75447c74eec0400d78ab49f9
1.0
# coding=utf-8 # Copyright 2020-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
[ "torch.distributed.get_world_size", "torch.cat", "torch.utils.data.dataloader.DataLoader", "torch.utils.data.sampler.RandomSampler", "torch.cuda.amp.autocast", "torch.no_grad", "torch.nn.parallel.DistributedDataParallel", "torch.utils.data.sampler.SequentialSampler", "torch.tensor", "torch.utils.d...
1.0
marcoabrate/transformers
3f77c26d74e1282955fefa8dfff2451e44f6d4a9
0.4
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ## Created by: Donny You, RainbowSecret ## Microsoft Research ## yuyua@microsoft.com ## Copyright (c) 2019 ## ## This source code is licensed under the MIT-style license found in the ## LICENSE file in the root directory of this source tree ##...
[ "torch.nn.functional.interpolate", "torch.FloatTensor", "torch.softmax", "torch.cuda.current_device", "torch.nn.functional.cross_entropy", "torch.nn.functional.softmax", "torch.nn.CrossEntropyLoss" ]
0.4.1
Shuai-Xie/openseg.pytorch
79116a58782ccd2150f9eb9054e70cfd42fc9773
1.1
#!/usr/bin/env python # -*- coding: UTF-8 -*- # n(net) o(oil) h(hang) r(rust) 检测模块 import os import sys current_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.append(current_dir) from mmdet.models import build_detector import mmcv import torch import cv2 import time import json from mmcv.runner import load...
[ "torch.no_grad" ]
1.1
yikir/mmdetection
dfceb61b0252f81b010f550f2acbe46c7dad6ef6
1.0
# Copyright (c) Facebook, Inc. and its affiliates. import collections import gc import os from bisect import bisect import requests import torch import tqdm import yaml from torch import nn def lr_lambda_update(i_iter, cfg): if ( cfg["training_parameters"]["use_warmup"] is True and i_iter <= cfg[...
[ "torch.cuda.max_memory_cached", "torch.is_tensor", "torch.cuda.max_memory_allocated", "torch.cuda.memory_allocated", "torch.cuda.memory_cached" ]
1.0.1
winnerineast/pythia
b6fe288405490f6e02a3e59dbf32a181aee35645
1.0
# Copyright (c) Facebook, Inc. and its affiliates. """ The metrics module contains implementations of various metrics used commonly to understand how well our models are performing. For e.g. accuracy, vqa_accuracy, r@1 etc. For implementing your own metric, you need to follow these steps: 1. Create your own metric cl...
[ "torch.max", "torch.no_grad", "torch.le", "torch.tensor", "torch.nn.functional.softmax", "torch.mean", "torch.sum" ]
1.0.1
winnerineast/pythia
b6fe288405490f6e02a3e59dbf32a181aee35645
0.1
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import sys import beanmachine.ppl as bm import pytest import torch import torch.distributions as dist from beanmachine.ppl.infe...
[ "torch.distributions.Normal", "torch.distributions.Uniform", "torch.tensor" ]
0.1.0
ToddSmall/beanmachine
85768bd1785bf6a8b3760a04f37a8fca69b4e4ca
1.8
''' Copyright (c) 2020, Martel Lab, Sunnybrook Research Institute Codes inspired by Hugging Face Transformers package code run_mlm.py https://github.com/huggingface/transformers/blob/main/examples/pytorch/ language-modeling/run_mlm.py Description: Training code used to train a BERT embedding in Masked Language Modelin...
[ "torch.utils.data.RandomSampler", "torch.cuda.manual_seed_all", "torch.no_grad", "torch.utils.data.SequentialSampler", "torch.cuda.device_count", "torch.manual_seed", "torch.cuda.is_available", "torch.tensor", "torch.utils.data.DataLoader", "torch.nn.DataParallel" ]
1.8.1
gkuling/BIRADS_BERT
f218d05283df90e536b210efbb4fab1d6dff082d
1.10
# # SPDX-FileCopyrightText: Copyright (c) 1993-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # 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...
[ "torch.nn.Linear", "torch.autograd.Variable", "torch.no_grad", "torch.nn.functional.log_softmax", "torch.nn.Conv2d", "torch.nn.functional.nll_loss" ]
1.10.2
L-Net-1992/TensorRT
34b664d404001bd724cb56b52a6e0e05e1fd97f2
1.7
import numpy as np from torch.utils.data import DataLoader from torch.utils.data.sampler import WeightedRandomSampler, SubsetRandomSampler from wilds.common.utils import get_counts, split_into_groups def get_train_loader(loader, dataset, batch_size, uniform_over_groups=None, grouper=None, distinct_groups...
[ "torch.utils.data.DataLoader" ]
1.7.0
caglasozen/wilds
db2ff095304891244962509459ee48e2fc5fd5e6
1.7
import os import torch import pandas as pd from PIL import Image import numpy as np from wilds.datasets.wilds_dataset import WILDSDataset from wilds.common.grouper import CombinatorialGrouper from wilds.common.metrics.all_metrics import Accuracy class WaterbirdsDataset(WILDSDataset): """ The Waterbi...
[ "torch.LongTensor" ]
1.7.0
caglasozen/wilds
db2ff095304891244962509459ee48e2fc5fd5e6
1.1
"""Training mechanism for VAE-GAN""" import os import time import logging import numpy as np import torch import torch.nn.functional as F from spml import ( image_util, loss_utils, ) from . import ( misc_utils, saved_model_manager, ) _LG = logging.getLogger(__name__) def _save_images(images, src_pa...
[ "torch.no_grad", "torch.nn.functional.mse_loss", "torch.randn_like", "torch.load" ]
1.1.0
hellomoto-ai/splatoon2-ml
4bd24eed527d6b56ce4369b70d24f20058962383
1.0
import logging import time import os import torch from utils.lr_scheduler import WarmupMultiStepLR from net import Network def create_logger(cfg): dataset = cfg.DATASET.DATASET net_type = cfg.BACKBONE.TYPE module_type = cfg.MODULE.TYPE log_dir = os.path.join(cfg.OUTPUT_DIR, cfg.NAME, "lo...
[ "torch.optim.lr_scheduler.CosineAnnealingLR", "torch.optim.Adam", "torch.optim.SGD", "torch.optim.lr_scheduler.MultiStepLR", "torch.nn.DataParallel" ]
1.0.1
tasx0823/BBN
7992e908842f5934f0d1ee3f430d796621e81975
1.0
import _init_paths from net import Network from config import cfg, update_config from dataset import * import numpy as np import torch import os from torch.utils.data import DataLoader from tqdm import tqdm import argparse from core.evaluate import FusionMatrix def parse_args(): parser = argparse.ArgumentParser(d...
[ "torch.device", "torch.nn.Softmax", "torch.no_grad", "torch.utils.data.DataLoader", "torch.nn.DataParallel" ]
1.0.1
tasx0823/BBN
7992e908842f5934f0d1ee3f430d796621e81975
0.3
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from logging import Logger from typing import Any, Dict, List, Optional, Type import torch from ax.core.data import Da...
[ "torch.device", "torch.cuda.is_available" ]
0.3.1
KireinaHoro/Ax
16cb868911eecba323759e2e129df8833361e614
1.7
"""Contains a class which extracts the needed arguments of an arbitrary methode/function and wraps them for future usage. E.g correctly choosing the needed arguments and passing them on to the original function. """ import inspect import copy import torch from ..problem.spaces.points import Points class UserFunct...
[ "torch.tensor" ]
1.7.1
uwe-iben/torchphysics
775d9aca71752a568f1fca972c958b99107f3b7c
1.0
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team, The Microsoft Research 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 # # ...
[ "torch.Size", "torch.cat", "torch.isnan", "torch.no_grad", "torch.ones", "torch.manual_seed", "torch.all", "torch.tensor", "torch.ones_like", "torch.allclose" ]
1.0
savindi-wijenayaka/transformer_old
016960521eaaf5393c9fad1c4db15338455213f8
1.7
import os import torch from src.helper_functions.helper_functions import parse_args from src.loss_functions.losses import AsymmetricLoss, AsymmetricLossOptimized from src.models import create_model import argparse import matplotlib import torchvision.transforms as transforms from pgd import create_targeted_adversarial_...
[ "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.load", "torch.clone", "torch.sum" ]
1.7
erwinvanthiel/ASL
1b8846919f4bcf7bf65881faf254395cb01f8ae3
0.4
""" Script for training model on PyTorch. """ import os import time import logging import argparse import random import numpy as np import torch.nn as nn import torch.backends.cudnn as cudnn import torch.utils.data from common.logger_utils import initialize_logging from common.train_log_param_sav...
[ "torch.nn.CrossEntropyLoss" ]
0.4.0
naviocean/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
0.4
""" SKNet for ImageNet-1K, implemented in PyTorch. Original paper: 'Selective Kernel Networks,' https://arxiv.org/abs/1903.06586. """ __all__ = ['SKNet', 'sknet50', 'sknet101', 'sknet152'] import os import torch.nn as nn import torch.nn.init as init from .common import conv1x1, conv1x1_block, conv3x3_block, C...
[ "torch.nn.Linear", "torch.nn.init.kaiming_uniform_", "torch.nn.Softmax", "torch.nn.init.constant_", "torch.nn.Sequential", "torch.nn.AvgPool2d", "torch.nn.ReLU", "torch.nn.AdaptiveAvgPool2d", "torch.randn" ]
0.4.0
naviocean/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
0.4
""" ESPNet for image segmentation, implemented in PyTorch. Original paper: 'ESPNet: Efficient Spatial Pyramid of Dilated Convolutions for Semantic Segmentation,' https://arxiv.org/abs/1803.06815. """ __all__ = ['ESPNet', 'espnet_cityscapes'] import os import torch import torch.nn as nn from common import ...
[ "torch.cat", "torch.nn.init.kaiming_uniform_", "torch.nn.init.constant_", "torch.nn.Sequential", "torch.nn.BatchNorm2d", "torch.nn.ConvTranspose2d", "torch.nn.PReLU", "torch.randn" ]
0.4.0
naviocean/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
0.4
""" BAM-ResNet for ImageNet-1K, implemented in PyTorch. Original paper: 'BAM: Bottleneck Attention Module,' https://arxiv.org/abs/1807.06514. """ __all__ = ['BamResNet', 'bam_resnet18', 'bam_resnet34', 'bam_resnet50', 'bam_resnet101', 'bam_resnet152'] import os import torch.nn as nn import torch.nn.init as in...
[ "torch.nn.Linear", "torch.nn.init.kaiming_uniform_", "torch.nn.Sigmoid", "torch.nn.Sequential", "torch.nn.AvgPool2d", "torch.nn.init.constant_", "torch.nn.ReLU", "torch.nn.BatchNorm1d", "torch.nn.AdaptiveAvgPool2d", "torch.randn" ]
0.4.0
naviocean/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
1.4
import copy import logging import numpy as np import torch import torchvision from ignite.metrics import Loss from torchvision import transforms as T from torchvision.transforms import functional as F import datasetinsights.constants as const from datasetinsights.data.datasets import Dataset from datasetinsights.data...
[ "torch.save", "torch.no_grad", "torch.nn.functional.cross_entropy", "torch.load", "torch.optim.lr_scheduler.LambdaLR" ]
1.4.0
BlairLee/dataset-insights
892e2ed3a2facf97cfa3a883700830d959a0c49b
1.6
import torch.nn as nn import torch.nn.functional as F from torch.nn import init class ConditionalBatchNorm2d(nn.BatchNorm2d): """Conditional Batch Normalization""" def __init__(self, num_features, eps=1e-05, momentum=0.1, affine=False, track_running_stats=True): super(ConditionalBat...
[ "torch.rand", "torch.nn.functional.batch_norm", "torch.nn.BatchNorm2d", "torch.no_grad", "torch.nn.init.ones_", "torch.tensor", "torch.nn.init.zeros_", "torch.nn.Embedding" ]
1.6.0
tasbolat1/DGflow
6ce22095a0d33f4da3c15f093aa365ba6cabbac9
1.7
# -*- coding: utf-8 -*- """ Created on December 30, 2020 @author: Siqi Miao """ import torch from torch_sparse import SparseTensor import torch_geometric.transforms as T from pathlib2 import Path import scipy.io as sio from sklearn.metrics import f1_score, accuracy_score from sklearn.model_selection import train_te...
[ "torch.zeros", "torch.sigmoid", "torch.stack", "torch.arange", "torch.max", "torch.LongTensor", "torch.nn.BCEWithLogitsLoss", "torch.nn.CrossEntropyLoss" ]
1.7.1
siqim/Machine-Learning-with-Graphs
697d83bb206be0825ebaf0dad128b9eb24908705
1.7
r""" vanilla pseudo-labeling implementation """ from collections import defaultdict from alr.utils import timeop, manual_seed from alr.data.datasets import Dataset from alr.data import UnlabelledDataset from alr.training import VanillaPLTrainer from alr.training.samplers import RandomFixedLengthSampler from alr import...
[ "torch.cuda.is_available", "torch.utils.data.DataLoader" ]
1.7.1
jiahfong/alr
ee561c545bd98ec17c4f9c3040ef23b0222ef71a
1.7
r""" From previous experiments, we saw that ephemeral pseudo-labelling helped boost accuracy despite starting with only 20 points. We could kick-start BALD with 85% accuracy with 24 iterations but it seems like using 80% accuracy at 10 iterations is a good trade-off. It's harder to gain more accuracy as the number of i...
[ "torch.utils.data.ConcatDataset", "torch.cuda.is_available", "torch.utils.data.Subset", "torch.utils.data.DataLoader" ]
1.7.1
jiahfong/alr
ee561c545bd98ec17c4f9c3040ef23b0222ef71a
1.7
from alr.training.pl_mixup import PLMixupTrainer, temp_ds_transform from alr.utils import manual_seed, timeop from alr.data.datasets import Dataset from alr.data import DataManager, UnlabelledDataset from alr.training.utils import PLPredictionSaver from alr import ALRModel from alr.acquisition import AcquisitionFunctio...
[ "torch.cuda.is_available", "torch.utils.data.DataLoader" ]
1.7.1
jiahfong/alr
ee561c545bd98ec17c4f9c3040ef23b0222ef71a
1.4
''' Code courtesy of Ben Feinstein & Assaf Shocher Please see their work: https://github.com/assafshocher/PyTorch-Resizer https://github.com/feinsteinben ''' import numpy as np import torch from math import pi from torch import nn class Resizer(nn.Module): def __init__(self, in_shape, scale_factor=None, output_sh...
[ "torch.nn.ParameterList", "torch.sum", "torch.tensor", "torch.transpose" ]
1.4.0
eyalnaor/DeepTemporalSR
7d8c821431dec3a4c480550c61a6033fcac5e640
1.7
import numpy as np import torch from halite_rl.utils import SubProcessWrapper class EpisodeData(): def __init__(self): self.observations = [] # Observations (states). self.actions = [] # Selected actions. self.act_log_probs = [] # Log probability of selected action. self.v...
[ "torch.no_grad", "torch.Tensor" ]
1.7.0
RyanJDick/halite_rl
e6309a24d3d613171ceb6522ddf07fece3815e62
0.4
import torch import numpy as np def torch_nms(tlbr, scores, classes=None, thresh=.5, bias=0, fast=False): """ Non maximum suppression implemented with pytorch tensors CURRENTLY NOT WORKING Args: tlbr (Tensor): Bounding boxes of one image in the format (tlbr) scores (Tensor): Scores o...
[ "torch.device", "torch.cuda.synchronize", "torch.ByteTensor", "torch.cuda.is_available" ]
0.4.0
angiemsu/netharn
728cb40aad299baf62c689430d07b29c67d8cf21
0.4
import torch import numpy as np import ubelt as ub from netharn.util.nms import py_nms from netharn.util import profiler from netharn.util.nms import torch_nms import warnings _impls = {} _impls['py'] = py_nms.py_nms _impls['torch'] = torch_nms.torch_nms _automode = 'py' try: from netharn.util.nms import cpu_nms ...
[ "torch.is_tensor", "torch.cuda.is_available", "torch.Tensor", "torch.cuda.current_device" ]
0.4.0
angiemsu/netharn
728cb40aad299baf62c689430d07b29c67d8cf21
1.10
import torch import numpy from typing import Union, List, Any class NonMaxSuppression: """ Given a set of bounding box defined over possibly different tissue Use Intersection_over_Minimum criteria to filter out overlapping proposals. """ @staticmethod @torch.no_grad() def compute_nm_mask(...
[ "torch.arange", "torch.max", "torch.no_grad", "torch.clamp", "torch.from_numpy", "torch.ones_like", "torch.zeros_like", "torch.sum" ]
1.10
broadinstitute/tissue_purifier
989ce9d58bba99a3f1c49743eed22dcc64e5f159
1.10
from typing import List, Optional, Tuple, Union, NamedTuple, Callable, Any import torch import collections.abc from torch.utils.data import Dataset, DataLoader class MetadataCropperDataset(NamedTuple): f_name: Union[str, int] loc_x: Union[int, float] loc_y: Union[int, float] moran: Union[float, None] ...
[ "torch.stack", "torch.no_grad", "torch.randperm", "torch.randint", "torch.narrow", "torch.tensor" ]
1.10
broadinstitute/tissue_purifier
989ce9d58bba99a3f1c49743eed22dcc64e5f159
1.10
from typing import Tuple import math import torch from torch.optim.optimizer import Optimizer def linear_warmup_and_cosine_protocol( f_values: Tuple[float, float, float], x_milestones: Tuple[int, int, int, int]): """ There are 5 regions: 1. constant at f0 for x < x0 2. linear increase ...
[ "torch.norm", "torch.no_grad", "torch.clone", "torch.enable_grad" ]
1.10
broadinstitute/tissue_purifier
989ce9d58bba99a3f1c49743eed22dcc64e5f159
1.4
import warnings import numpy as np import scipy as sp from scipy import stats import torch import torch.nn as nn import torch.nn.functional as F from .. import utilities def create_batches(features, y, batchsize): # Create random indices to reorder datapoints n = features.shape[0] p = features.shape[1] ...
[ "torch.nn.Linear", "torch.cat", "torch.nn.MSELoss", "torch.nn.Sequential", "torch.no_grad", "torch.randperm", "torch.ones", "torch.nn.ReLU", "torch.abs", "torch.tensor", "torch.nn.CrossEntropyLoss" ]
1.4.0
amspector100/knockpy
c4980ebd506c110473babd85836dbd8ae1d548b7
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.zeros" ]
1.3.1
amorehead/metrics
2e4cb70c46bd775629ceb9d710bc581af8bf92c5
1.1
# -*- coding: utf-8 -*- import glob import os import codecs import math from collections import Counter, defaultdict from itertools import chain, cycle import torch import torchtext.data from torchtext.data import Field, RawField from torchtext.vocab import Vocab from torchtext.data.utils import RandomShuffler from ...
[ "torch.load" ]
1.1
EstelleHuang666/OpenNMT-py
f7a239086d0db156535f3f5db9ed7060291485e8
1.7
import random import torch from deepy.data.transform import Transform, SeparatedTransform from deepy.data.transform import PairedTransform, PairedCompose, ToPairedTransform from deepy.nn import functional as myF class RandomCrop(Transform): def __init__(self, length: int, generator=None): self.length = ...
[ "torch.randint" ]
1.7.0
popura/deepy-pytorch
71d87a82e937d82b9b149041280a392cc24b7299
1.6
from typing import Union, Dict, List, Tuple, Any, Callable from ..transition import ( Transition, Scalar, TransitionStorageSmart, TransitionStorageBasic, ) import torch as t import random class Buffer: def __init__(self, buffer_size, buffer_device="cpu", *_, **__): """ Create a buf...
[ "torch.is_tensor", "torch.cat", "torch.tensor" ]
1.6.0
ikamensh/machin
af7b423c47bc1412530cf6c96c11bd3af9b3e239
1.5
from abc import abstractmethod import logging from typing import List, Union import torch from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from transformers import AutoTokenizer, AutoConfig, AutoModel, CONFIG_MAPPING, PreTrainedTokenizer import flair from flair.data import Sentence from flair....
[ "torch.nn.Linear", "torch.cat", "torch.nn.LSTM", "torch.nn.GRU", "torch.enable_grad", "torch.ones", "torch.eye", "torch.nn.utils.rnn.pack_padded_sequence", "torch.tensor", "torch.zeros", "torch.min", "torch.max", "torch.nn.ReLU", "torch.nn.Dropout", "torch.no_grad", "torch.nn.init.xavi...
1.5.0
aynetdia/flair
7e0958423ceb9744a87b0c27fd66f7be4caf0d99
0.4
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import torch import horovod.torch as hvd def broadcast_optimizer_state(optimizer, root_rank): """ This function is copied from the new...
[ "torch.is_tensor", "torch.Tensor" ]
0.4.0
jasonleeinf/nmtlab
122b70cc226d9ce17ad106a3bd3a5318bd3b359f
0.4
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch import torch.nn as nn from nmtlab.modules.kv_attention import KeyValAttention class MultiHeadAttention(nn.Module): """The implementation of mul...
[ "torch.nn.Linear", "torch.arange", "torch.clamp", "torch.cuda.is_available", "torch.nn.Embedding" ]
0.4.0
jasonleeinf/nmtlab
122b70cc226d9ce17ad106a3bd3a5318bd3b359f
1.3
import cv2 import ast import torch import numpy as np import random from torch.utils.data import DataLoader, Dataset cv2.setNumThreads(1) device = torch.device("cuda" if torch.cuda.is_available() else "cpu") class VimeoDataset(Dataset): def __init__(self, dataset_name, batch_size=32): self.batch_size = bat...
[ "torch.cat", "torch.cuda.is_available" ]
1.3.0
zawecha1/arXiv2020-RIFE
8eb622a150bd3bf0e773033cbba4728e64340ba1
0.4
import gym import torch import multiprocessing as mp import numpy as np from maml_rl.envs.subproc_vec_env import SubprocVecEnv from maml_rl.episode import BatchEpisodes def make_env(env_name): def _make_env(): return gym.make(env_name) return _make_env class BatchSampler(object): def __init__(sel...
[ "torch.no_grad", "torch.from_numpy" ]
0.4.0
henryzxu/pytorch-hsml-rl
3b36f29cf91f3ca68820ea124a2ee7a75327b94f
1.8
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import operator from functools import partial, reduce import torch from torch.distributions.utils import _sum_rightmost from pyro.nn import ConditionalDenseNN, DenseNN from .. import constraints from ..conditional import Conditi...
[ "torch.distributions.utils._sum_rightmost", "torch.cat", "torch.exp" ]
1.8.0
futurewarning/pyro
005032f10099188fea86f63b6baa46a27867983f
1.8
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import queue import warnings import torch import pyro.poutine as poutine from pyro.distributions.util import is_identically_zero from pyro.infer.elbo import ELBO from pyro.infer.enum import ( get_importance_trace, iter_di...
[ "torch.no_grad" ]
1.8.0
futurewarning/pyro
005032f10099188fea86f63b6baa46a27867983f
1.8
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import torch import pyro import pyro.distributions as dist from pyro.ops.tensor_utils import safe_normalize from .reparam import Reparam class ProjectedNormalReparam(Reparam): """ Reparametrizer for :class:`~pyro.distributi...
[ "torch.zeros_like" ]
1.8.0
futurewarning/pyro
005032f10099188fea86f63b6baa46a27867983f
1.8
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import torch def xavier_uniform(D_in, D_out): scale = math.sqrt(6.0 / float(D_in + D_out)) noise = torch.rand(D_in, D_out) return 2.0 * scale * noise - scale def adjoin_ones_vector(x): return torch....
[ "torch.zeros", "torch.rand", "torch.ones" ]
1.8.0
futurewarning/pyro
005032f10099188fea86f63b6baa46a27867983f
1.8
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import argparse import bz2 import csv import datetime import logging import multiprocessing import os import subprocess import sys import urllib import torch from pyro.contrib.examples.util import _mkdir_p, get_data_directory DA...
[ "torch.distributions.Poisson", "torch.save", "torch.empty", "torch.load" ]
1.8.0
futurewarning/pyro
005032f10099188fea86f63b6baa46a27867983f
1.1
#!/usr/bin/env python """ Main training workflow """ from __future__ import division import argparse import glob import os import random import signal import time import torch import distributed from models import data_loader, model_builder from models.data_loader import load_dataset from models.model_builder im...
[ "torch.cuda.manual_seed", "torch.manual_seed", "torch.multiprocessing.get_context", "torch.cuda.set_device", "torch.load" ]
1.1.0
qwang70/PreSumm
b2c3aee0ada7f5fa8754dffd44355b956fe0d45b
1.8
from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch def cross_entropy_dist_epoch(reduction='mean', **_): cross_entropy_fn = torch.nn.CrossEntropyLoss(reduction=reduction) l1_fn = torch.nn.L1Loss(reduction=reduction) def loss_fn(output...
[ "torch.nn.CrossEntropyLoss", "torch.pow", "torch.nn.L1Loss" ]
1.8.2
iimmortall/QuantLib
29e83dad8738d0fb4efb18d0cb5dd3a7029abd86
0.27
# Copyright 2021 MosaicML. All Rights Reserved. """The CIFAR ResNet torch module. See the :doc:`Model Card </model_cards/resnet>` for more details. """ # Code below adapted from https://github.com/facebookresearch/open_lth # and https://github.com/pytorch/vision from typing import List, Tuple import torch import t...
[ "torch.nn.Linear", "torch.nn.Sequential", "torch.nn.BatchNorm2d", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.nn.CrossEntropyLoss" ]
0.27
murthyn/composer
2a04cf387dd8558556500f7ef2bc6d3d131043d5
1.8
from torch import nn from .base_models import BaseEncoderMaskerDecoder from asteroid_filterbanks import make_enc_dec from asteroid_filterbanks.transforms import mag, magreim from ..masknn import norms, activations from ..utils.torch_utils import pad_x_to_y import warnings class DeMask(BaseEncoderMaskerDecoder): "...
[ "torch.nn.Sequential", "torch.nn.Dropout", "torch.nn.Conv1d" ]
1.8.0
ldelebec/asteroid
d6390baca5409634f112ceed554ea66c4054cb54