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.2 | import os
from torch.utils.data import DataLoader
from continuum.datasets import CIFAR10, InMemoryDataset
from continuum.datasets import MNIST
import torchvision
from continuum.scenarios import TransformationIncremental
import pytest
import numpy as np
from continuum.transforms.bg_swap import BackgroundSwap
DATA_PAT... | [
"torch.utils.data.DataLoader"
] | 1.2.0 | pclucas14/continuum | 09034db1371e9646ca660fd4d4df73e61bf77067 |
1.8 | """Timer class based on the timeit.Timer class, but torch aware."""
import enum
import timeit
import textwrap
from typing import Any, Callable, Dict, List, NoReturn, Optional, Type, Union
import numpy as np
import torch
from torch.utils.benchmark.utils import common, cpp_jit
from torch.utils.benchmark.utils._stubs imp... | [
"torch.cuda.synchronize",
"torch.utils.benchmark.utils.common.TaskSpec",
"torch.utils.benchmark.utils.valgrind_wrapper.timer_interface.wrapper_singleton",
"torch.utils.benchmark.utils.common.set_torch_threads",
"torch.cuda.is_available",
"torch.utils.benchmark.utils.common.Measurement",
"torch.utils.ben... | 1.8.1 | GOOGLE-M/SGC | 78ad8d02b80808302e38559e2d0f430f66a809bd |
1.1 |
from .single_stage import SingleStageDetector
from ..registry import DETECTORS
from mmdet.core import bbox2result
import torch.nn as nn
import torch
from .. import builder
import numpy as np
import cv2
from mmdet.core import bbox2roi, bbox2result, build_assigner, build_sampler
@DETECTORS.register_module
class CSP(Sin... | [
"torch.tensor"
] | 1.1 | mohammedshariqnawaz/Pedestron | 9785feb94f00e07ae24a662525b4678f12d0fdc8 |
1.0 | import torch
from torch import nn
from torch.distributions import MultivariateNormal
class Normal(nn.Module):
def __init__(self, num_vars=100):
super(Normal, self).__init__()
self.num_vars = num_vars
self.means = nn.Parameter(torch.zeros(num_vars))
self.std = nn.Parameter(torch.ey... | [
"torch.zeros",
"torch.distributions.MultivariateNormal",
"torch.eye"
] | 1.0.1 | insilicomedicine/TRIP | 5e7b9da298aa47a71c71e1144ff1d8e538dbccaa |
1.0 | import torch
import torch.nn as nn
from torch import autograd
import torch.optim as optim
from ...utils import TrainStats
class WGAN(nn.Module):
def __init__(self, gen, discr, prior, n_critic=5, gamma=1, gp=True,
device='cpu'):
super(WGAN, self).__init__()
self.gen = gen
... | [
"torch.zeros",
"torch.rand"
] | 1.0.1 | insilicomedicine/TRIP | 5e7b9da298aa47a71c71e1144ff1d8e538dbccaa |
1.8 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributions as td
class Flow(nn.Module):
"""
Building both normalizing flows and neural flows.
Example:
>>> import stribor as st
>>> torch.manual_seed(123)
>>> dim = 2
>>> flow = st.Flow(st.UnitN... | [
"torch.zeros_like",
"torch.nn.ModuleList"
] | 1.8.0 | mbilos/stribor | 76082c255653d6bd8d506519223183e5d8395578 |
1.8 | import torch
import torch.nn as nn
import torch.nn.functional as F
def diff(x, dim=-1):
"""
Inverse of x.cumsum(dim=dim).
Compute differences between subsequent elements of the tensor.
Only works on dims -1 and -2.
Args:
x (tensor): Input of arbitrary shape
Returns:
diff (tens... | [
"torch.zeros_like",
"torch.nn.functional.pad"
] | 1.8.0 | mbilos/stribor | 76082c255653d6bd8d506519223183e5d8395578 |
3 | import sys
import math
import os
import torch
import torchvision
import numpy as np
from pkg_resources import resource_stream
def interpolate1d(x, values, tangents):
'''
Returns:
Returns the interpolated or extrapolated values for each query point,
depending on whether or not the query lies w... | [
"torch.is_tensor",
"torch.square",
"torch.abs",
"torch.tensor",
"torch.as_tensor",
"torch.where"
] | 3 | jmendozais/SDSSDepth | 7a4d0c5affef3eda7056876ccb2365ac883c08eb |
1.8 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
import sys
import unittest
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
import torch.nn as nn
import torch.optim as optim
from opacus import PrivacyEngine
from opacus.distributed ... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.MSELoss",
"torch.distributed.destroy_process_group",
"torch.distributed.init_process_group",
"torch.norm",
"torch.multiprocessing.spawn",
"torch.nn.parallel.DistributedDataParallel",
"torch.cuda.device_count",
"torch.manual_seed",
"torch.nn.ReLU",
"t... | 1.8 | RQuispeC/opacus | 5c83d59fc169e93667946204f7a6859827a38ace |
1.4 | # Copyright (c) 2020 NVIDIA CORPORATION.
# Copyright (c) 2018-2020 Chris Choy (chrischoy@ai.stanford.edu).
#
# 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 wit... | [
"torch.nn.init.constant_",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"torch.no_grad",
"torch.nn.Module.__init__",
"torch.nn.functional.log_softmax",
"torch.nn.functional.cross_entropy",
"torch.cuda.empty_cache",
"torch.utils.data.DataLoader",
"torch.cuda.is_available",
"torch.zeros_like",
"t... | 1.4 | NNstorm/MinkowskiEngine | 443b37a58c379b2482b5d160d9e874b356b4bf2f |
1.4 | # Copyright (c) 2020 NVIDIA CORPORATION.
# Copyright (c) 2018-2020 Chris Choy (chrischoy@ai.stanford.edu).
#
# 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 wit... | [
"torch.rand",
"torch.IntTensor",
"torch.FloatTensor",
"torch.from_numpy",
"torch.all",
"torch.cuda.is_available"
] | 1.4 | NNstorm/MinkowskiEngine | 443b37a58c379b2482b5d160d9e874b356b4bf2f |
1.7 | # Copyright (c) Aishwarya Kamath & Nicolas Carion. Licensed under the Apache License 2.0. All Rights Reserved
"""
COCO dataset which returns image_id for evaluation.
Mostly copy-paste from https://github.com/ashkamath/mdetr/blob/main/datasets/gqa.py
"""
import json
from pathlib import Path
import torch
import torchvi... | [
"torch.utils.data.ConcatDataset",
"torch.as_tensor"
] | 1.7.0 | TopCoder2K/mdetr | aedfd63f550ae36d1477484c489a2aa438d10aa3 |
1.6 | # Copyright 2020 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.zeros",
"torch.unbind",
"torch.no_grad",
"torch.nn.BCEWithLogitsLoss",
"torch.log",
"torch.exp"
] | 1.6.0 | Karol-G/nnUNet | a30bdbd64254c94c515ee03617173eb217eea505 |
1.7 | import torch
from torch.optim import Optimizer
class OptimWrapper(Optimizer):
# Mixin class that defines convenient functions for writing Optimizer Wrappers
def __init__(self, optim):
self.optim = optim
def __getstate__(self):
return self.optim.__getstate__()
def __sets... | [
"torch.no_grad"
] | 1.7.1 | aknckaan/scrl | bff485e27d8785628e35d2cb73dce06f10065b1f |
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.zeros",
"torch.nn.Dropout",
"torch.stack",
"torch.from_numpy",
"torch.ones",
"torch.nn.functional.log_softmax",
"torch.full",
"torch.nn.KLDivLoss",
"torch.nn.functional.softmax",
"torch.nn.CrossEntropyLoss"
] | 1.0 | stevezheng23/fewshot_nlp_pt | aaca4658aaa48a5a45dfd7d5ee7282d7f7c74be2 |
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.zeros",
"torch.nn.Dropout",
"torch.nn.MSELoss",
"torch.einsum",
"torch.arange",
"torch.from_numpy",
"torch.ones",
"torch.eye",
"torch.nn.BCEWithLogitsLoss",
"torch.nn.CrossEntropyLoss"
] | 1.0 | stevezheng23/fewshot_nlp_pt | aaca4658aaa48a5a45dfd7d5ee7282d7f7c74be2 |
1.5 | import torch
import numpy as np
def get_sigmas(config):
if config.model.sigma_dist == 'geometric':
sigmas = torch.tensor(
np.exp(np.linspace(np.log(config.model.sigma_begin), np.log(config.model.sigma_end),
config.model.num_classes))).float().to(config.device)
... | [
"torch.cos",
"torch.nn.MSELoss",
"torch.sin",
"torch.no_grad",
"torch.linspace",
"torch.sign",
"torch.ones",
"torch.randn_like",
"torch.zeros_like",
"torch.transpose",
"torch.randn"
] | 1.5.0 | Sriram-Ravula/ncsnv2 | f610b59441a34063fae1c02aa06837b7eec95c03 |
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 warnings
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from args import argument_parser, image_dataset_kwargs, optimizer_kwa... | [
"torch.cat",
"torch.trace",
"torch.max",
"torch.norm",
"torch.no_grad",
"torch.optim.Adam",
"torch.optim.SGD",
"torch.sign",
"torch.pow",
"torch.cuda.is_available",
"torch.zeros_like",
"torch.nn.DataParallel",
"torch.svd"
] | 0.4.1 | hsfzxjy/svdnet-pytorch | 8f485d0b162c23b20449f7ee80c955e0b20950ae |
1.13 | import logging
import os
import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader
import torchvision.transforms as transforms
from torch.utils.data.distributed import DistributedSampler
from .dataset import CheXpert
def _get_mean_and_std(dataset: Dataset):
"""Compute the mean and std of ... | [
"torch.zeros",
"torch.from_numpy",
"torch.utils.data.DataLoader",
"torch.utils.data.distributed.DistributedSampler"
] | 1.13.1 | ray-ruisun/FedML | 24ff30d636bb70f64e94e9ca205375033597d3dd |
1.13 | import numpy as np
import scipy.sparse as sp
import torch
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from torch_geometric.utils import to_networkx, degree
import torch.nn.functional as F
def convert_to_nodeDegreeFeatures(graphs):
# print(graph.x)
gra... | [
"torch.cat",
"torch.nn.functional.one_hot",
"torch.from_numpy",
"torch.as_tensor"
] | 1.13.1 | ray-ruisun/FedML | 24ff30d636bb70f64e94e9ca205375033597d3dd |
1.0 | import copy
import math
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from utils.utils import clones
class LayerNormGoogle(nn.Module):
def __init__(self, features, epsilon=1e-6):
super(LayerNormGo... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.Dropout",
"torch.cos",
"torch.nn.Embedding",
"torch.sin",
"torch.arange",
"torch.nn.init.xavier_uniform_",
"torch.nn.ReLU",
"torch.ones",
"torch.matmul",
"torch.nn.functional.softmax",
"torch.Tensor",
"torch.mean"
] | 1.0.1 | SunYanCN/nlp-experiments-in-pytorch | 5d05a53146dffd707e4d037230656f980d7be05c |
1.7 | import pandas as pd
import numpy as np
import torch
from sklearn.model_selection import train_test_split
from backend.services.toxic_comment_jigsaw.application.ai.model import BERTClassifier
from backend.services.toxic_comment_jigsaw.application.ai.training.src.dataset import BERTDataset
from backend.services.toxic_co... | [
"torch.utils.data.DataLoader"
] | 1.7.0 | R-aryan/Jigsaw-Toxic-Comment-Classification | e5e4da7df379ac1b315f2bde655386180f39c517 |
1.9 | #!/usr/bin/env python3
import unittest
import torch
import gpytorch
from gpytorch.test.variational_test_case import VariationalTestCase
class TestUnwhitenedVariationalGP(VariationalTestCase, unittest.TestCase):
@property
def batch_shape(self):
return torch.Size([])
@property
def distributi... | [
"torch.Size"
] | 1.9 | jrg365/gpytorch | 52bf07a3a3c55a570b22ff2bf3825adf4a6e259d |
1.4 | import time
import torch
from options.train_options import TrainOptions
from data import create_dataset
from models import create_model
from util.visualizer import Visualizer
if __name__ == '__main__':
opt = TrainOptions().parse() # get training options
dataset = create_dataset(opt) # create a dataset give... | [
"torch.cuda.synchronize"
] | 1.4.0 | sumanyumuku98/contrastive-unpaired-translation | 91738727123252e39c4e23f75f93cad737c0d718 |
1.3 | import torch
from .optimizer import Optimizer
class Adagrad(Optimizer):
"""Implements Adagrad algorithm.
It has been proposed in `Adaptive Subgradient Methods for Online Learning
and Stochastic Optimization`_.
Arguments:
params (iterable): iterable of parameters to optimize or dicts defining... | [
"torch.full_like"
] | 1.3.1 | countBMB/BenjiRepo | 79d882263baaf2a11654ca67d2e5593074d36dfa |
1.3 | from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import torch
import sys
import unittest
from scipy import interpolate
import caffe2.python.hypothesis_test_util as hu
from caffe2.python import core, ... | [
"torch.Tensor"
] | 1.3.1 | countBMB/BenjiRepo | 79d882263baaf2a11654ca67d2e5593074d36dfa |
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 | squalidux/stable-baselines3 | 72690b3ed0635c68f037b3dc121bd9987a6e82a8 |
1.8 | import os
from copy import deepcopy
import numpy as np
import pytest
import torch as th
from gym import spaces
from stable_baselines3 import A2C, DQN, PPO, SAC, TD3
from stable_baselines3.common.envs import FakeImageEnv
from stable_baselines3.common.preprocessing import is_image_space, is_image_space_channels_first
f... | [
"torch.allclose"
] | 1.8.1 | squalidux/stable-baselines3 | 72690b3ed0635c68f037b3dc121bd9987a6e82a8 |
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.cuda.device",
"torch.cuda.empty_cache",
"torch.cuda.amp.GradScaler"
] | 1.3 | songwanguw/pytorch-lightning | 64da9c9d87ac1c106d94310c4d90668fbafbb2cf |
1.10 | """Source code for distributed attentional actor architecture (DA3) model.
Author: Yoshinari Motokawa <yoshinari.moto@fuji.waseda.jp>
"""
from typing import List
import torch
from core.utils.logging import initialize_logging
from omegaconf import DictConfig
from torch import nn
from ..hard_shrink_attention import Ha... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.LayerNorm",
"torch.zeros"
] | 1.10.0 | Yoshi-0921/MAEXP | cc03fdd46db9b1838df8f7782b4bd1b2bb3f11d5 |
1.3 | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | [
"torch.no_grad",
"torch.clamp",
"torch.unsqueeze",
"torch.cuda.is_available",
"torch.mean"
] | 1.3.0 | jie311/vega | 1bba6100ead802697e691403b951e6652a99ccae |
1.3 | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | [
"torch.from_numpy"
] | 1.3.0 | jie311/vega | 1bba6100ead802697e691403b951e6652a99ccae |
1.1 | import numpy as np
import torch
import torch.nn.functional as F
import torch.nn as nn
from sklearn.utils import class_weight
from utils.lovasz_losses import lovasz_softmax
import pdb
def make_one_hot(labels, classes):
one_hot = torch.FloatTensor(labels.size()[0], classes, labels.size()[2], labels.size()[3]).zero_... | [
"torch.from_numpy",
"torch.nn.functional.softmax",
"torch.exp",
"torch.nn.CrossEntropyLoss"
] | 1.1.0 | 87003697/Segmentation | 5973a64768632fc52c55f9ffc9f0b43746699b37 |
1.10 | import pandas as pd
import torch
from transformers import BertJapaneseTokenizer
from wtfml.data_loaders.nlp.utils import clean_sentence
import transformers
class BERTSimpleDataset:
"""
Dataset for bert which can accept clearning function
"""
def __init__(self, input_texts, target, clearning... | [
"torch.tensor"
] | 1.10.0 | jphacks/C_2111 | df87580614d7e5c225ea30746e5f2cd0576bbc98 |
1.4 | """
Implementation from: https://raw.githubusercontent.com/Zenglinxiao/OpenNMT-py/bert/onmt/encoders/bert.py
@Author: Zenglinxiao
"""
import torch.nn as nn
from onmt.encoders.transformer import TransformerEncoderLayer
from onmt.utils.misc import sequence_mask
class BertEncoder(nn.Module):
"""BERT Encoder: A Tran... | [
"torch.nn.Linear",
"torch.nn.Tanh",
"torch.nn.LayerNorm"
] | 1.4.0 | SivilTaram/dialogue-utterance-rewriter-pytorch | 92c2254958b7a1ee9199836f7f2236575270983f |
1.4 | #!/usr/bin/env python
""" Convert weights of huggingface Bert to onmt Bert"""
from argparse import ArgumentParser
import torch
from onmt.encoders.bert import BertEncoder
from onmt.models.bert_generators import BertPreTrainingHeads
from onmt.modules.bert_embeddings import BertEmbeddings
from collections import OrderedDi... | [
"torch.save",
"torch.load"
] | 1.4.0 | SivilTaram/dialogue-utterance-rewriter-pytorch | 92c2254958b7a1ee9199836f7f2236575270983f |
1.4 | #!/usr/bin/env python
"""Training on a single process."""
import os
import torch
from onmt.inputters.inputter import build_dataset_iter, \
load_old_vocab, old_style_vocab, build_dataset_iter_multiple
from onmt.model_builder import build_model
from onmt.utils.optimizers import Optimizer
from onmt.utils.misc import... | [
"torch.cuda.set_device",
"torch.load"
] | 1.4.0 | SivilTaram/dialogue-utterance-rewriter-pytorch | 92c2254958b7a1ee9199836f7f2236575270983f |
1.0 | """
Here come the tests for attention types and their compatibility
"""
import unittest
import torch
from torch.autograd import Variable
import onmt
class TestAttention(unittest.TestCase):
def test_masked_global_attention(self):
source_lengths = torch.IntTensor([7, 3, 5, 2])
# illegal_weights_m... | [
"torch.IntTensor",
"torch.randn"
] | 1.0 | deep-spin/SIGMORPHON2019 | 60cf3b53be42e76238e7928405b2916cd9aed6c4 |
1.0 | import torch
import torch.nn as nn
from torch.autograd import Function
from onmt.utils.misc import aeq as assert_equal
from onmt.modules.sparse_activations import sparsemax
def _fy_backward(ctx, grad_output):
p_star, = ctx.saved_tensors
grad = grad_output.unsqueeze(1) * p_star
return grad
def _omega_sp... | [
"torch.einsum",
"torch.full_like"
] | 1.0 | deep-spin/SIGMORPHON2019 | 60cf3b53be42e76238e7928405b2916cd9aed6c4 |
1.1 | import torch
import numpy as np
import smplx
from smplx import SMPL as _SMPL
from smplx.body_models import ModelOutput
from smplx.lbs import vertices2joints
import spin.config as config
import spin.constants as constants
class SMPL(_SMPL):
""" Extension of the official SMPL implementation to support more joints "... | [
"torch.cat",
"torch.tensor"
] | 1.1.0 | krumo/SPIN | 0e2f17e70f06de46e062683ea6d5b233eeaa73c1 |
0.4 | import torch
from torch.autograd import Variable
import torch.nn.functional as F
import torchvision.transforms as transforms
import torch.nn as nn
import torch.utils.data
import numpy as np
from opt import opt
from dataloader import VideoLoader, DetectionLoader, DetectionProcessor, DataWriter, Mscoco
from yolo.util i... | [
"torch.cat",
"torch.no_grad",
"torch.multiprocessing.set_start_method",
"torch.multiprocessing.set_sharing_strategy"
] | 0.4.0 | mdraw/AlphaPose | bed8e0798f6deed4789b9ae2646f72b9fd138c5b |
1.7 | import sys
import os
import torch
import pandas as pd
import datetime
from argparse import ArgumentParser
import numpy as np
from torch import nn, optim
import torch.nn.functional as F
from torch.utils.data import DataLoader, random_split
from icecream import ic
import pytorch_lightning as pl
from pytorch_lightning.me... | [
"torch.cat",
"torch.var",
"torch.tensor",
"torch.empty",
"torch.mean"
] | 1.7.1 | HabibMrad/uncertainty | 1646a9b07d1179045dd0375149250d5ac7501004 |
1.1 | import os
import torch
from tensorboardX import SummaryWriter
import time
import glob
import re
import datetime
import argparse
from pathlib import Path
import torch.distributed as dist
from pcdet.datasets import build_dataloader
from pcdet.models import build_network
from pcdet.utils import common_utils
from pcdet.con... | [
"torch.distributed.get_world_size",
"torch.no_grad"
] | 1.1 | TillBeemelmanns/OpenPCDet | b7553c879d0ba36477931efe07a55adbc39823b9 |
1.1 | import numpy as np
import torch
import random
import logging
import os
import torch.multiprocessing as mp
import torch.distributed as dist
import subprocess
import pickle
import shutil
def check_numpy_to_torch(x):
if isinstance(x, np.ndarray):
return torch.from_numpy(x).float(), True
return x, False
... | [
"torch.distributed.get_world_size",
"torch.cat",
"torch.stack",
"torch.distributed.init_process_group",
"torch.multiprocessing.set_start_method",
"torch.manual_seed",
"torch.distributed.is_initialized",
"torch.tensor",
"torch.distributed.get_rank",
"torch.cos",
"torch.cuda.device_count",
"torc... | 1.1 | TillBeemelmanns/OpenPCDet | b7553c879d0ba36477931efe07a55adbc39823b9 |
0.4 | import argparse
import os
import numpy as np
import math
import itertools
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
from mnistm import MNISTM
import torch.nn as nn
... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.MSELoss",
"torch.nn.Softmax",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"torch.nn.Tanh",
"torch.nn.BatchNorm2d",
"torch.nn.LeakyReLU",
"torch.nn.ConvTranspose2d",
"torch.nn.ReLU",
"torch.nn.init.normal_",
"torch.cuda.is_available",
"torch.n... | 0.4.0 | Napkin-DL/PyTorch-GAN | 4668fb434a74a4e4771631944e4abfb0ec1c8795 |
0.4 | import argparse
import os
import numpy as np
import math
import itertools
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
from mnistm import MNISTM
import torch.nn as nn
... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.BatchNorm2d",
"torch.nn.LeakyReLU",
"torch.cuda.is_available",
"torch.nn.CrossEntropyLoss",
"torch.nn.Softmax",
"torch.nn.init.constant_",
"torch.nn.ConvTranspose2d",
"torch.nn.init.normal_",
"torch.nn.functional.sigmoid",
"torch.nn.Sequential",
"tor... | 0.4.0 | Napkin-DL/PyTorch-GAN | 4668fb434a74a4e4771631944e4abfb0ec1c8795 |
0.4 | import argparse
import os
import numpy as np
import math
import itertools
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
from mnistm import MNISTM
import torch.nn as nn
... | [
"torch.nn.Linear",
"torch.nn.functional.sigmoid",
"torch.cat",
"torch.nn.MSELoss",
"torch.nn.Softmax",
"torch.nn.init.constant_",
"torch.nn.Tanh",
"torch.nn.BatchNorm2d",
"torch.nn.LeakyReLU",
"torch.nn.ConvTranspose2d",
"torch.nn.ReLU",
"torch.nn.init.normal_",
"torch.cuda.is_available",
... | 0.4.0 | Napkin-DL/PyTorch-GAN | 4668fb434a74a4e4771631944e4abfb0ec1c8795 |
1.7 | # -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ expert.py ]
# Synopsis [ the phone linear downstream wrapper ]
# Author [ S3PRL ]
# Copyright [ Copyleft(c), Speech Lab, NTU, Taiwan ]
"""******************... | [
"torch.nn.Linear",
"torch.zeros",
"torch.utils.data.DistributedSampler",
"torch.nn.utils.rnn.pad_sequence",
"torch.FloatTensor",
"torch.ones",
"torch.distributed.is_initialized",
"torch.LongTensor",
"torch.utils.data.DataLoader",
"torch.nn.CrossEntropyLoss"
] | 1.7.0 | andybi7676/s3prl | 0e5acc5d499a629f946d561d87e8924ba3eb004b |
1.0 | from torch.optim.lr_scheduler import _LRScheduler
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.optim.lr_scheduler import CosineAnnealingLR
class GradualWarmupScheduler(_LRScheduler):
""" Gradually warm-up(increasing) learning rate in optimizer.
Proposed in 'Accurate, Large Minibatch SGD: T... | [
"torch.zeros",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"torch.optim.SGD"
] | 1.0.1 | arielclj/singa-easy | fd4bc601a5501062936f874df14711a3cefa1346 |
1.6 | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"torch.cuda.empty_cache",
"torch.cuda.is_available",
"torch.nn.SyncBatchNorm.convert_sync_batchnorm"
] | 1.6 | randommm/pytorch-lightning | 10e87b7b7acbbad8fc12ec5c07638ed093547ef8 |
0.4 | #!/usr/bin/env python
import random
import argparse
import cv2
import torch
import torch.nn as nn
import torch.optim as optim
from tensorboardX import SummaryWriter
import torchvision.utils as vutils
import gym
import gym.spaces
import numpy as np
log = gym.logger
log.set_level(gym.logger.INFO)
LATENT_VECTOR_SIZE... | [
"torch.zeros",
"torch.device",
"torch.nn.Sigmoid",
"torch.nn.Tanh",
"torch.nn.BatchNorm2d",
"torch.nn.ConvTranspose2d",
"torch.FloatTensor",
"torch.ones",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.tensor",
"torch.nn.BCELoss"
] | 0.4.1 | Yelloooowww/Deep-Reinforcement-Learning-Hands-On | d1a3a1272d7ceff8796fe412deb4e4d5bd6665a5 |
1.6 | import torch
from .elliptical_slice import EllipticalSliceSampler
class MeanEllipticalSliceSampler(EllipticalSliceSampler):
def __init__(self, f_init, dist, lnpdf, nsamples, pdf_params=()):
"""
Implementation of elliptical slice sampling (Murray, Adams, & Mckay, 2010).
f_init: initial val... | [
"torch.Size"
] | 1.6.0 | wjmaddox/pytorch_ess | 8e189666ce7381cf760666464384c634abbc4be2 |
1.2 | """
Implement input sentence encoder.
"""
import torch.nn as nn
from torch.nn.utils.rnn import pad_packed_sequence as unpack
from torch.nn.utils.rnn import pack_padded_sequence as pack
from .config import *
from common.constants import DEVICE
from util.tensor_utils import to_sorted_tensor, to_original_tensor
class En... | [
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.nn.GRU",
"torch.nn.utils.rnn.pack_padded_sequence"
] | 1.2.0 | project-delphi/ACS-QG | 03aa5b79030b5ba4c09a99363a58454743876592 |
1.4 | """ Bring-Your-Own-Blocks Network
A flexible network w/ dataclass based config for stacking those NN blocks.
This model is currently used to implement the following networks:
GPU Efficient (ResNets) - gernet_l/m/s (original versions called genet, but this was already used (by SENet author)).
Paper: `Neural Ar... | [
"torch.nn.Identity",
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.init.ones_",
"torch.nn.init.normal_",
"torch.nn.init.zeros_"
] | 1.4.0 | KnockerPulsar/pytorch-image-models | 893f5dde27ae6b17389f738bd6e37160e2868c72 |
1.8 | # -*- coding: utf-8 -*-
# @Time : 6/10/21 5:04 PM
# @Author : Yuan Gong
# @Affiliation : Massachusetts Institute of Technology
# @Email : yuangong@mit.edu
# @File : ast_models.py
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0,1,2,3"
import torch
import torch... | [
"torch.nn.Linear",
"torch.zeros",
"torch.cat",
"torch.nn.LayerNorm",
"torch.cuda.amp.autocast",
"torch.nn.functional.interpolate",
"torch.cuda.current_device",
"torch.nn.Conv2d",
"torch.cuda.is_available",
"torch.load",
"torch.randn",
"torch.nn.DataParallel",
"torch.sum"
] | 1.8.1 | jvel07/ast | 600e7cf952ec59ac9cc1bb3170d3da7578e1f384 |
1.7 | import torch
from ..utils.stream import ItemFeature
from .base_infocpler import BaseInfoCpler
class OCRVQAInfoCpler(BaseInfoCpler):
def __init__(self, cfg):
super().__init__(cfg)
def complete_info(self, item_feature: ItemFeature):
tokens = self.tokenizer.tokenize(item_feature.question.strip... | [
"torch.zeros",
"torch.Tensor",
"torch.tensor"
] | 1.7.1 | linxi1158/iMIX | 99898de97ef8b45462ca1d6bf2542e423a73d769 |
1.7 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn.utils.weight_norm import weight_norm
from ..builder import BACKBONES
@BACKBONES.register_module()
class CAGRAPH_BACKBONE(nn.Module):
def __init__(self, rnn_type, nlayers, ninp, nhid, dropout):
... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.Dropout",
"torch.gather",
"torch.nn.Sequential",
"torch.nn.Sigmoid",
"torch.nn.functional.dropout",
"torch.nn.Tanh",
"torch.bmm",
"torch.nn.functional.softmax",
"torch.topk"
] | 1.7.1 | linxi1158/iMIX | 99898de97ef8b45462ca1d6bf2542e423a73d769 |
1.7 | import torch
from ..builder import VOCAB
from .baseprocessor import BaseProcessor
@VOCAB.register_module()
class VocabProcessor(BaseProcessor):
"""Use VocabProcessor when you have vocab file and you want to process
words to indices. Expects UNK token as "<unk>" and pads sentences using
"<pad>" token. Con... | [
"torch.zeros",
"torch.tensor"
] | 1.7.1 | linxi1158/iMIX | 99898de97ef8b45462ca1d6bf2542e423a73d769 |
1.7 | import math
from bisect import bisect_right, bisect
from typing import List
from functools import lru_cache
import torch
from .builder import LR_SCHEDULERS
from torch.optim.lr_scheduler import LambdaLR, _LRScheduler
from .optimization import BertAdam
import imix.utils.distributed_info as comm
import logging
from trans... | [
"torch.cos"
] | 1.7.1 | linxi1158/iMIX | af87a17275f02c94932bb2e29f132a84db812002 |
1.1 | import torch.nn as nn
from ..registry import HEADS
from ..utils import ConvModule
from mmdetection.core import auto_fp16
@HEADS.register_module
class MGANHead(nn.Module):
def __init__(self,
num_convs=2,
roi_feat_size=7,
in_channels=512,
conv_ou... | [
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.ModuleList"
] | 1.1 | zjplab/Pedestron | 07e1a2cee82b57e1584b0c744f5b44f1ae92be73 |
1.1 | import torch.nn as nn
import torch.nn.functional as F
from mmdetection.ops import sigmoid_focal_loss as _sigmoid_focal_loss
from .utils import weight_reduce_loss
from ..registry import LOSSES
# This method is only for debugging
def py_sigmoid_focal_loss(pred,
target,
... | [
"torch.nn.functional.binary_cross_entropy_with_logits"
] | 1.1 | zjplab/Pedestron | 07e1a2cee82b57e1584b0c744f5b44f1ae92be73 |
1.4 | # -*- coding: utf-8 -*
import numpy as np
from loguru import logger
import torch
import torch.nn as nn
import torch.nn.functional as F
from videoanalyst.model.common_opr.common_block import (conv_bn_relu,
xcorr_depthwise)
from videoanalyst.model.module_base imp... | [
"torch.device",
"torch.sigmoid",
"torch.set_printoptions",
"torch.nn.init.normal_",
"torch.load"
] | 1.4.0 | 983632847/video_analyst | 01b7ad278b828a3f7ff7a0488c5ca8f055240192 |
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.from_numpy"
] | 1.5 | danielschulz/MONAI | 54ef6e9e700f0de3d50184c0148f953be871a58e |
1.7 | """
Package defining various dynamic forward models as well as convenience methods to generate the
right hand sides (RHS) of the related partial differential equations.
Currently, the following forward models are implemented:
#. An advection equation for images
#. An advection equation for maps
#. The EPDi... | [
"torch.empty_like",
"torch.zeros_like",
"torch.sum"
] | 1.7 | HastingsGreer/mermaid | bd13c5fc427eb8cd9054973a8eaaeb302078182d |
1.7 | """
This package enables easy single-scale and multi-scale optimization support.
"""
from __future__ import print_function
from __future__ import absolute_import
# from builtins import zip
# from builtins import str
# from builtins import range
# from builtins import object
from abc import ABCMeta, abstractmethod
impo... | [
"torch.is_tensor",
"torch.save",
"torch.optim.SGD",
"torch.from_numpy",
"torch.utils.data.DataLoader",
"torch.load",
"torch.optim.lr_scheduler.ReduceLROnPlateau"
] | 1.7 | HastingsGreer/mermaid | ba07883cc3cb5982e4655048a434b4495cb49c6d |
1.0 | # Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | [
"torch.device",
"torch.distributed.init_process_group",
"torch.cuda.device_count",
"torch.cuda.set_device",
"torch.cuda.is_available"
] | 1.0 | hlahkar/transformers | c19d04623eacfbc2c452397a5eda0fde42db3fc5 |
1.4 | import Archi
import yaml
def test_model_loading():
try:
config = yaml.safe_load(
open("./esbn_model_test_config.yaml", 'r'),
)
except yaml.YANNLError as e:
print(e)
from Archi import load_model
model = load_model(config)
assert 'KeyValueMemory' in model.... | [
"torch.rand"
] | 1.4 | Near32/Archi | 0005713fa4e37c7cd9b34cd257c481d08928db8a |
1.0 | # Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | [
"torch.from_numpy"
] | 1.0 | techthiyanes/transformers | 705d65368fb28246534ef636fe62c008f4fb2682 |
1.0 | # Copyright 2019 PIQuIL - All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed ... | [
"torch.device",
"torch.cat",
"torch.einsum",
"torch.nn.functional.linear",
"torch.cuda.is_available",
"torch.load",
"torch.zeros_like"
] | 1.0 | ZvonimirBandic/QuCumber | 81f0291951e89346fd8ab5c35cc90341fd8acf35 |
1.8 | import torch
from torch import nn
from torch.nn import functional as F
from torchutils import to_device
class FocalLoss(nn.Module):
"""weighted version of Focal Loss"""
def __init__(self, alpha=.25, gamma=2, device=None):
super(FocalLoss, self).__init__()
self.alpha = torch.tensor([alpha, 1 ... | [
"torch.nn.functional.cross_entropy",
"torch.tensor",
"torch.exp",
"torch.nn.functional.binary_cross_entropy"
] | 1.8.1 | tchaye59/torchutils | ca7b01bf63b6c3adaa36a4a66dfd87e927ef2460 |
1.1 | from __future__ import print_function
import errno
import os
from PIL import Image
import torch
import torch.nn as nn
import re
import json
import pickle as cPickle
import numpy as np
import utils
import h5py
import operator
import functools
from torch._six import string_classes
import torch.nn.func... | [
"torch.Size",
"torch.stack",
"torch.max",
"torch.is_tensor",
"torch.save",
"torch.sparse.FloatTensor",
"torch.from_numpy",
"torch.DoubleTensor",
"torch.LongTensor",
"torch.load",
"torch.zeros_like",
"torch.utils.data.dataloader.default_collate",
"torch.sum"
] | 1.1.0 | Zhiquan-Wen/D-VQA | 688c4dcc811f49b431daea81406e628ec71a7247 |
1.8 | #
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
"torch.tensor"
] | 1.8.1 | leo0519/TensorRT | 498dcb009fe4c2dedbe9c61044d3de4f3c04a41b |
0.3 | # pylint: disable=invalid-name
import glob
import os
import re
import time
import torch
import pytest
from allennlp.common.testing import AllenNlpTestCase
from allennlp.training.trainer import Trainer, sparse_clip_norm, is_sparse
from allennlp.data import Vocabulary
from allennlp.common.params import Params
from alle... | [
"torch.rand",
"torch.cuda.is_available",
"torch.nn.Embedding",
"torch.cuda.device_count"
] | 0.3.1 | vidurj/allennlp | 5b513d4f7c7365ac33b3cbc557506b46a9b50450 |
1.0 | import torchbearer
from torchbearer.callbacks import Callback
import torch
class WeightDecay(Callback):
"""Create a WeightDecay callback which uses the given norm on the given parameters and with the given decay rate.
If params is None (default) then the parameters will be retrieved from the model.
Exa... | [
"torch.norm"
] | 1.0.0 | NunoEdgarGFlowHub/torchbearer | 940e75ec88acd59d5a97aa8c721f7cfa30a5c4d0 |
1.0 | import torchbearer
from torchbearer import Callback
import torch
import torch.nn.functional as F
from torch.distributions import Beta
from torchbearer.bases import cite
bc = """
@inproceedings{tokozume2018between,
title={Between-class learning for image classification},
author={Tokozume, Yuji and Ushiku, Yoshitak... | [
"torch.zeros_like",
"torch.nn.functional.log_softmax"
] | 1.0.0 | NunoEdgarGFlowHub/torchbearer | 940e75ec88acd59d5a97aa8c721f7cfa30a5c4d0 |
1.0 | import unittest
from mock import Mock, call
from torchbearer.metrics import RunningMean, Metric, RunningMetric, Mean, Std, Var
import torch
class TestVar(unittest.TestCase):
def test_variance_dim(self):
var = Var('test', dim=0)
var.process(torch.Tensor([[1., 2.], [3., 4.]]))
var.process... | [
"torch.FloatTensor",
"torch.Tensor",
"torch.tensor",
"torch.Size"
] | 1.0.0 | NunoEdgarGFlowHub/torchbearer | 940e75ec88acd59d5a97aa8c721f7cfa30a5c4d0 |
1.3 | """Test torch algo utility functions."""
import numpy as np
import pytest
import tensorflow as tf
import torch
import torch.nn.functional as F
import metarl.tf.misc.tensor_utils as tf_utils
import metarl.torch.algos._utils as torch_algo_utils
from tests.fixtures import TfGraphTestCase
def stack(d, arr):
"""Stack... | [
"torch.nn.Linear",
"torch.Tensor"
] | 1.3.0 | icml2020submission6857/metarl | 9b66cefa2b6bcb6a38096d629ce8853b47c7171d |
1.3 | """GaussianMLPModule."""
import abc
import numpy as np
import torch
from torch import nn
from metarl.torch.distributions import TanhNormal
from metarl.torch.modules.mlp_module import MLPModule
from metarl.torch.modules.multi_headed_mlp_module import MultiHeadedMLPModule
class TanhGaussianMLPBaseModule2(nn.Module):
... | [
"torch.Tensor",
"torch.nn.Parameter"
] | 1.3.0 | icml2020submission6857/metarl | 9b66cefa2b6bcb6a38096d629ce8853b47c7171d |
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.
"""
Transformer Agents.
"""
from typing import Optional
from parlai.core.params import ParlaiParser
from parlai.core.opt i... | [
"torch.LongTensor"
] | 1.4.0 | dongfangyixi/ParlAI | 424a2b3c7086593f699c76612dffd1d925986177 |
0.4 | import os
import sys
import numpy as np
import pandas as pd
from torch.utils.data import Subset
from torch.utils.data.dataset import Dataset # For custom datasets
from torchvision import transforms
PROJECT_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.append(PROJECT_PATH)
... | [
"torch.utils.data.Subset"
] | 0.4.1 | ReyesDeJong/Deep-SVDD-PyTorch | 1fc7eae1474556f869d5c5422da74fd4fe2f1aed |
1.0 | # -*- coding: utf-8 -*-
"""
Romanization of Thai words based on machine-learnt engine ("thai2rom")
"""
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from pythainlp.corpus import download, get_corpus_path
device = torch.device("cuda:0" if torch.cuda.is_available()... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.Dropout",
"torch.cat",
"torch.nn.LSTM",
"torch.nn.functional.softmax",
"torch.FloatTensor",
"torch.from_numpy",
"torch.cuda.is_available",
"torch.tensor",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.load",
"torch.nn.Embedding",
"torch.sum"
] | 1.0.0 | Subarna578/pythainlp | 9650a40396719284add17bb09f50e948dea41053 |
1.8 | """This lobe enables the integration of huggingface pretrained wav2vec2/hubert/wavlm models.
Reference: https://arxiv.org/abs/2006.11477
Reference: https://arxiv.org/abs/1904.05862
Reference: https://arxiv.org/abs/2110.13900
Transformer from HuggingFace needs to be installed:
https://huggingface.co/transformers/instal... | [
"torch.nn.functional.layer_norm",
"torch.no_grad",
"torch.tensor",
"torch.load"
] | 1.8.0 | RaphaelOlivier/speechbrain | 142dc6caa4b46ca4c9341b0cd39627f489808749 |
0.4 | from urllib.request import urlopen
import torch
from torch import nn
import numpy as np
from skimage.morphology import label
import os
from HD_BET.paths import folder_with_parameter_files
def get_params_fname(fold):
return os.path.join(folder_with_parameter_files, "%d.model" % fold)
def maybe_download_parameter... | [
"torch.nn.init.constant",
"torch.nn.init.kaiming_normal",
"torch.exp"
] | 0.4.1 | evertdeman/HD-BET | 817a50d2fe9b8663646cc74652cb50e26f343a3b |
1.9 | import os
from collections import defaultdict
import numpy as np
import torch
from termcolor import colored
from torch.utils.tensorboard import SummaryWriter
from common import utils
class Manager():
def __init__(self, model, optimizer, scheduler, params, dataloaders, logger):
# params stat... | [
"torch.save",
"torch.utils.tensorboard.SummaryWriter",
"torch.load"
] | 1.9.1 | hxwork/OMNet | be88a734e7327def365e1875bbc7cd2fea1539b0 |
1.9 | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Define the siamese network for one-shot learning,
for french short labels
02/06/2021
@author: milena-git, from jeremylhour courtesy
"""
import torch
import torch.nn as nn
def _createEmbeddingLayer(weights_matrix, non_trainable=False):
"""
_createEmbeddingLay... | [
"torch.nn.Linear",
"torch.nn.Embedding.from_pretrained",
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.tensor",
"torch.nn.Embedding"
] | 1.9.0 | pengfei99/openfood | 2b65af02ce34bf8193d357ef3661da749d2d9671 |
0.20 | # from code.transformer_vid.utils import convert_weights
# import rotary_embedding_torch
from torch.nn.modules.activation import GELU, ReLU
# from data.OneCombo3.trainer import TrainerConfig
import math
import numpy as np
import itertools
import logging
import torch
import torch.nn as nn
from torch.nn import functiona... | [
"torch.nn.Linear",
"torch.cat",
"torch.optim.AdamW",
"torch.gt",
"torch.cuda.current_device",
"torch.ones",
"torch.cuda.is_available",
"torch.sum",
"torch.nn.PoissonNLLLoss",
"torch.topk",
"torch.nn.LayerNorm",
"torch.nan_to_num",
"torch.unsqueeze",
"torch.tensor",
"torch.nn.KLDivLoss",
... | 0.20.1 | woanderer/neuroformer | df3462d55977b6c9adcb6753e7c474b8b76e8021 |
0.20 | # from code.transformer_vid.utils import convert_weights
# import rotary_embedding_torch
from torch.nn.modules.activation import GELU, ReLU
# from data.OneCombo3.trainer import TrainerConfig
import math
import numpy as np
import itertools
import logging
import torch
import torch.nn as nn
from torch.nn import functiona... | [
"torch.nn.Linear",
"torch.cat",
"torch.optim.AdamW",
"torch.gt",
"torch.cuda.current_device",
"torch.ones",
"torch.cuda.is_available",
"torch.sum",
"torch.nn.PoissonNLLLoss",
"torch.topk",
"torch.nn.LayerNorm",
"torch.nan_to_num",
"torch.unsqueeze",
"torch.tensor",
"torch.nn.KLDivLoss",
... | 0.20.1 | woanderer/neuroformer | df3462d55977b6c9adcb6753e7c474b8b76e8021 |
1.1 | import torch.nn as nn
from .base import BaseLM
class IpaLM(BaseLM):
name = 'lstm'
def __init__(self, vocab_size, hidden_size, nlayers=1, dropout=0.1, embedding_size=None, **kwargs):
super().__init__(
vocab_size, hidden_size, nlayers=nlayers, dropout=dropout, embedding_size=embedding_size... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.nn.Embedding"
] | 1.1.0 | tpimentelms/meaning2form | 624b3947b3ac2a7a521cf35c762fb56508236f74 |
1.10 | """Model Predictive Control with a Gaussian Process model.
Based on:
* L. Hewing, J. Kabzan and M. N. Zeilinger, "Cautious Model Predictive Control Using Gaussian Process Regression,"
in IEEE Transactions on Control Systems Technology, vol. 28, no. 6, pp. 2736-2743, Nov. 2020, doi: 10.1109/TCST.2019.2949757.
... | [
"torch.diag_embed",
"torch.Tensor",
"torch.zeros",
"torch.diagonal",
"torch.from_numpy"
] | 1.10.2 | thaipduong/safe-control-gym | 69f8f627d232d50813a7fff6113dd6d5caccf930 |
1.4 | """ Pooling-based Vision Transformer (PiT) in PyTorch
A PyTorch implement of Pooling-based Vision Transformers as described in
'Rethinking Spatial Dimensions of Vision Transformers' - https://arxiv.org/abs/2103.16302
This code was adapted from the original version at https://github.com/naver-ai/pit, original copyrigh... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"torch.nn.Identity",
"torch.nn.ModuleList",
"torch.nn.init.constant_",
"torch.nn.Conv2d",
"torch.jit.is_scripting",
"torch.randn"
] | 1.4.0 | Animatory/pytorch-image-models | 3ace100fcfdab3619dc71307613c42e53fb70221 |
1.1 | '''
This code is based on pytorch_ssd and RFBNet.
Details about the modules:
TUM - Thinned U-shaped Module
MLFPN - Multi-Level Feature Pyramid Network
M2Det - Multi-level Multi-scale single-shot object Detector
Author: Qijie Zhao (zhaoqijie@pku.edu.cn)
Finished Date: 01/1... | [
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.Sigmoid",
"torch.nn.Sequential",
"torch.nn.BatchNorm2d",
"torch.nn.functional.interpolate",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.AdaptiveAvgPool2d"
] | 1.1 | ningdez/Tianchi_Cancer_303 | 59e9b6f906e48e7508f455ce29b97d430791fcf5 |
1.4 | import torch
import numpy as np
import argparse
import pandas as pd
import sys
import os
from torch import nn
from torch.nn import functional as F
import tqdm
import pprint
from src import utils as ut
import torchvision
from haven import haven_utils as hu
from haven import haven_chk as hc
from src import datasets, mod... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"torch.load"
] | 1.4.0 | DoranLyong/DeepFish | 3ea3e13653f708d4a8dcb54b990dcc2997edf4e9 |
1.8 | from torch import nn
import torch
from ..base import LinkPredictionBase
from .ConcatFeedForwardNNLayer import ConcatFeedForwardNNLayer
class ConcatFeedForwardNN(LinkPredictionBase):
r"""Specific class for link prediction task.
Parameters
----------
input_size : int
The length of inp... | [
"torch.nn.ReLU",
"torch.tensor"
] | 1.8.0 | stjordanis/graph4nlp | c6ebde32bc77d3a7b78f86a93f19b1c057963ffa |
1.10 | import torch
from node2vec import Node2Vec as Node2Vec_
from .brain_data import BrainData
from torch_geometric.data import Data
from networkx.convert_matrix import from_numpy_matrix
from .utils import binning, LDP
import networkx as nx
from .base_transform import BaseTransform
from numpy import linalg as LA
import nump... | [
"torch.zeros",
"torch.cat",
"torch.nan_to_num",
"torch.ones",
"torch.sparse_coo_tensor",
"torch.Tensor"
] | 1.10.2 | HennyJie/BrainGB | 96cf6711e2f2e6fa48b699ce3c0d6e318955c4de |
1.7 | """
---
title: CIFAR10 Experiment to try Group Normalization
summary: >
This trains is a simple convolutional neural network that uses group normalization
to classify CIFAR10 images.
---
# CIFAR10 Experiment for Group Normalization
"""
import torch.nn as nn
from labml import experiment
from labml.configs import ... | [
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.ReLU",
"torch.nn.Conv2d"
] | 1.7 | BioGeek/annotated_deep_learning_paper_implementations | e2516cc3063cdfdf11cda05f22a10082297aa33e |
1.7 | """
---
title: Compressive Transformer Experiment
summary: This experiment trains a compressive transformer model on tiny Shakespeare dataset.
---
# Compressive Transformer Experiment
This is an annotated PyTorch experiment to train a compressive transformer model.
"""
from typing import List, Tuple, NamedTuple
impo... | [
"torch.nn.Linear",
"torch.no_grad",
"torch.cat",
"torch.nn.Embedding"
] | 1.7 | BioGeek/annotated_deep_learning_paper_implementations | e2516cc3063cdfdf11cda05f22a10082297aa33e |
1.7 | """
---
title: Pay Attention to MLPs (gMLP)
summary: >
This is an annotated implementation/tutorial of Pay Attention to MLPs (gMLP) in PyTorch.
---
# Pay Attention to MLPs (gMLP)
This is a [PyTorch](https://pytorch.org) implementation of the paper
[Pay Attention to MLPs](https://papers.labml.ai/paper/2105.08050).
... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.LayerNorm",
"torch.einsum",
"torch.ones",
"torch.nn.GELU",
"torch.chunk"
] | 1.7 | BioGeek/annotated_deep_learning_paper_implementations | e2516cc3063cdfdf11cda05f22a10082297aa33e |
1.7 | """
---
title: Evaluate k-nearest neighbor language model
summary: >
This runs the kNN model and merges the kNN results with transformer output to
achieve better results than just using the transformer.
---
# Evaluate k-nearest neighbor language model
"""
from typing import Optional, List
import faiss
import nump... | [
"torch.no_grad",
"torch.tensor"
] | 1.7 | BioGeek/annotated_deep_learning_paper_implementations | e2516cc3063cdfdf11cda05f22a10082297aa33e |
1.7 | import torch
from algorithms.single_model_algorithm import SingleModelAlgorithm
from models.initializer import initialize_model
class GroupDRO(SingleModelAlgorithm):
"""
Group distributionally robust optimization.
Original paper:
@inproceedings{sagawa2019distributionally,
title={Distribu... | [
"torch.zeros",
"torch.exp"
] | 1.7.0 | KeAWang/wilds | 3b808a84bd477d7877b77675eec2953128a87033 |
1.7 | from torch import nn
class ConvolutionalBlock(nn.Module):
def __init__(self, in_channels=128, out_channels=256, kernel_size=3, padding=1, stride=1, padding_mode='zeros'):
super().__init__()
self.conv1 = nn.Conv1d(in_channels, out_channels, kernel_size=kernel_size, padding=padding, stride=stride,
... | [
"torch.nn.ReLU",
"torch.nn.BatchNorm1d",
"torch.nn.Conv1d"
] | 1.7.1 | plutasnyy/mgr | 4ca5686ba7d62d0e2b8c172f17eb90bd822fdc21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.