version stringclasses 21
values | code stringlengths 225 174k | apis list | full_version stringlengths 1 6 | repo_name stringlengths 10 107 | hexsha stringlengths 40 40 |
|---|---|---|---|---|---|
0.4 | import sys
sys.path.append("..")
import torch
from torch import nn
import torch.nn.functional as F
import random
import argparse
try:
from torchqrnn import QRNN
except:
# to stop python 3.7.x breaking
QRNN = None
from models.EncoderDecoder import (
EncoderModel,
DecoderModel,
EncoderDecoderMo... | [
"torch.zeros",
"torch.nn.Dropout",
"torch.cat"
] | 0.4.1 | AkshatSh/BinarizedNMT | 7fa15149fdfcad6b1fd0956157c3730f3dcd781f |
1.9 | import torch
import torch.backends.cudnn as cudnn
from collections import OrderedDict
from .modules.utils import yaml_loader, create_model_for_provider
from .modules.craft import CRAFT
def copy_state_dict(state_dict):
if list(state_dict.keys())[0].startswith("module"):
start_idx = 1
else:
sta... | [
"torch.cuda.is_available",
"torch.nn.DataParallel",
"torch.load"
] | 1.9.1 | jakartaresearch/receipt-ocr | 003e067eb7d80495226ad15235fa1d626a09103e |
1.9 | """
Copyright (c) 2019-present NAVER Corp.
MIT License
"""
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from ..basenet.vgg16_bn import init_weights
class RefineNet(nn.Module):
def __init__(self):
super(RefineNet, self).__in... | [
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d"
] | 1.9.1 | jakartaresearch/receipt-ocr | 003e067eb7d80495226ad15235fa1d626a09103e |
1.2 | '''
Copyright 2019 The Microsoft DeepSpeed Team
'''
import time
import psutil
import torch
from deepspeed.pt.log_utils import logger
def print_rank_0(message):
if torch.distributed.is_initialized():
if torch.distributed.get_rank() == 0:
logger.info(message)
else:
logger.info(mess... | [
"torch.cuda.max_memory_cached",
"torch.cuda.synchronize",
"torch.cuda.max_memory_allocated",
"torch.cuda.memory_allocated",
"torch.cuda.memory_cached",
"torch.distributed.is_initialized",
"torch.distributed.get_rank"
] | 1.2 | MannyKayy/DeepSpeed | 67821f95e4ee04f65965eac4ecc1ffacab4302e6 |
1.4 | import os
import cv2
import time
import argparse
import torch
import warnings
import numpy as np
from detector import build_detector
from deep_sort import build_tracker
from utils.draw import draw_boxes
from utils.parser import get_config
from utils.log import get_logger
from utils.io import write_results
class Vide... | [
"torch.cuda.is_available"
] | 1.4.0 | LeDuySon/Vehicle-tracking-deepsort | ab03375d11d83def0452260d7071e9c1cc7406c2 |
1.4 | import os
import time
import math
import torch
import numpy as np
from PIL import Image, ImageDraw
import struct # get_image_size
import imghdr # get_image_size
def sigmoid(x):
return 1.0 / (math.exp(-x) + 1.)
def softmax(x):
x = torch.exp(x - torch.max(x))
x /= x.sum()
return x
def bbox_iou(box... | [
"torch.device",
"torch.cat",
"torch.sigmoid",
"torch.stack",
"torch.min",
"torch.max",
"torch.clamp_max",
"torch.nn.Softmax",
"torch.FloatTensor",
"torch.linspace",
"torch.exp",
"torch.sort",
"torch.clamp_min"
] | 1.4.0 | LeDuySon/Vehicle-tracking-deepsort | ab03375d11d83def0452260d7071e9c1cc7406c2 |
0.4 | import ai.causalcell.utils.configuration as configuration
import ai.causalcell.datasets.synthetic_dataset as sd
import logging
import numpy as np
import torch
import random
import os
import copy
import dill as pickle
import skopt
from collections import OrderedDict
# from ai.causalcell.datasets.synthetic_dataset impor... | [
"torch.cuda.manual_seed_all",
"torch.no_grad",
"torch.manual_seed",
"torch.tensor"
] | 0.4.1 | Bertinus/causal_cell_embedding | 417b55749130fc7b7832fd3ee4c49feff4a04593 |
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 ... | [
"torch.optim.lr_scheduler.StepLR",
"torch.eq",
"torch.cuda.device_count"
] | 1.1 | igor-krawczuk/pytorch-lightning | 7de51f78ac2ec09b230e1cb8a786f872de3b861f |
1.5 | import argparse
import os, sys
from abc import ABC, abstractmethod
import torch
import models
import datasets
class BaseOptions(ABC):
"""This class is an abstract base class (ABC) for options.
To create a subclass, you need to implement the following five functions:
-- <__init__>: ... | [
"torch.cuda.set_device"
] | 1.5.0 | atomicoo/EnhanceIMG | 8c009fbb6c5461ff6d7f30bdacec72232639c7f2 |
1.3 | # -*- coding: utf-8 -*-
import torch
from caption.tokenizers import TextEncoderBase
def mask_fill(
fill_value: float,
tokens: torch.tensor,
embeddings: torch.tensor,
padding_index: int,
) -> torch.tensor:
"""
Function that masks embeddings representing padded elements.
:param fill_value: t... | [
"torch.bernoulli",
"torch.randint",
"torch.full",
"torch.tensor"
] | 1.3.1 | Unbabel/caption | 90725dbf5bc3809e0364d20d0837c58968ceb2b1 |
1.1 | #coding=utf-8
"""
Implementation of some commonly used losses.
"""
# python 2.X, 3.X compatibility
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
#import os
#import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class BC... | [
"torch.div",
"torch.sum"
] | 1.1.0 | mzhaoshuai/RMI | 10a40cdbeb58bdd1bd7125fde73b48b12f9452c7 |
1.1 | import argparse
from pathlib import Path
import numpy as np
import h5py
from scipy.io import loadmat
import torch
from tqdm import tqdm
import logging
import pickle
import cv2
import pycolmap
from .utils.parsers import parse_retrieval, names_to_pair
def interpolate_scan(scan, kp):
h, w, c = scan.shape
kp = k... | [
"torch.isnan",
"torch.from_numpy",
"torch.nn.functional.grid_sample"
] | 1.1 | patelajaychh/Hierarchical-Localization | d3f155d0587376a6fd0395ea36125016160fa448 |
1.0 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | [
"torch.nn.Linear",
"torch.sigmoid",
"torch.nn.Dropout",
"torch.zeros",
"torch.nn.MSELoss",
"torch.arange",
"torch.nn.Softmax",
"torch.nn.Tanh",
"torch.nn.CrossEntropyLoss",
"torch.from_numpy",
"torch.ones",
"torch.ones_like",
"torch.zeros_like",
"torch.matmul",
"torch.nn.Embedding"
] | 1.0.0 | irfanumar1994/pytorch-transformers | f257b96a879e38922eaa377be383be69372e78f1 |
0.4 | import os
import torch
from torch import nn
from torch.nn import functional as F
from torchvision import datasets, transforms
from src.models.base import BaseModel
class MNIST(BaseModel):
def _setup(self):
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5... | [
"torch.nn.Linear",
"torch.nn.functional.dropout",
"torch.nn.Conv2d",
"torch.nn.Dropout2d",
"torch.nn.CrossEntropyLoss"
] | 0.4.0 | jalexvig/imitating_optimizer | c0a62869ae678a62df9d13d1007efa0e531c6c3c |
0.4 | #!/usr/bin/env python
import os
from os.path import expanduser
home = expanduser("~")
import sys
import h5py
import argparse
from datetime import datetime
from time import time
import numpy as np
from numpy.random import permutation, seed
from scipy.cluster.vq import kmeans
import glob
import torch
import torch.nn as ... | [
"torch.nn.NLLLoss",
"torch.cuda.manual_seed",
"torch.cat",
"torch.optim.lr_scheduler.MultiStepLR",
"torch.cuda.device_count",
"torch.cuda.is_available",
"torch.LongTensor",
"torch.nn.KLDivLoss",
"torch.nn.functional.softmax",
"torch.Tensor",
"torch.nn.CrossEntropyLoss"
] | 0.4.1 | gkaramanolakis/ISWD | 41452f447284491cf8ade8e09f3bc4e314ec64f7 |
1.6 | import numpy as np
import os
import shutil
import sys
from torch.utils.tensorboard import SummaryWriter
import torch
def model_input(data, device):
datum = data.data[0:1]
if isinstance(datum, np.ndarray):
return torch.from_numpy(datum).float().to(device)
else:
return datum.float().to(devic... | [
"torch.utils.tensorboard.SummaryWriter",
"torch.from_numpy"
] | 1.6.0 | skat00sh/Handcrafted-DP | d1f8bc004adc240d5c424a10bdcc30fc266c8218 |
1.9 | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import pytest
import torch
from pyro.distributions import (
Delta,
NegativeBinomial,
Normal,
Poisson,
ZeroInflatedDistribution,
ZeroInflatedNegativeBinomial,
ZeroInflatedPoisson,
)
from pyr... | [
"torch.zeros",
"torch.rand",
"torch.ones",
"torch.tensor",
"torch.randn"
] | 1.9.0 | tianjuchen/pyro | d5b0545c4f992d435692080db6969314a2c32f05 |
1.9 | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import torch
from torch.distributions import constraints
from torch.nn import Parameter
import pyro
import pyro.distributions as dist
from pyro.contrib.gp.parameterized import Parameterized
from pyro.nn.module import PyroParam, Py... | [
"torch.zeros",
"torch.rand",
"torch.nn.Parameter",
"torch.eye",
"torch.tensor"
] | 1.9.0 | tianjuchen/pyro | d5b0545c4f992d435692080db6969314a2c32f05 |
1.9 | from __future__ import print_function, absolute_import
import torch
import torch.nn as nn
from torch.nn.modules.loss import _Loss
from super_gradients.training.utils import convert_to_tensor
class RSquaredLoss(_Loss):
def forward(self, output, target):
# FIXME - THIS NEEDS TO BE CHANGED SUCH THAT THIS ... | [
"torch.var",
"torch.nn.MSELoss"
] | 1.9.0 | Deci-AI/super-gradients | bfed440ecaf485af183570bf965eb5b74cb9f832 |
1.9 | import torch.nn as nn
import torch
import torch.nn.functional as F
from torch.distributions import Bernoulli
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
clas... | [
"torch.nn.Linear",
"torch.nn.BatchNorm2d",
"torch.nn.LeakyReLU",
"torch.nn.init.kaiming_normal_",
"torch.distributions.Bernoulli",
"torch.cuda.is_available",
"torch.nn.functional.pad",
"torch.nn.MaxPool2d",
"torch.nn.init.constant_",
"torch.zeros",
"torch.nn.Sequential",
"torch.nn.functional.d... | 1.9.1 | brando90/Does-MAML-Only-Work-via-Feature-Re-use-A-Data-Set-Centric-Perspective | 45c4fabf35d6d8d19e49092e84e8ac9fa55aee8d |
1.9 | import torch
import torch.nn as nn
from collections import OrderedDict
# import torchvision.transforms as transforms
# from torch.models.custom_layers import Flatten
class Flatten(nn.Module):
def forward(self, input):
batch_size = input.size(0)
out = input.view(batch_size,-1)
return out ... | [
"torch.nn.Linear",
"torch.cuda.is_available",
"torch.randn"
] | 1.9.1 | brando90/Does-MAML-Only-Work-via-Feature-Re-use-A-Data-Set-Centric-Perspective | 45c4fabf35d6d8d19e49092e84e8ac9fa55aee8d |
1.9 | """
Union of data sets for SL training.
"""
from typing import Union
import torchvision
from torch import Tensor
from torch.utils.data import Dataset
from pathlib import Path
import torch
from task2vec import Task2Vec
from models import get_model
import datasets
import task_similarity
def get_datasets(root: Union[s... | [
"torch.cuda.is_available"
] | 1.9.1 | brando90/Does-MAML-Only-Work-via-Feature-Re-use-A-Data-Set-Centric-Perspective | 45c4fabf35d6d8d19e49092e84e8ac9fa55aee8d |
1.7 | import os
import torch
from tensorboardX import SummaryWriter
use_cuda = torch.cuda.is_available()
default_checkpoint = {
"epoch": 0,
"train_losses": [],
"train_symbol_accuracy": [],
"train_sentence_accuracy": [],
"train_wer": [],
"train_score": [],
"validation_losses": [],
"validation... | [
"torch.cuda.is_available",
"torch.load"
] | 1.7.1 | bsm8734/formula-image-latex-recognition | 86d5070e8f907571a47967d64facaee246d92a35 |
1.3 | """!
@brief Running an experiment with the improved version of SuDoRmRf on
universal source separation with multiple sources.
@author Efthymios Tzinis {etzinis2@illinois.edu}
@copyright University of Illinois at Urbana-Champaign
"""
import os
import sys
current_dir = os.path.dirname(os.path.abspath('__file__'))
root_... | [
"torch.rand",
"torch.stack",
"torch.no_grad",
"torch.std",
"torch.randperm",
"torch.mean",
"torch.nn.DataParallel",
"torch.sum"
] | 1.3.0 | ishine/sudo_rm_rf | ec3fae1e2c9d85710f933a600f3ab93f92468dee |
1.6 | """This script is used to measure output dispersion score of synthetic datasets
"""
import os
import sys
import numpy as np
import torch
import random
import tqdm
import time
from pathlib import Path
from os.path import join
from model.model import EncoderDecoder
sys.path.append(join(os.path.dirname(os.path.abspath(__f... | [
"torch.device",
"torch.cat",
"torch.utils.data.DataLoader",
"torch.load",
"torch.utils.data.Subset",
"torch.set_grad_enabled"
] | 1.6.0 | nsfzyzz/dispersion-score | ac0c633fe3af091e83d2d198809d98545a0a311a |
0.4 | from torch import nn
from torch.nn import init
import torch.nn.functional as F
from core.config import cfg
from modeling.generate_anchors import generate_anchors
from modeling.generate_proposals import GenerateProposalsOp
from modeling.generate_proposal_labels import GenerateProposalLabelsOp
import modeling.FPN as FPN... | [
"torch.nn.functional.sigmoid",
"torch.nn.init.constant_",
"torch.nn.Conv2d",
"torch.nn.functional.cross_entropy",
"torch.nn.init.normal_"
] | 0.4.1 | xixiobba/MVP-Net | 07bf00390080670b5d9a643b99f633419322a1ec |
1.0 | import time
import numpy as np
import torch
from torch.autograd import Variable
from torch.utils.data.sampler import SubsetRandomSampler
from archived.s3.get_object import get_object
from archived.s3 import clear_bucket
from archived.sync import reduce_epoch, delete_expired_merged_epoch
from archived.old_... | [
"torch.max",
"torch.autograd.Variable",
"torch.norm",
"torch.from_numpy",
"torch.utils.data.DataLoader",
"torch.utils.data.sampler.SubsetRandomSampler"
] | 1.0.1 | DS3Lab/LambdaML | 0afca7819e08632ba116fec8e102084e4040a47a |
1.7 | from dataset.dataset import Im2LatexDataset
import os
import sys
import argparse
import logging
import yaml
import numpy as np
import torch
from torchtext.data import metrics
from munch import Munch
from tqdm.auto import tqdm
import wandb
from Levenshtein import distance
from models import get_model, M... | [
"torch.no_grad",
"torch.load"
] | 1.7.1 | dc2016bte0006/Latex_OCR | 2e919617da8f2f7f3445ed8d1953a5664c1aaba7 |
1.8 | import numpy as np
import torch
import os
import random
class EarlyStopMonitor(object):
def __init__(self, max_round=3, higher_better=True, tolerance=1e-3):
self.max_round = max_round
self.num_round = 0
self.epoch_count = 0
self.best_epoch = 0
self.last_best = None
... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed"
] | 1.8.0 | HSE-DynGraph-Research-team/DynGraphModelling | 890326f4bd7991ef88a7a79cd2c8a77541621423 |
0.3 | # encoding:utf-8
'''
@Author: catnlp
@Email: wk_nlp@163.com
@Time: 2018/5/2 15:02
'''
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
START_TAG = -2
STOP_TAG = -1
def log_sum_exp(vec, m_size):
_, idx = torch.max(vec, 1)
max_score = torch.g... | [
"torch.zeros",
"torch.cat",
"torch.gather",
"torch.max",
"torch.nn.Parameter",
"torch.LongTensor",
"torch.sum"
] | 0.3.1 | catnlp/metaLSTM | 08b3086ebc558b936898022dd7eea7d726e6d491 |
1.9 | import torch
from sklearn.preprocessing import LabelEncoder
from torch.utils.data import Dataset, DataLoader
class JobsDataset(Dataset):
def __init__(self, X, y, tokenizer, max_len=512):
self.len = len(X)
self.data = X
self.y = y
self.tokenizer = tokenizer
self.max_len = ma... | [
"torch.tensor",
"torch.utils.data.DataLoader"
] | 1.9.0 | kantharajucn/job_seniority_prediction | cad9147ffddab1c5ead878c2f9d9e48199dc0da9 |
0.4 | import copy
from components.episode_buffer import EpisodeBatch
from modules.mixers.vdn import VDNMixer
from modules.mixers.qmix import QMixer
import torch as th
import numpy as np
from torch.optim import RMSprop
# learning for 6h_vs_8z scenario
class QLearner_6h_vs_8z:
def __init__(self, mac, scheme, logger, args)... | [
"torch.stack",
"torch.optim.RMSprop",
"torch.gather",
"torch.nn.utils.clip_grad_norm_",
"torch.std"
] | 0.4.1 | jyericlin/VBC | cc34169e4f4ece500ad8c33ab69378f0a700a73e |
1.4 | # Copyright (c) 2020 Horizon Robotics. 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 applicab... | [
"torch.arange"
] | 1.4.0 | zhuboli/alf | b357565638c9336ebd88cecb9766a17d72d5d0c3 |
1.0 | # based on implementation: https://github.com/usuyama/pytorch-unet/blob/master/pytorch_unet.py
from ..registry import BACKBONES
import torch
import torch.nn as nn
def double_conv(in_channels, out_channels):
return nn.Sequential(
nn.Conv3d(in_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=... | [
"torch.cat",
"torch.nn.MaxPool3d",
"torch.nn.functional.interpolate",
"torch.nn.ReLU",
"torch.nn.Conv3d"
] | 1.0.1 | arthur801031/3d-multi-resolution-rcnn | 8e5454a72f8daa174bf3eabfa5964152f04ab287 |
1.0 | import torch
from .transforms import bbox2delta, bbox2delta3d
from ..utils import multi_apply
def bbox_target(pos_bboxes_list,
neg_bboxes_list,
pos_gt_bboxes_list,
pos_gt_labels_list,
cfg,
reg_classes=1,
target_means=[.0,... | [
"torch.nonzero",
"torch.cat"
] | 1.0.1 | arthur801031/3d-multi-resolution-rcnn | 8e5454a72f8daa174bf3eabfa5964152f04ab287 |
1.7 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.sparse as sparse
from beta_rec.models.torch_engine import ModelEngine
class NGCF(torch.nn.Module):
"""Model initialisation, embedding generation and prediction of NGCF."""
def __init__(self, config, norm_adj):
"""Initial... | [
"torch.nn.Linear",
"torch.nn.functional.normalize",
"torch.cat",
"torch.mul",
"torch.nn.Dropout",
"torch.nn.ModuleList",
"torch.split",
"torch.nn.functional.logsigmoid",
"torch.nn.init.xavier_uniform_",
"torch.no_grad",
"torch.tensor",
"torch.mean",
"torch.nn.Embedding",
"torch.sparse.mm"
... | 1.7.1 | mengzaiqiao/TVBR | cdac86a753c41f8f3c55a025be8d88dd305325f5 |
1.5 | import math
from typing import Optional, Tuple
from overrides import overrides
import torch
import torch.nn.functional as F
from transformers import XLNetConfig
from allennlp.data.tokenizers import PretrainedTransformerTokenizer
from allennlp.modules.token_embedders.token_embedder import TokenEmbedder
from allennlp.... | [
"torch.zeros_like",
"torch.nn.functional.pad",
"torch.cat",
"torch.arange"
] | 1.5.0 | Khushbu0610/allennlp | 60deece9fca2da6b66bfcde44484384bdefa3fe7 |
1.8 | import torch
import torch.nn as nn
from tcr_embedding.models.architectures.transformer import TransformerEncoder, TransformerDecoder
from tcr_embedding.models.architectures.mlp import MLP
from tcr_embedding.models.architectures.mlp_scRNA import build_mlp_encoder, build_mlp_decoder
from tcr_embedding.models.vae_base_mo... | [
"torch.nn.Embedding",
"torch.cat",
"torch.FloatTensor",
"torch.randn_like",
"torch.ones_like",
"torch.exp",
"torch.randn"
] | 1.8.0 | SchubertLab/mvTCR | d815749e24650f69ef68054e0078d490af91b71d |
1.5 | import torch
import pandas as pd
from io import BytesIO
from subprocess import check_output
from . import writing
import time
def memory(device=0):
total_mem = torch.cuda.get_device_properties(f'cuda:{device}').total_memory
writing.max(f'gpu-memory/cache/{device}', torch.cuda.max_memory_cached(device)/total_m... | [
"torch.cuda.max_memory_cached",
"torch.cuda.get_device_properties",
"torch.cuda.reset_max_memory_allocated",
"torch.cuda.max_memory_allocated",
"torch.cuda.reset_max_memory_cached"
] | 1.5 | JulianKu/megastep | 21ac85510d03f20600d438618a02569c6f1e34e1 |
1.9 | #-*- coding:utf-8 -*-
#'''
# Created on 18-12-27 上午10:34
#
# @Author: Greg Gao(laygin)
#'''
import os
import xml.etree.ElementTree as ET
import numpy as np
import cv2
from torch.utils.data import Dataset
import torch
from config import IMAGE_MEAN
from ctpn_utils import cal_rpn
def readxml(path):
gtboxes = []
... | [
"torch.from_numpy"
] | 1.9.0 | edgardeng/machine-learning-pytorch | 24a060894f5226b5ef20cc311db72f1adc037548 |
1.1 | from distutils.version import LooseVersion
from functools import reduce
from itertools import permutations
from typing import Dict
from typing import Optional
from typing import Tuple
import torch
from torch_complex.tensor import ComplexTensor
from typeguard import check_argument_types
from espnet2.enh.informed_encod... | [
"torch.get_default_dtype",
"torch.stack",
"torch.min",
"torch.arange",
"torch.unbind",
"torch.norm",
"torch.bmm",
"torch.log10",
"torch.ones",
"torch.tensor",
"torch.sum"
] | 1.1.0 | IceCreamWW/ESPnet-informed-se | 38471b7749b7df0fadeae500cf8a050ac66872d2 |
1.4 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .BasePIFuNet import BasePIFuNet
from .SurfaceClassifier import SurfaceClassifier
from .DepthNormalizer import DepthNormalizer
from .HGFilters import *
from ..net_util import init_net
class HGPIFuNet(BasePIFuNet):
'''
HG PIFu network uses ... | [
"torch.cat",
"torch.nn.MSELoss",
"torch.nn.Sigmoid"
] | 1.4.0 | ayush94582/pifu_surreal | f370165481361991146fb80a0757be38a0763961 |
1.10 | from argparse import ArgumentParser
from turtle import forward
from typing import List
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
from pytorch_lightning.loggers import TensorBoardLogger
from torchmetrics import RetrievalHitRate
from lit_data im... | [
"torch.nn.Linear",
"torch.sigmoid",
"torch.cat",
"torch.nn.Dropout",
"torch.stack",
"torch.nn.AdaptiveMaxPool2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.Embedding"
] | 1.10.2 | nntrongnghia/learn-recsys | 43505c2663255d10e900f4cb98553eb5058e0a09 |
1.10 | import os
from copy import deepcopy
from typing import Tuple
import numpy as np
import pandas as pd
from torch.utils.data import random_split
from lit_data import BaseDataset
def read_data_ml100k(data_dir="./ml-100k") -> pd.DataFrame:
names = ['user_id', 'item_id', 'rating', 'timestamp']
data = pd.read_csv(... | [
"torch.utils.data.random_split"
] | 1.10.2 | nntrongnghia/learn-recsys | 43505c2663255d10e900f4cb98553eb5058e0a09 |
1.4 | #!/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.
"""
Implementation of ResNeXt (https://arxiv.org/pdf/1611.05431.pdf)
"""
import copy
import math
from typing import An... | [
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.init.constant_",
"torch.nn.BatchNorm2d",
"torch.nn.init.kaiming_normal_",
"torch.nn.ReLU",
"torch.nn.Conv2d"
] | 1.4 | dendisuhubdy/ClassyVision | c7f8de4615181b5a14dd5ec44fa72bebb790e886 |
1.7 | from load_data import Data
import numpy as np
import torch
import time
from collections import defaultdict
from model import *
from torch.optim.lr_scheduler import ExponentialLR
import argparse
from tqdm import tqdm
import os
from prettytable import PrettyTable
class Experiment:
def __init__(self, learning_r... | [
"torch.cuda.manual_seed_all",
"torch.no_grad",
"torch.optim.lr_scheduler.ExponentialLR",
"torch.manual_seed",
"torch.tensor",
"torch.load",
"torch.sort",
"torch.set_num_threads"
] | 1.7.1 | jishnujayakumar/MLRC2020-EmbedKGQA | ee99b8c83e6278b2dd6f16e0ae910c80b28da251 |
1.7 | import torch
import torch.nn as nn
import torch.nn.utils
import torch.nn.functional as F
from torch.autograd import Variable
import torch.nn.functional as F
import numpy as np
from torch.nn.init import xavier_normal_
from transformers import *
import random
from helpers import *
class RelationExtractor(nn.Module):
... | [
"torch.nn.Linear",
"torch.nn.LogSoftmax",
"torch.nn.Dropout",
"torch.sigmoid",
"torch.cat",
"torch.stack",
"torch.norm",
"torch.no_grad",
"torch.bmm",
"torch.nn.functional.log_softmax",
"torch.nn.BatchNorm1d",
"torch.nn.KLDivLoss",
"torch.mean",
"torch.chunk",
"torch.sum"
] | 1.7.1 | jishnujayakumar/MLRC2020-EmbedKGQA | ee99b8c83e6278b2dd6f16e0ae910c80b28da251 |
1.3 | import torch
from torch import nn
from torch.nn.functional import fold, unfold
from . import norms, activations
from .norms import GlobLN, CumLN
from ..utils import has_arg
class SingleRNN(nn.Module):
""" Module for a RNN block.
Inspired from https://github.com/yluo42/TAC/blob/master/utility/models.py
L... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.Conv1d",
"torch.nn.Sequential",
"torch.nn.Tanh",
"torch.nn.Sigmoid",
"torch.nn.Conv2d",
"torch.nn.PReLU"
] | 1.3.0 | DizzyProtos/asteroid | bb3c374fefe7525c2f6da355834e470d45b45b90 |
1.3 | import torch
import numpy as np
from torch import nn
import torchvision
import torch.nn.functional as F
from pathlib import Path
from asteroid import torch_utils
from asteroid.engine.optimizers import make_optimizer
from asteroid.filterbanks import transforms
# Reference: https://github.com/bill9800/speech_separation... | [
"torch.zeros",
"torch.device",
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.cat",
"torch.nn.BatchNorm2d",
"torch.nn.functional.interpolate",
"torch.nn.init.xavier_uniform_",
"torch.cuda.device_count",
"torch.nn.BatchNorm1d",
"torch.load",
"torch.zeros_like",
"torch.transp... | 1.3.0 | DizzyProtos/asteroid | bb3c374fefe7525c2f6da355834e470d45b45b90 |
1.5 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import segmentation_models_pytorch as smp
class Generator_with_Refin(nn.Module):
def __init__(self, encoder):
"""Generator initialization
Args:
encoder: an encoder for Unet generator
"""
super(Generator_with_R... | [
"torch.nn.Identity",
"torch.nn.Sequential",
"torch.nn.BatchNorm2d",
"torch.nn.LeakyReLU",
"torch.nn.ReLU",
"torch.nn.Conv2d"
] | 1.5.0 | sgarg18/arshadowgan | 8183f8c06f93c249e48193cdfa41a5e78bcc3d5e |
1.2 | """
This function help to feed in train and test datasets.
Select model archtecture and seed then output corresponding model.
"""
from __future__ import print_function
import os
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F #233
import torch.optim as optim
from torchvis... | [
"torch.manual_seed",
"torch.utils.data.ConcatDataset",
"torch.utils.data.random_split",
"torch.utils.data.DataLoader"
] | 1.2.0 | kkmumu/DeepRobust | 0cc1950177ed6604e55274e1a7cd578d54fba5c4 |
1.3 |
from escnn.nn import FieldType, GeometricTensor
from escnn.group import Representation
from escnn.kernels import KernelBasis
from torch_geometric.data import Data
from .rd_point_convolution import _RdPointConv
from typing import Callable, Tuple, Dict, Union, List
import torch
import numpy as np
import math
__... | [
"torch.linspace"
] | 1.3 | QUVA-Lab/escnn | 59ed6b96f61f8616f87b3f25aa2f8abdb6f1a882 |
1.3 | import unittest
from unittest import TestCase
from escnn.nn import *
from escnn.gspaces import *
import torch
import random
class TestGeometricTensor(TestCase):
def test_sum(self):
for N in [2, 4, 7, 16]:
gs = rot2dOnR2(N)
for irr in gs.irreps:
type = FieldTyp... | [
"torch.allclose",
"torch.randn"
] | 1.3 | QUVA-Lab/escnn | 59ed6b96f61f8616f87b3f25aa2f8abdb6f1a882 |
1.7 | # -*- coding: utf-8 -*-
"""
Main proposal object that includes normalising flows.
"""
import copy
import datetime
import logging
import os
import matplotlib.pyplot as plt
import numpy as np
import numpy.lib.recfunctions as rfn
import torch
from ..flowmodel import FlowModel, update_config
from ..livepoint import (
... | [
"torch.no_grad",
"torch.from_numpy"
] | 1.7.0 | Rodrigo-Tenorio/nessai | 2b4175da61b3a7250d1154a126ad93481836df0d |
1.1 | #!/usr/bin/env python3
import torch
import operator
from .lazy_tensor import LazyTensor
from .non_lazy_tensor import lazify
from ..utils.broadcasting import _matmul_broadcast_shape
from ..utils.memoize import cached
from functools import reduce
def _prod(iterable):
return reduce(operator.mul, iterable, 1)
def ... | [
"torch.Size"
] | 1.1 | idelbrid/gpytorch | 092d523027a844939ba85d7ea8c8c7b7511843d5 |
1.7 | # -*- coding: utf-8 -*-
from typing import List
from collections import Counter
import torch
from ...wrapper import TargetWrapper, Batch
from ...utils import ChunksTagsTranslator
from ...nn.utils import unpad_seqs
from ...nn.modules import CombinedDropout, CRF
from ...nn.init import reinit_layer_
from ...metrics impor... | [
"torch.nn.Linear",
"torch.nn.utils.rnn.pad_sequence",
"torch.tensor",
"torch.stack"
] | 1.7.1 | syuoni/eznlp | 9d1397d8e9630c099295712cbcffa495353a3268 |
1.7 | # -*- coding: utf-8 -*-
from typing import List, Tuple
from collections import Counter
import logging
import torch
from ...wrapper import TargetWrapper, Batch
from ...utils.chunk import detect_nested, filter_clashed_by_priority
from ...nn.modules import CombinedDropout, SoftLabelCrossEntropyLoss
from ...nn.init import... | [
"torch.zeros",
"torch.nn.functional.normalize",
"torch.stack",
"torch.arange",
"torch.full",
"torch.zeros_like",
"torch.nn.init.orthogonal_",
"torch.nn.init.zeros_",
"torch.empty",
"torch.nn.Embedding",
"torch.empty_like"
] | 1.7.1 | syuoni/eznlp | 9d1397d8e9630c099295712cbcffa495353a3268 |
1.0 | """
This file defines class DecisionModule.
@author: Clemens Rosenbaum :: cgbr@cs.umass.edu
@created: 6/7/18
"""
import abc
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions.distribution import Distribution
from .PolicyStorage import ApproxPolicyStorage, TabularP... | [
"torch.zeros",
"torch.max",
"torch.nn.Module.__init__",
"torch.ones"
] | 1.0 | cle-ros/RoutingNetworks | 0f1fe1221c67a224a02bca6247d3c4488ede0a04 |
0.4 | import torch
import itertools
from util.image_pool import ImagePool
from .base_model import BaseModel
from . import networks
from torch.autograd import Variable
import numpy as np
from .modules import loss
from util.util import gaussian
class CycleGANSemanticModel(BaseModel):
#def name(self):
# return 'Cycl... | [
"torch.nn.modules.CrossEntropyLoss",
"torch.nn.L1Loss"
] | 0.4.1 | jolibrain/pytorch-CycleGAN-and-pix2pix | 43465d660d445e020067979fa8d592a1b480c869 |
1.8 | from typing import Any, Dict, List, Optional, Tuple, Type, Union
import gym
import numpy as np
import torch as th
from torch.nn import functional as F
from stable_baselines3.common.buffers import ReplayBuffer
from stable_baselines3.common.noise import ActionNoise
from stable_baselines3.common.off_policy_algorithm imp... | [
"torch.min",
"torch.no_grad",
"torch.ones",
"torch.nn.functional.mse_loss"
] | 1.8.1 | shivamvats/stable-baselines3 | d67a3bc800389212f94f274c4cf6036c78923105 |
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.rand",
"torch.randint"
] | 1.3.1 | BeyondTheProof/metrics | 8af688daff819a95f4cb3d757ffc919c86072ee9 |
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.argsort",
"torch.tensor"
] | 1.3.1 | BeyondTheProof/metrics | 8af688daff819a95f4cb3d757ffc919c86072ee9 |
1.3 | import torch
from torch import nn as nn
from torch.nn import functional as F
from basicsr.utils.registry import ARCH_REGISTRY
from .spynet_arch import SpyNet
from .basicvsr_arch import ConvResBlock, PSUpsample
from .edvr_arch import PredeblurModule, PCDAlignment, TSAFusion
from .arch_util import ResidualBlockNoBN, flo... | [
"torch.cat",
"torch.stack",
"torch.nn.LeakyReLU",
"torch.nn.Upsample",
"torch.nn.Conv2d",
"torch.zeros_like",
"torch.nn.functional.pad",
"torch.randn"
] | 1.3 | IanYeung/ReCp | 1a7ace0e1ca3c262e24a222f3f0ab0d5674e9410 |
0.4 | from __future__ import print_function
from __future__ import division
import os
import sys
import time
import datetime
import os.path as osp
import numpy as np
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.nn import functional as F
from torch.optim import lr_scheduler
from tensor... | [
"torch.cat",
"torch.no_grad",
"torch.optim.lr_scheduler.MultiStepLR",
"torch.cuda.is_available",
"torch.load",
"torch.nn.functional.softmax",
"torch.nn.DataParallel",
"torch.pow"
] | 0.4.1 | aytackanaci/deep-vehicle-reid | 9f951288a38f8b295b5c77cc6c9b26f0632ecea3 |
1.0 | """
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
import torch.nn as nn
from torch.nn import init
class BaseNetwork(nn.Module):
def __init__(self):
super(BaseNetwork, self).__init_... | [
"torch.nn.init.constant_",
"torch.nn.init.kaiming_normal_",
"torch.nn.init.xavier_uniform_",
"torch.nn.init.normal_",
"torch.nn.init.orthogonal_",
"torch.nn.init.xavier_normal_"
] | 1.0.0 | jiye-ML/CoCosNet | c4b3f44393462c8353c6c6952d7b05496298df1c |
1.7 | import argparse
import math
import sys
import time
import os
import socket
import statistics
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from model import MLMTask, MLMTask2, MLMTaskEmbedding, MLMTaskEncoder, MLMTaskHead
from cuda_local_pipeline import LocalSequential, sync_all_device
... | [
"torch.zeros",
"torch.cuda.Event",
"torch.save",
"torch.randperm",
"torch.ones",
"torch.manual_seed",
"torch.tensor",
"torch.load",
"torch.nn.CrossEntropyLoss"
] | 1.7.1 | imaginary-person/pipeline_experiments | 32d20f1b9a4192e75ed6ba709c9acd2e0cf23e06 |
1.7 | import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets, transforms
import torch.multiprocessing as mp
import torch.distributed.rpc as rpc
import os
import concurrent.futures
from torch.distributed.optim import DistributedOptimizer
from torch.distributed.rpc import RRef
import to... | [
"torch.nn.Linear",
"torch.distributed.rpc.remote",
"torch.nn.MaxPool2d",
"torch.distributed.rpc.TensorPipeRpcBackendOptions",
"torch.multiprocessing.spawn",
"torch.nn.ReLU",
"torch.distributed.rpc.init_rpc",
"torch.nn.Conv2d",
"torch.distributed.rpc.shutdown",
"torch.randn",
"torch.nn.Flatten"
] | 1.7.1 | imaginary-person/pipeline_experiments | 32d20f1b9a4192e75ed6ba709c9acd2e0cf23e06 |
1.1 | import argparse
import datetime
import glob
import os
import re
import time
from pathlib import Path
import numpy as np
import torch
from tensorboardX import SummaryWriter
from eval_utils import eval_utils
from pcdet.config import cfg, cfg_from_list, cfg_from_yaml_file, log_config_to_file
from pcdet.datasets import b... | [
"torch.no_grad"
] | 1.1 | fjczx/OpenPCDet-lazurite | e3f17ab17b2c295e1786e34c6feb86adffe84b49 |
1.0 | import torch
import time
import sys
import os
import math
import random
from termcolor import colored
from .distributions import Empirical
from . import util, state, TraceMode, PriorInflation, InferenceEngine, InferenceNetwork, ImportanceWeighting, Optimizer, LearningRateScheduler, AddressDictionary
from .nn import In... | [
"torch.no_grad",
"torch.sum"
] | 1.0.0 | SwapneelM/pyprob | 4d93441ea838c3491a49050ae05d218a34708e6d |
1.3 | import copy
import gc
import json
import os
import random
import warnings
from collections import defaultdict
from typing import Dict
import matplotlib.pyplot as plt
import scipy.misc
import habitat_sim
import gc
import magnum as mn
import quaternion
from habitat_sim.utils.common import quat_to_magnum, quat_from_magnu... | [
"torch.cat",
"torch.stack",
"torch.cuda.device",
"torch.ones",
"torch.cuda.is_available",
"torch.load",
"torch.nn.BCEWithLogitsLoss",
"torch.nn.CrossEntropyLoss",
"torch.sigmoid",
"torch.tensor",
"torch.utils.data.DataLoader",
"torch.masked_select",
"torch.zeros",
"torch.device",
"torch.... | 1.3.1 | GT-RIPL/robo-vln | 286870a7d1095fe2607b524572587a48854bc970 |
1.8 | from unittest.mock import MagicMock, patch
import numpy as np
import torch
class _TestNN(torch.nn.Module):
def __init__(self, input_size, output_size):
super().__init__()
self.decoder = torch.nn.Linear(input_size, output_size)
self.forward_called = False
def forward(self, nn_input, h... | [
"torch.nn.Linear",
"torch.from_numpy",
"torch.nn.CrossEntropyLoss"
] | 1.8.1 | TeoZosa/deep-learning-v2-pytorch | 8e73c26f2ebf49769b798e9ff26bd90d7de69f7d |
0.3 | # pylint: disable=no-self-use,invalid-name,no-value-for-parameter
import os
from nltk import Tree
import torch
from torch.autograd import Variable
from allennlp.common.testing.model_test_case import ModelTestCase
from allennlp.models.constituency_parser import SpanInformation
class SpanConstituencyParserTest(ModelT... | [
"torch.LongTensor"
] | 0.3.1 | unendin/allennlp | 0dcbaea6dbc6cc43e24a3564d6d37f8a1421484c |
0.3 | # pylint: disable=invalid-name,no-self-use
import pytest
import numpy
import torch
import torch.nn.init
from torch.nn.modules.rnn import LSTM
from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence
from allennlp.common.checks import ConfigurationError
from allennlp.common.testing import AllenNlpTestCa... | [
"torch.zeros",
"torch.rand",
"torch.nn.init.constant",
"torch.nn.modules.rnn.LSTM",
"torch.autograd.Variable",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.LongTensor"
] | 0.3.1 | unendin/allennlp | 0dcbaea6dbc6cc43e24a3564d6d37f8a1421484c |
1.8 | # Copyright (c) 2020 Horizon Robotics and ALF Contributors. 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... | [
"torch.zeros",
"torch.cat",
"torch.max",
"torch.no_grad",
"torch.logsumexp",
"torch.distributions.categorical.Categorical",
"torch.empty"
] | 1.8.1 | Haichao-Zhang/alf_randperm_reproduce | d5223b7534ab20ca725aac940ad274ef806d1d3e |
1.2 | # Copyright 2019 Uber Technologies, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"torch.device",
"torch.no_grad",
"torch.tensor",
"torch.load"
] | 1.2.0 | aoyandong/horovod | e94d8ea0dff8c2b45698cfe4fabb2e6553d0b9a8 |
1.3 | import torch
from torch.distributions import constraints
from torch.distributions.utils import lazy_property
from pyro.distributions.torch_distribution import TorchDistribution
from pyro.distributions.util import broadcast_shape
class MaskedConstraint(constraints.Constraint):
"""
Combines two constraints int... | [
"torch.Size",
"torch.is_tensor"
] | 1.3.0 | Capri2014/pyro | 546f9010aeb2308ae566726b1cec67a7b4fda9c2 |
1.3 | import math
import torch
import torch.nn as nn
from torch.distributions import MultivariateNormal, constraints
import pyro.distributions as dist
from pyro.contrib.timeseries.base import TimeSeriesModel
from pyro.nn import PyroParam, pyro_method
from pyro.ops.ssm_gp import MaternKernel
from pyro.ops.tensor_utils impor... | [
"torch.zeros",
"torch.no_grad",
"torch.ones",
"torch.eye",
"torch.tensor",
"torch.distributions.MultivariateNormal",
"torch.matmul",
"torch.randn"
] | 1.3.0 | Capri2014/pyro | 546f9010aeb2308ae566726b1cec67a7b4fda9c2 |
1.3 | import torch
from torch.distributions import constraints
from pyro.contrib.gp.kernels.kernel import Kernel
from pyro.nn.module import PyroParam
class Constant(Kernel):
r"""
Implementation of Constant kernel:
:math:`k(x, z) = \sigma^2.`
"""
def __init__(self, input_dim, variance=None, active_... | [
"torch.tensor"
] | 1.3.0 | Capri2014/pyro | 546f9010aeb2308ae566726b1cec67a7b4fda9c2 |
1.3 | """
This example demonstrates the functionality of `pyro.contrib.minipyro`,
which is a minimal implementation of the Pyro Probabilistic Programming
Language that was created for didactic purposes.
"""
import argparse
import torch
from pyro.generic import distributions as dist
# We use the pyro.generic interface to s... | [
"torch.manual_seed",
"torch.tensor",
"torch.randn"
] | 1.3.0 | Capri2014/pyro | 546f9010aeb2308ae566726b1cec67a7b4fda9c2 |
1.3 | import torch
import pyro.distributions as dist
from pyro.ops.hessian import hessian
from tests.common import assert_equal
def test_hessian_mvn():
tmp = torch.randn(3, 10)
cov = torch.matmul(tmp, tmp.t())
mvn = dist.MultivariateNormal(cov.new_zeros(3), cov)
x = torch.randn(3, requires_grad=True)
... | [
"torch.cat",
"torch.randn"
] | 1.3.0 | Capri2014/pyro | 546f9010aeb2308ae566726b1cec67a7b4fda9c2 |
1.0 | '''Evaluation script'''
import argparse
from pathlib import Path
import numpy as np
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
from PIL import Image
from albumentations import Compose
from albumentations import CenterCrop
from torchvision.transforms.functional import to_pil_image
... | [
"torch.no_grad",
"torch.utils.data.DataLoader",
"torch.load"
] | 1.0.1 | mknz/dsr-road-roughness-prediction | 5f56b6ba5da70a09f2c967b7f32c740072e20ed1 |
1.1 | import pytest
import torch
from espnet2.tts.fastspeech2 import FastSpeech2
@pytest.mark.parametrize("postnet_layers", [0, 1])
@pytest.mark.parametrize("reduction_factor", [1, 2, 3])
@pytest.mark.parametrize(
"spk_embed_dim, spk_embed_integration_type",
[(None, "add"), (2, "add"), (2, "concat")],
)
@pytest.ma... | [
"torch.randint",
"torch.no_grad",
"torch.tensor",
"torch.randn"
] | 1.1.0 | jefflai108/espnet | a51f21cb94a4dead2300a8a13adb92ffdfbafbe8 |
1.0 | # coding=utf-8
# Copyright 2021 The Fairseq Authors, Microsoft Research, and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www... | [
"torch.nn.Linear",
"torch.nn.functional.unfold",
"torch.cat",
"torch.stack",
"torch.nn.ModuleList",
"torch.nn.init.kaiming_normal_",
"torch.ones",
"torch.nn.CrossEntropyLoss",
"torch.where",
"torch.nn.functional.ctc_loss",
"torch.sigmoid",
"torch.nn.LayerNorm",
"torch.nn.Conv1d",
"torch.nn... | 1.0 | Lemswasabi/transformers | 1762ded30a49649bdd5f8f5ee38b46dea051026a |
1.6 | from torch.nn import Embedding
import pytest
from fixtures import *
from perceiver_pytorch.modalities import InputModalityWithEmbedding
from perceiver_pytorch.multi_modality_with_text_perceiver import MultiModalityWithTextPerceiver
def test_embedding_for_layer(text_inputs):
text_modality = InputModalityWithEmbed... | [
"torch.nn.Embedding"
] | 1.6 | fac2003/perceiver-pytorch | b07d5154c5dee63684c59f57d02a1b405701845f |
1.9 | #! /usr/bin/env python
# Copyright (c) 2019 Uber Technologies, Inc.
#
# 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 a... | [
"torch.Size",
"torch.softmax",
"torch.tensor",
"torch.argmax"
] | 1.9.0 | hfurkanbozkurt/ludwig | bfcbd52237c73702764e733ede4351e0146394bd |
1.7 | # 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.device",
"torch.cuda.is_available",
"torch.as_tensor",
"torch.randn"
] | 1.7 | function2-llx/MONAI | 4cddaa830b61b88ec78e089bb5f21e05bb1a78f4 |
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.cuda.is_available",
"torch.tensor"
] | 1.6 | function2-llx/MONAI | 2fef7ff5c064a9ff6b6d6b4f2323180afed99934 |
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.as_tensor"
] | 1.6 | function2-llx/MONAI | e0db5a564225a7cb62e7a23df97267019006302f |
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.tensor"
] | 1.6 | function2-llx/MONAI | e0db5a564225a7cb62e7a23df97267019006302f |
1.7 | # 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.cuda.amp.autocast"
] | 1.7 | function2-llx/MONAI | 4cddaa830b61b88ec78e089bb5f21e05bb1a78f4 |
1.7 | # Copyright 2020 - 2022 -> (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... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.Dropout",
"torch.nn.Identity",
"torch.cat",
"torch.roll",
"torch.nn.ModuleList",
"torch.nn.Softmax",
"torch.arange",
"torch.nn.functional.layer_norm",
"torch.no_grad",
"torch.meshgrid",
"torch.utils.checkpoint.checkpoint",
"torch.flatten",
"tor... | 1.7 | function2-llx/MONAI | 4cddaa830b61b88ec78e089bb5f21e05bb1a78f4 |
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.cuda.is_available",
"torch.tensor"
] | 1.6 | function2-llx/MONAI | e0db5a564225a7cb62e7a23df97267019006302f |
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.utils.data.DataLoader"
] | 1.6 | function2-llx/MONAI | e0db5a564225a7cb62e7a23df97267019006302f |
1.7 | # 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.cat",
"torch.stack",
"torch.isnan",
"torch.tensor",
"torch.isinf",
"torch.as_tensor",
"torch.log",
"torch.exp"
] | 1.7 | function2-llx/MONAI | 4cddaa830b61b88ec78e089bb5f21e05bb1a78f4 |
1.10 | import torch.nn as nn
from torch.optim import Adam
from src.models.Seq2seq import Seq2Seq
from src.models.Decoder import Decoder, OneStepDecoder, OneStepDecoderWithAttention, DecoderWithAttention
from src.models.Encoder import Encoder, EncoderAttention
from src.models.Attention import Attention
from src.data.config imp... | [
"torch.nn.CrossEntropyLoss"
] | 1.10.1 | mhannani/ZinVert | d54e1ab1980ed70945c34d2ceb294d559126f623 |
1.4 | import os
import time
import torch
import numpy as np
from PIL import Image, ImageDraw
from matplotlib import pyplot as plt
from torch.utils.data import DataLoader, random_split
from data_utils import MyTestDataset, get_test_transforms
from models import Darknet
from utils import non_max_suppression
from conf.setting... | [
"torch.no_grad",
"torch.cuda.is_available",
"torch.utils.data.DataLoader"
] | 1.4.0 | Ondrados/bachelor-thesis | 1ce6f40dfdeadbdcc31a1cce785962f9cf3145fd |
1.5 | """
=====================
Vector autoregression
=====================
This example demonstrates how one can validate :code:`deepdow` on synthetic data.
We choose to model our returns with the vector autoregression model (VAR).
This model links future returns to lagged returns with a linear
model. See [Lütkepohl2005]_ ... | [
"torch.zeros"
] | 1.5 | owen1998-liu/deepdow | a815fb8072015b79e90aef619c196ea9a9389e7f |
1.4 | import torch
import torch.nn.functional as F
import torchvision
from torchvision import transforms
import os
import numpy as np
import time
from src import utils as ut
from sklearn.metrics import confusion_matrix
import skimage
from src import wrappers
from torchvision import transforms
from haven import haven_utils a... | [
"torch.sigmoid"
] | 1.4.0 | AliKhoda/DeepFish | 6769e83ab0b586e49f48e28f70607d33b5c36718 |
0.4 | from torch import nn
from torch.autograd import Variable
import torch
from utils import score, BCELoss
import numpy as np
UNK_IDX = 0
EOS_IDX = 2
class SigmoidSiameseRNN(nn.Module):
def __init__(self, config, data_config):
super(SigmoidSiameseRNN, self).__init__()
self.mode = config['mode']
... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.SELU",
"torch.nn.LSTM",
"torch.stack",
"torch.squeeze",
"torch.nn.Softmax",
"torch.norm",
"torch.FloatTensor",
"torch.unsqueeze",
"torch.abs",
"torch.nn.init.normal_",
"torch.tensor",
"torch.nn.init.xavier_normal_",
"torch.max",
"torch.nn.Tanh"... | 0.4.0 | alanwang93/ATEC2018-NLP-PyTorch | 8e00c6af1d3e1db7ab4433a0587784e45f830347 |
1.7 | # 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.Sequential"
] | 1.7.1 | MikeTrizna/lightning-flash | 8d68c32a20d5910a255b6fc9ef6851b091cb6ed6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.