version stringclasses 24
values | code stringlengths 396 135k | apis list | full_version stringlengths 1 6 | repo_name stringlengths 6 64 | hexsha stringlengths 40 40 |
|---|---|---|---|---|---|
1.7 | import torch
from .casia_dataset import CasiaDataset
class DebugDataset(CasiaDataset):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._debug_image = torch.rand(3, 120, 120)
self._debug_label = torch.tensor(1)
def __getitem__(self, idx):
return {
... | [
"torch.rand",
"torch.tensor"
] | 1.7.0 | gyfastas/CS7319E1G16 | 03126af04766abcb269d0c8db481c96c856d21ef |
1.4 | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"torch.ones"
] | 1.4 | alanhdu/pytorch-lightning | b7a22ba046ba57072a71b12d16caff000e66f798 |
1.4 | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"torch.device"
] | 1.4 | alanhdu/pytorch-lightning | b7a22ba046ba57072a71b12d16caff000e66f798 |
1.4 |
from typing import Callable, Tuple
import numpy as np
import torch
import torchvision
import foolbox as fb
import time
from tqdm import tqdm
from models.base import AdversarialDefensiveModule
from .base import AdversaryForValid
from .config import *
from .utils import getLogger, mkdirs
class ModelNotDefineError(... | [
"torch.utils.data.Subset",
"torch.tensor"
] | 1.4.0 | MTandHJ/PyTorch-Robust | 3f046fce515a7ed66ab34079329cd3496ca5087c |
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.sigmoid",
"torch.argmax",
"torch.softmax"
] | 1.7 | Site-Command/lightning-flash | bfff08ded9cf193cce1cd16e7034d8005de172ae |
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.rand",
"torch.randint"
] | 1.7 | Site-Command/lightning-flash | bfff08ded9cf193cce1cd16e7034d8005de172ae |
3 | # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import math
import numpy as np
from typing import Tuple, Optional, Sequence
import torch
import torch.nn.functional as F
from pytorch3d.transforms import Rotate, Transform3d, Translate
from .utils import TensorProperties, convert_to_tensors_and_... | [
"torch.zeros",
"torch.nn.functional.normalize",
"torch.cat",
"torch.cos",
"torch.stack",
"torch.tan",
"torch.is_tensor",
"torch.sin",
"torch.ones",
"torch.tensor",
"torch.cross"
] | 3 | nikhilaravi/pytorch3d-1 | 2480723adf1ce8a5cfca5c190f5fba7a48549f75 |
1.9 | import math
import time
import torch
from copy import deepcopy
from tensornet.engine.ops.regularizer import l1
from tensornet.engine.ops.checkpoint import ModelCheckpoint
from tensornet.engine.ops.tensorboard import TensorBoard
from tensornet.data.processing import InfiniteDataLoader
from tensornet.utils.progress_bar ... | [
"torch.no_grad",
"torch.pow",
"torch.abs",
"torch.div",
"torch.sum"
] | 1.9.0 | shan18/TensorNet | c79a0c64152dbeb3499d204994772858326f668c |
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.
"""
PACER: Partial And Complete Efficient Re-ranking.
See `PacerTreeSearchMixin.modify_logprobs` for a complete descripti... | [
"torch.nn.functional.log_softmax"
] | 1.4.0 | MMnash/ParlAI | 7429016bce901b00f9bf4b06c82687d49cd548fa |
1.10 | #encoding:utf-8
import random
import numpy as np
import matplotlib as mpl
mpl.use('Agg')# AGG(Anti-Grain Geometry engine)
import matplotlib.pyplot as plt
import os
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data as data
import torchvision
from torchvision import models,transform... | [
"torch.zeros",
"torch.hann_window",
"torch.save",
"torch.squeeze",
"torch.LongTensor",
"torch.load",
"torch.zeros_like",
"torch.nn.functional.pad"
] | 1.10.1 | ishine/VITS-1 | 6b76bab881c801322ee3a8d8815ec06dd1c80980 |
1.7 | import torch
import torch.nn as nn
from torch.tensor import Tensor
from typing import Optional, Tuple, Union
def hopfield_core_forward(query, # type: Tensor
key, # type: Tensor
value, #... | [
"torch.jit._unwrap_optional",
"torch.nn.functional.dropout",
"torch.no_grad",
"torch.bmm",
"torch.ones",
"torch.nn.functional.linear",
"torch.jit.is_scripting",
"torch.tensor",
"torch.nn.functional.handle_torch_function",
"torch.nn.functional.softmax",
"torch.nn.functional.pad",
"torch.equal",... | 1.7.1 | shalei120/HopfieldLM | 3fba4ee05bfc7f5041593f95457ffdf0bdc094a3 |
1.10 | import torchaudio
import torch
class LJSpeechDataset(torchaudio.datasets.LJSPEECH):
def __init__(self, root: str):
super().__init__(root=root)
def __getitem__(self, index: int):
waveform, sr, _, transcript = super().__getitem__(index)
waveform_length = torch.tensor([waveform.shap... | [
"torch.tensor"
] | 1.10.0 | khaykingleb/HiFi-GAN | 6bafd6f8f67d2393e057cb64cd6c1311d59a85f0 |
0.4 | """
SqueezeNext for ImageNet-1K, implemented in PyTorch.
Original paper: 'SqueezeNext: Hardware-Aware Neural Network Design,' https://arxiv.org/abs/1803.10615.
"""
__all__ = ['SqueezeNext', 'sqnxt23_w1', 'sqnxt23_w3d2', 'sqnxt23_w2', 'sqnxt23v5_w1', 'sqnxt23v5_w3d2', 'sqnxt23v5_w2']
import os
import torch.nn ... | [
"torch.nn.Linear",
"torch.nn.init.kaiming_uniform_",
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.AvgPool2d",
"torch.nn.init.constant_",
"torch.nn.ReLU",
"torch.randn"
] | 0.4.0 | yick2232/imgclsmob | fb220bff18b27d1fc6db1bac6cf69b70c2d07490 |
0.4 | """
WRN for ImageNet-1K, implemented in PyTorch.
Original paper: 'Wide Residual Networks,' https://arxiv.org/abs/1605.07146.
"""
__all__ = ['WRN', 'wrn50_2']
import os
import torch.nn as nn
import torch.nn.init as init
class WRNConv(nn.Module):
"""
WRN specific convolution block.
Parameters:
... | [
"torch.nn.Linear",
"torch.nn.init.kaiming_uniform_",
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.AvgPool2d",
"torch.nn.init.constant_",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.randn"
] | 0.4.0 | yick2232/imgclsmob | fb220bff18b27d1fc6db1bac6cf69b70c2d07490 |
1.7 | import logging
import warnings
from typing import Optional, Union
import numpy as np
import torch
from anndata import AnnData
from scvi import _CONSTANTS
from scvi.model.base import (
BaseModelClass,
RNASeqMixin,
UnsupervisedTrainingMixin,
VAEMixin,
)
from scvi.module import VAEC
logger = logging.get... | [
"torch.cat",
"torch.no_grad"
] | 1.7.1 | morris-frank/scvi-tools | b828c75455bdd9e9558882d0b110ed97ba135184 |
0.4 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from utils.anchors import Anchors
class SiamMask(nn.Module):
def __init__(self, anchors=None, o_sz=127, g_sz=127):
super(SiamMask, self).__init__()
self.anchors = anchors # anchor_cfg
se... | [
"torch.nn.functional.nll_loss",
"torch.nn.functional.unfold",
"torch.nn.UpsamplingBilinear2d",
"torch.transpose",
"torch.nn.functional.log_softmax",
"torch.from_numpy",
"torch.mean",
"torch.nn.functional.soft_margin_loss",
"torch.index_select",
"torch.randn",
"torch.sum"
] | 0.4.1 | weihaosky/CycleSiam | 9d11f6cb236a6699185774e49ebafe8d2f867ebe |
1.6 | """
Copyright (c) 2017 Matterport, Inc.
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 datetime
import math
import os
import random
import re
import numpy as np
import torch
import torch.... | [
"torch.nn.Linear",
"torch.round",
"torch.cat",
"torch.nn.modules.utils._pair",
"torch.stack",
"torch.nn.functional.smooth_l1_loss",
"torch.nn.BatchNorm2d",
"torch.ones",
"torch.nn.functional.cross_entropy",
"torch.LongTensor",
"torch.load",
"torch.nn.functional.pad",
"torch.exp",
"torch.sq... | 1.6.0 | eva5covergence/EVA5_AI_Projects | 7052373c52b6b9901cd0bc05a4758dd4b63f7480 |
1.9 | from typing import Optional
import torch
from torch.nn import functional as F
def aa_to_rotmat(theta: torch.Tensor):
"""
Convert axis-angle representation to rotation matrix.
Works by first converting it to a quaternion.
Args:
theta (torch.Tensor): Tensor of shape (B, 3) containing axis-angle r... | [
"torch.zeros",
"torch.cos",
"torch.cat",
"torch.nn.functional.normalize",
"torch.stack",
"torch.sin",
"torch.einsum",
"torch.norm",
"torch.unsqueeze",
"torch.eye",
"torch.cross",
"torch.div"
] | 1.9.0 | michael-p-sachen/ProHMR | 0167d05a9a45939a217d02b4ef8fd67977c15f82 |
1.0 | # Copyright 2019 IBM Corporation
#
# 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, ... | [
"torch.cat",
"torch.from_numpy",
"torch.utils.data.DataLoader",
"torch.utils.data.TensorDataset"
] | 1.0 | ksrinivs64/lale | e0ffc357c3711940078718717aebc5b06c9dc4ae |
1.8 | # Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
import torch
from torch import nn
import torch.nn.functional as F
class NonLocalModule(nn.Module):
def __init__(self, in_channels, embed_dim=None, embed_factor=4, spatial_sub_sample=False):
super().__init__()
ass... | [
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.init.constant_",
"torch.nn.BatchNorm2d",
"torch.nn.init.kaiming_normal_",
"torch.nn.Conv2d",
"torch.nn.functional.softmax",
"torch.matmul"
] | 1.8 | ricklentz/deep-object-reid | bf4d30d78e4a34847496d0efb50d98541f5274f9 |
1.4 | import argparse
import datetime
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
from transformers import AutoTokenizer, get_linear_schedule_with_warmup
import OpenMatch as om
from transformers import AdamW
import torch.distributed as dist
from torch.utils... | [
"torch.nn.functional.gumbel_softmax",
"torch.nn.MarginRankingLoss",
"torch.cat",
"torch.distributions.Categorical",
"torch.sigmoid",
"torch.nn.DataParallel",
"torch.no_grad",
"torch.nn.parallel.DistributedDataParallel",
"torch.nn.functional.log_softmax",
"torch.utils.data.distributed.DistributedSa... | 1.4.0 | vishalbelsare/OpenMatch | 84b25502bf52c58b9e71bd0754b2fc192d9b448f |
1.4 | from typing import List
import torch
import torch.nn as nn
class Embedder(nn.Module):
def __init__(
self,
vocab_size: int,
embed_dim: int,
embed_matrix: List[float] = None
) -> None:
super(Embedder, self).__init__()
self._vocab_size = vocab_size
self._em... | [
"torch.tensor",
"torch.nn.Embedding",
"torch.nn.Parameter"
] | 1.4.0 | vishalbelsare/OpenMatch | 84b25502bf52c58b9e71bd0754b2fc192d9b448f |
1.1 | #!usr/bin/python
# -*- coding: utf-8 -*-
"""
CAM visualization
"""
import argparse
from io import BytesIO
import matplotlib.pyplot as plt
import requests
from PIL import Image
import torch
from torchvision import models
from torchvision.transforms.functional import normalize, resize, to_tensor, to_pil_image
from to... | [
"torch.device",
"torch.cuda.is_available"
] | 1.1.0 | Alymostafa/torch-cam | 3f30f0db90fba1b921dbe71e979001c954d245da |
1.3 | import torch.nn as nn
from .util_wt_bab import activation_bin, Conv2d_Q
# 通道混合
def channel_shuffle(x, groups):
"""shuffle channels of a 4-D Tensor"""
batch_size, channels, height, width = x.size()
assert channels % groups == 0
channels_per_group = channels // groups
# split into groups
x = x.vi... | [
"torch.nn.MaxPool2d",
"torch.nn.AvgPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d"
] | 1.3 | xu-peng-tao/SSD-Pruning-and-quantization | 64b84dfa88a1686593addaa9941cc14579e129ee |
0.4 | from __future__ import absolute_import, division, print_function
from collections import OrderedDict
import pytest
import torch
from pyro.contrib.util import (
get_indices, tensor_to_dict, rmv, rvv, lexpand, rexpand, rdiag, rtril
)
from tests.common import assert_equal
def test_get_indices_sizes():
sizes = ... | [
"torch.tril",
"torch.ones",
"torch.tensor",
"torch.diag",
"torch.dot"
] | 0.4.0 | fluffybird2323/pyro | 9e74e499dbda76c28f12528235dac25bd17f0b1b |
1.5 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Misc functions, including distributed helpers.
Mostly copy-paste from torchvision references.
"""
import os
import subprocess
import time
from collections import defaultdict, deque
import datetime
import pickle
from typing import Optional, List... | [
"torch.distributed.get_world_size",
"torch.cat",
"torch.stack",
"torch.ones",
"torch.cuda.is_available",
"torch.nn.functional.pad",
"torch.distributed.init_process_group",
"torch.ByteTensor",
"torch.distributed.is_initialized",
"torch.tensor",
"torch.zeros_like",
"torch.distributed.get_rank",
... | 1.5.0 | rehno-lindeque/detr | 65c4f49b2795f68fba57b0f139d02e2dbe8b83ac |
1.2 | import torch
import torch.nn as nn
import scipy.optimize as so
import numpy as np
import torch.nn.functional as F #233
from deeprobust.image.attack.base_attack import BaseAttack
class LBFGS(BaseAttack):
def __init__(self, model, label, device = 'cuda' ):
super(LBFGS, self).__init__(model, device)
de... | [
"torch.norm",
"torch.from_numpy",
"torch.tensor",
"torch.nn.functional.nll_loss"
] | 1.2.0 | HenryKenlay/DeepRobust | 3f56dcc45f1fed788423d32cc179c26513416e2e |
1.1 | import torch
import torch.nn as nn
from torchvision.models import resnet152
class Flatten(nn.Module):
def __init__(self):
super(Flatten, self).__init__()
def forward(self, input):
return input.view(input.size()[0], -1)
class AuxConv(nn.Module):
def __init__(self, in_channels, c_tag, str... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.Dropout",
"torch.nn.ModuleList",
"torch.nn.Sequential",
"torch.nn.init.xavier_uniform_",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.load"
] | 1.1.0 | jinmyeonglee/LKVOLearner | 8d6a167d50942131dc9e379c280f442c37579d37 |
0.4 | from models import GeneratorRRDB
from datasets import denormalize, mean, std
import torch
from torch.autograd import Variable
import argparse
import os
from torchvision.utils import save_image
from PIL import Image
parser = argparse.ArgumentParser()
parser.add_argument("--image_path", type=str, required=True, help="Pa... | [
"torch.no_grad",
"torch.cuda.is_available",
"torch.load"
] | 0.4.0 | jiseokcube/PyTorch-GAN | 285c260934d37261d4c55fffbbeea32ce308cc53 |
1.4 | from typing import Tuple
import math
import torch
import torchaudio
from torch import Tensor
__all__ = [
'get_mel_banks',
'inverse_mel_scale',
'inverse_mel_scale_scalar',
'mel_scale',
'mel_scale_scalar',
'spectrogram',
'fbank',
'mfcc',
'vtln_warp_freq',
'vtln_warp_mel_freq',
... | [
"torch.rfft",
"torch.cat",
"torch.gt",
"torch.finfo",
"torch.le",
"torch.ones",
"torch.eye",
"torch.lt",
"torch.nn.functional.pad",
"torch.flip",
"torch.ceil",
"torch.hamming_window",
"torch.zeros_like",
"torch.nn.functional.conv_transpose1d",
"torch.empty",
"torch.ge",
"torch.zeros"... | 1.4.0 | sdarkhovsky/audio | c388ec2b5e6b4d0b99f9c5274d597858e90f5789 |
1.0 | """Classes for specifying probe pytorch modules."""
import torch.nn as nn
import torch
class Probe(nn.Module):
pass
class TwoWordPSDProbe(Probe):
""" Computes squared L2 distance after projection by a matrix.
For a batch of sentences, computes all n^2 pairs of distances
for each senten... | [
"torch.zeros",
"torch.nn.init.uniform_",
"torch.matmul",
"torch.sum"
] | 1.0.0 | muziyongshixin/pytorch_SSRP | e54b3098927ba2ff16bdc8f64f3a2bf46d1f72c5 |
3 | import argparse
import os
import os.path as osp
import time
import numpy as np
import open3d as o3d
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.parallel
from tqdm import tqdm
from ES import Searcher, Critic, Actor, apply_transform, matrix2vectors
from pose_check.models.unin... | [
"torch.device",
"torch.zeros",
"torch.cat",
"torch.min",
"torch.no_grad",
"torch.from_numpy",
"torch.cuda.empty_cache",
"torch.eye",
"torch.mean",
"torch.nn.DataParallel"
] | 3 | touristCheng/Learning2Regrasp | 2823c8da5506bcf7d6328976a1e1e7ede84d90cb |
1.1 | import torch
from torchio import ScalarImage, RandomAnisotropy
from ...utils import TorchioTestCase
class TestRandomAnisotropy(TorchioTestCase):
"""Tests for `RandomAnisotropy`."""
def test_downsample(self):
transform = RandomAnisotropy(
axes=1,
downsampling=(2., 2.)
)... | [
"torch.rand"
] | 1.1 | Linardos/torchio | b0555fc939960128d37e56c27edcfc74a3a967e3 |
1.1 | from collections import defaultdict
from typing import Tuple, Union, Dict
import torch
import numpy as np
from ....data.subject import Subject
from ... import IntensityTransform, FourierTransform
from .. import RandomTransform
class RandomSpike(RandomTransform, IntensityTransform, FourierTransform):
r"""Add ran... | [
"torch.rand",
"torch.stack",
"torch.randint"
] | 1.1 | Linardos/torchio | b0555fc939960128d37e56c27edcfc74a3a967e3 |
1.10 | from sklearn.model_selection import StratifiedKFold
import os, sys
# DECLARE HOW MANY GPUS YOU WISH TO USE.
# KAGGLE ONLY HAS 1, BUT OFFLINE, YOU CAN USE MORE
import argparse
def get_args():
parser = argparse.ArgumentParser()
#parser.add_argument('--disc_type', type=int, default=0, help='disc_type')
pars... | [
"torch.nn.Linear",
"torch.cat",
"torch.stack",
"torch.nn.GRU",
"torch.nn.LSTM",
"torch.cuda.amp.autocast",
"torch.cuda.is_available",
"torch.load",
"torch.nn.functional.pad",
"torch.nn.LayerNorm",
"torch.nn.Conv1d",
"torch.utils.data.DataLoader",
"torch.as_tensor",
"torch.cuda.empty_cache"... | 1.10.2 | Shujun-He/3rd_Solution_Feedback_Prize_Evaluating_Student_Writing | 1a3d1041978ab27f7158505b3d1438676d15b7ca |
0.2 | from torch import nn
from modules.TimeDistributed import TimeDistributed
from modules.Utils import utils
class BiRNNEncoder(nn.Module):
def __init__(self, max_length, nr_hidden, dropout=0.0):
super(BiRNNEncoder, self).__init__()
self.nr_hidden = nr_hidden
self.fully_connected = nn.Seque... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.nn.ReLU"
] | 0.2 | apsdehal/nli-batch-optimizations | 946dbeae58edd39dcda948d03765f7b1070b4eab |
1.0 | r"""
metrics 模块实现了 fastNLP 所需的各种常用衡量指标,一般做为 :class:`~fastNLP.Trainer` 的参数使用。
"""
__all__ = [
"MetricBase",
"AccuracyMetric",
"SpanFPreRecMetric",
"CMRC2018Metric",
"ClassifyFPreRecMetric",
"ConfusionMatrixMetric"
]
import inspect
import warnings
from abc import abstractmethod
from collections ... | [
"torch.eq",
"torch.ones_like",
"torch.sum"
] | 1.0.0 | pinkw/fastNLP | ff8b9a37a71e9b7f7787df8a230446d483b5dfdf |
1.4 | import traceback
from torch.autograd import grad
from learn2learn.algorithms.base_learner import BaseLearner
from learn2learn.utils import clone_module
def maml_update(model, lr, grads=None):
"""
[[Source]](https://github.com/learnables/learn2learn/blob/master/learn2learn/algorithms/maml.py)
**Descriptio... | [
"torch.autograd.grad"
] | 1.4.0 | JuliousHurtado/Meta-Iteration | 8edf09510c9c8c300c8ca42472e7e04bfd790938 |
1.7 | import os
import numpy as np
import torch
from tensorboardX import SummaryWriter, proto
import distributed
from models.reporter_ext import ReportMgr, Statistics
from others.logging import logger
from others.utils import test_rouge, rouge_results_to_str
import json
import copy
from train_abstractive import baseline... | [
"torch.no_grad",
"torch.save",
"torch.nn.BCELoss"
] | 1.7.1 | oja/qfsumm | dfa3541cfad928df412c86888ef0354ea97e8382 |
1.9 | import torch
from torch import nn
from hw_asr.base import BaseModel
class DeepSpeechModel(BaseModel):
def __init__(self, n_feats, n_class, hidden_size, n_layers, dropout,
*args, **kwargs):
super().__init__(n_feats, n_class, *args, **kwargs)
self.convolutional = nn.Sequential(
... | [
"torch.nn.Linear",
"torch.nn.LSTM",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.BatchNorm1d",
"torch.transpose"
] | 1.9.1 | WhiteTeaDragon/hw-asr | 78a767ab00a743b8d28d1fdad795f066fc0795da |
1.5 | """
File: image_io.py
Author: Nrupatunga
Email: nrupatunga.s@byjus.com
Github: https://github.com/nrupatunga
Description: Image IO
"""
import numpy as np
import torch
from PIL import Image
from torchvision import get_image_backend
try:
import accimage
except ImportError:
accimage = None
def _pil_loader(path... | [
"torch.is_tensor",
"torch.from_numpy"
] | 1.5.0 | nrupatunga/pytorch-deaf | 751a37669e78f6671a26cb5cff42c05139bf3c41 |
1.11 | import logging
import os
import numpy as np
from tqdm import tqdm
import argparse
from pprint import pprint, pformat
import time
import logging
import nltk
import torch
from torch.utils.data import Dataset, DataLoader
from data_provider.utils import GloveTokenizer
from config_file import *
class CMUDoGDataset(Datase... | [
"torch.save",
"torch.tensor",
"torch.utils.data.DataLoader",
"torch.load"
] | 1.11.0 | Coldog2333/DGMN-pytorch | c34248afca516625c2ac2fc6d6f4ce8fe2988c99 |
1.7 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
"""
This file contains the definition of encoders used in https://arxiv.org/pdf/1705.02364.pdf
"""
import time
import numpy a... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.LSTM",
"torch.nn.GRU",
"torch.LongTensor",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.sum",
"torch.nn.Softmax",
"torch.nn.Conv1d",
"torch.FloatTensor",
"torch.abs",
"torch.nn.init.zeros_",
"torch.max",
"torch.nn.Tanh",
"torch.nn.ReLU",
"... | 1.7.1 | chandar-lab/CriticalGradientOptimization | 1af4b1df40489991289bb50bb69859a00b2c97c6 |
0.1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Define the rhythmic dynamic movement primitive.
"""
import numpy as np
import torch
from pyrobolearn.models.dmp.dmpytorch.canonical_systems import RhythmicCS
from pyrobolearn.models.dmp.dmpytorch.forcing_terms import RhythmicForcingTerm
from pyrobolearn.models.dmp.dmpy... | [
"torch.isnan",
"torch.ones"
] | 0.1.0 | Pandinosaurus/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 |
0.1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Defines the common loss functions that are used by the learning algorithm / optimizer.
Losses are evaluated on model parameters, data batches / storages, or transitions tuples.
"""
import torch
from pyrobolearn.losses.loss import Loss
from pyrobolearn.storages import ... | [
"torch.sqrt",
"torch.abs",
"torch.distributions.kl.kl_divergence",
"torch.tensor",
"torch.pow"
] | 0.1.0 | Pandinosaurus/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 |
1.7 | import datetime
import logging
import math
import time
import torch
from os import path as osp
from basicsr.data import build_dataloader, build_dataset
from basicsr.data.data_sampler import EnlargedSampler
from basicsr.data.prefetch_dataloader import CPUPrefetcher, CUDAPrefetcher
from basicsr.models import build_model... | [
"torch.cuda.current_device"
] | 1.7 | Zeo95/BasicSR | 0e55b20c2a88428961eceb28dd87558b038c4322 |
1.11 | #
# Created on March 2022
#
# Copyright (c) 2022 Meitar Ronen
#
import torch
import torch.nn as nn
import torch.nn.functional as F
class MLP_Classifier(nn.Module):
def __init__(self, hparams, codes_dim=320, k=None, weights_fc1=None, weights_fc2=None, bias_fc1=None, bias_fc2=None,):
super(MLP_Classifier, ... | [
"torch.nn.Linear",
"torch.cat",
"torch.isnan",
"torch.ones",
"torch.cuda.is_available",
"torch.mul",
"torch.FloatTensor",
"torch.logical_not",
"torch.tensor",
"torch.zeros",
"torch.nonzero",
"torch.nn.Sequential",
"torch.nn.functional.dropout",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torc... | 1.11.0 | BGU-CS-VIL/DeepDPM | 46649f29513e3f69dcaea913b57c75b4b16a9d61 |
1.6 | import itertools
from typing import Tuple, List
import torch
from torch import nn
import torch.nn.functional as F
class RandomConv1d(nn.Module):
def __init__(
self,
channels: int,
filters: int,
sizes: Tuple[int, ...] = (7, 9, 11),
max_dilation_exponent:... | [
"torch.nn.ModuleList",
"torch.nn.Conv1d",
"torch.nn.init.normal_",
"torch.nn.init.uniform_",
"torch.nn.functional.pad"
] | 1.6.0 | lucagrementieri/eegdrive | 65b122246e2a75c0c7c80db3e544f6a6741ceb53 |
1.6 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from torchvision import transforms, datasets
import pytorch_lightning as pl
from einops import rearrange, repeat
from vit_pytorch_lightning import ViT
def CIFAR10dataset(batch_size=256, num_workers=4):
transform = transforms.C... | [
"torch.manual_seed",
"torch.utils.data.random_split",
"torch.utils.data.DataLoader"
] | 1.6 | makoto-sofue/vit-pytorch-lightning | da8cace2ba06a2d1b277dec9a50ec9cd97b61230 |
1.2 | #!/usr/bin/env python3
"""Calculates ***Single Image*** Frechet Inception Distance (SIFID) to evalulate Single-Image-GANs
Code was adapted from:
https://github.com/mseitzer/pytorch-fid.git
Which was adapted from the TensorFlow implementation of:
https://github.com/bioinf-jku/TTUR
Th... | [
"torch.from_numpy"
] | 1.2 | git-pupil/SinGAN | e1eece165c426e332b69a6da10ec81494a3e1820 |
1.7 | # -*- coding: utf-8 -*-
"""
@date: 2021/2/2 下午5:46
@file: test_regvgg.py
@author: zj
@description:
"""
import torch
from zcls.config import cfg
from zcls.config.key_word import KEY_OUTPUT
from zcls.model.recognizers.build import build_recognizer
from zcls.model.recognizers.vgg.repvgg import RepVGG
from zcls.model.b... | [
"torch.device",
"torch.allclose",
"torch.randn",
"torch.sum"
] | 1.7.1 | likyoo/ZCls | 568621aca3a8b090c93345f0858d52c5757f2f0e |
2 | from torch2trt.torch2trt import *
from torch2trt.module_test import add_module_test
import torch
from .size import get_intwarper_trt, IntWarper
from collections.abc import Iterable
def slice_to_trt(dim_size, dim_slice):
start = 0 if dim_slice.start is None else dim_slice.start
stop = dim_size if dim_slic... | [
"torch.device"
] | 2 | huliang2016/torch2trt_dynamic | aa55f354a742d26272eae93934d0cff7cd946cbf |
1.4 | from typing import Any, Dict, Optional, Tuple, Type, Union, List
import gym
import torch as th
import torch.multiprocessing as mp
import random
from stable_baselines3.common import logger
from stable_baselines3.common.buffers import ReplayBuffer
from stable_baselines3.common.off_policy_algorithm import OffPolicyAlgor... | [
"torch.min",
"torch.nn.MSELoss",
"torch.arange",
"torch.no_grad",
"torch.multiprocessing.get_context",
"torch.zeros_like",
"torch.multiprocessing.set_sharing_strategy"
] | 1.4.0 | steckdenis/stable-baselines3 | 248a1174c7ebce67afaddb872fc7cb2c9a6d5720 |
1.5 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
This file provides the definition of the convolutional heads used to predict masks, as well as the losses
"""
import io
from collections import defaultdict
from typing import List, Optional
import torch
import torch.nn as nn
import torch.nn.fun... | [
"torch.nn.functional.binary_cross_entropy_with_logits",
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.init.kaiming_uniform_",
"torch.zeros",
"torch.einsum",
"torch.nn.init.constant_",
"torch.no_grad",
"torch.nn.functional.interpolate",
"torch.nn.init.xavier_uniform_",
"torch.nn.GroupNorm",
... | 1.5.0 | phamquiluan/table-transformer | 1fcbb539640e86659e825a7cfe410270f1686d8d |
1.0 |
import sys
import os
import time
import torch
from onmt.translate.decode_strategy import DecodeStrategy
import numpy as np
from IPython import embed
class BeamSearch(DecodeStrategy):
"""Generation beam search.
Note that the attributes list is not exhaustive. Rather, it highlights
tensors to document t... | [
"torch.zeros",
"torch.cat",
"torch.mul",
"torch.arange",
"torch.full",
"torch.tensor",
"torch.zeros_like",
"torch.div",
"torch.empty",
"torch.topk"
] | 1.0.1 | marekstrelec/OpenNMT-py | b20ebd3b42414cbfe5b1a4e4ccd1ef341d4fff71 |
1.6 | import copy
import numpy as np
import torch
from ray.rllib.models import MODEL_DEFAULTS
from ray.rllib.models.torch.fcnet import FullyConnectedNetwork
from ray.rllib.models.torch.torch_action_dist import TorchCategorical
from ray.rllib.utils.schedules import PiecewiseSchedule
from marltoolbox.envs.coin_game import \
... | [
"torch.abs",
"torch.all",
"torch.Tensor"
] | 1.6.0 | longtermrisk/marltoolbox | cae1ba94ccb44700b66a32e0734a0f11c9c6c7fe |
1.6 | #!/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.
import torch
from botorch.exceptions.errors import UnsupportedError
from botorch.utils.containers import TrainingData
f... | [
"torch.rand",
"torch.cat",
"torch.equal",
"torch.split"
] | 1.6 | ngam/botorch | c6bc8f9a82c4959cc209335fefd8b906023edd1e |
1.6 | # Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import unittest
from copy import deepcopy
import torch
from mmf.common.registry import registry
from mmf.models.base_model import BaseModel
from mmf.trainers.callbacks.lr_scheduler import LRSchedulerCallback
from omegaconf import OmegaConf
class Sim... | [
"torch.nn.Linear",
"torch.nn.Tanh",
"torch.nn.CrossEntropyLoss"
] | 1.6.0 | simran2905/mmf | c8f47a23b85a87d14616c2f53e81693a25ea929a |
1.4 | import argparse
import datetime
import os
import pprint
import numpy as np
import torch
from atari_network import DQN
from atari_wrapper import make_atari_env
from torch.utils.tensorboard import SummaryWriter
from tianshou.data import Collector, VectorReplayBuffer
from tianshou.policy import DQNPolicy
from tianshou.p... | [
"torch.manual_seed",
"torch.cuda.is_available",
"torch.load",
"torch.utils.tensorboard.SummaryWriter"
] | 1.4.0 | quangr/tianshou | 110114e134bc0b7cf17973882e6383842e48dab3 |
1.2 | import torch
import torch.nn.functional as F
from collections import OrderedDict
from torchvision.models.detection import FasterRCNN
from torchvision.models.detection.backbone_utils import resnet_fpn_backbone
from torchvision.models.detection.transform import resize_boxes
class FRCNN_FPN(FasterRCNN):
def __init_... | [
"torch.nn.functional.softmax"
] | 1.2.0 | liuqk3/GSM | 188965b3a11f9cdbe166d79cac7cd2e9fb4c1785 |
1.9 | #!/usr/bin/env python3
import unittest
from unittest import mock
import torch
from Lgpytorch import settings
from Lgpytorch.lazy import (
ConstantDiagLazyTensor,
DiagLazyTensor,
KroneckerProductAddedDiagLazyTensor,
KroneckerProductDiagLazyTensor,
KroneckerProductLazyTensor,
NonLazyTensor,
)
f... | [
"torch.rand",
"torch.tensor"
] | 1.9 | Mehdishishehbor/gpytorch | 432e537b3f6679ea4ab3acf33b14626b7e161c92 |
1.2 | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 13 13:01:15 2019
@author: WT
"""
import torch
import torch.nn as nn
### create masks for src & trg sequences
def create_masks(src, trg):
src_mask = (src == 1).unsqueeze(-2).bool()
if trg is not None:
trg_mask = (trg == 1).unsqueeze(-2).bool()
else:
... | [
"torch.nn.Linear",
"torch.nn.Transformer",
"torch.save",
"torch.load",
"torch.nn.Embedding"
] | 1.2.0 | jackashore/NLP_Toolkit | e5bd8bcfad87f4906c45e66351adf93bd5c2727f |
1.9 | import torch
from environments import PendulumEnv, D4RLEnv
# Evaluate agent with deterministic policy π
def evaluate_agent(agent, num_episodes, env_type=PendulumEnv, env_name='', seed=1, return_trajectories=False, render=False):
env = env_type(env_name)
env.seed(seed)
returns, trajectories = [], []
... | [
"torch.cat",
"torch.inference_mode",
"torch.tensor",
"torch.ones"
] | 1.9 | wx-b/imitation-learning | 21d0663d4f350e7dd01a7843386965fd52e40a23 |
0.4 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
from torch.autograd import Variable
import numpy as np
# Universal import block
# Block to get the relative imports working
import os
import sys
module_path = os.path.abspath(os.path.join('..'))
if modul... | [
"torch.cuda.is_available"
] | 0.4.0 | jonasnm/geometric-certificates | 8730abaf2ab0c8972a2d40168d5fe64c8670fc62 |
1.7 | """
This section covers the interface for `NERDA` models, that is
implemented as its own Python class [NERDA.models.NERDA][].
The interface enables you to easily
- specify your own [NERDA.models.NERDA][] model
- train it
- evaluate it
- use it to predict entities in new texts.
"""
from .datasets import get_conll_da... | [
"torch.cuda.is_available",
"torch.device"
] | 1.7.1 | Varun221/NERDA | a39900fd29c65465ac22f1a002c2eafef568258e |
1.7 | """
General utility functions
Author: Shengyu Huang
Last modified: 30.11.2020
"""
import os,re,sys,json,yaml,random, argparse, torch, pickle
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
from scipy.spatial.transform import Rotation
from sklearn.neighbors import ... | [
"torch.cuda.manual_seed_all",
"torch.isnan",
"torch.clamp",
"torch.manual_seed",
"torch.isinf",
"torch.sum"
] | 1.7.1 | ShengyuH/PredateOverlap | 770c3063399f08b3836935212ab4c84d355b4704 |
1.7 | """ 3-d rigid body transformation group
"""
import torch
def identity(batch_size):
return torch.eye(3, 4)[None, ...].repeat(batch_size, 1, 1)
def inverse(g):
""" Returns the inverse of the SE3 transform
Args:
g: (B, 3/4, 4) transform
Returns:
(B, 3, 4) matrix containing the inverse... | [
"torch.cat",
"torch.eye"
] | 1.7.1 | ShengyuH/PredateOverlap | 770c3063399f08b3836935212ab4c84d355b4704 |
1.0 | import torch.nn as nn
import torch
class Yolo_head(nn.Module):
def __init__(self, nC, anchors, stride):
super(Yolo_head, self).__init__()
self.__anchors = anchors
self.__nA = len(anchors)
self.__nC = nC
self.__stride = stride
def forward(self, p):
bs, nG = p.... | [
"torch.sigmoid",
"torch.cat",
"torch.stack",
"torch.arange",
"torch.exp"
] | 1.0.0 | Yu-Nie/YOLOV3 | 09db1d551d293dcfa7a638fd6693920840d28a74 |
1.5 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from dropblock import DropBlock2D
class BEV_Unet(nn.Module):
def __init__(self,n_class,n_height,dilation = 1,group_conv=False,input_batch_norm = False,dropout = 0.,circular_paddin... | [
"torch.nn.Dropout",
"torch.cat",
"torch.nn.MaxPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.LeakyReLU",
"torch.nn.ConvTranspose2d",
"torch.nn.Upsample",
"torch.nn.Conv2d",
"torch.nn.functional.pad"
] | 1.5.0 | isunLt/PolarSeg | 50b6df8d0a63aae1835377178baeaeb071b8f78d |
1.8 | import torch
import neural_network_lyapunov.gurobi_torch_mip as gurobi_torch_mip
import neural_network_lyapunov.utils as utils
import neural_network_lyapunov.mip_utils as mip_utils
import neural_network_lyapunov.relu_to_optimization as relu_to_optimization
class ControlAffineSystemConstraintReturn:
"""
The re... | [
"torch.zeros",
"torch.cat",
"torch.min",
"torch.split",
"torch.all",
"torch.eye"
] | 1.8 | StanfordASL/neural-network-lyapunov | 9e5db1c7f91b42df729026c9aa8575bc126f66b6 |
1.0 | import math
import torch
import torch.optim as optim
import horovod.torch as hvd
import numpy as np
from horovod.torch.mpi_ops import allgather_async
from legacy.utils import (ComputeA, ComputeG)
from legacy.utils import update_running_avg
from legacy.utils import try_contiguous
from legacy.utils import cycle
from leg... | [
"torch.triu_indices",
"torch.is_grad_enabled"
] | 1.0 | lzhangbv/kfac_pytorch | 159e7ef9541bb960d79c438622780cdcc71b3210 |
1.0 | import math
import torch
import torch.optim as optim
import numpy as np
#import horovod.torch as hvd
import kfac.backend as backend # hvd -> backend.comm
from kfac.utils import (ComputeA, ComputeG)
from kfac.utils import update_running_avg
from kfac.utils import mat_inv
from kfac.kfac_preconditioner_inv import KFAC a... | [
"torch.is_grad_enabled"
] | 1.0 | lzhangbv/kfac_pytorch | 159e7ef9541bb960d79c438622780cdcc71b3210 |
0.4 | import os
import queue
import re
import time
import torch
import torch.multiprocessing as mp
from autokeras.bayesian import BayesianOptimizer
from autokeras.constant import Constant
from autokeras.nn.model_trainer import ModelTrainer
from autokeras.utils import pickle_to_file, pickle_from_file, verbose_print, get_syst... | [
"torch.multiprocessing.get_context",
"torch.cuda.empty_cache"
] | 0.4.1 | MustafaKadioglu/autokeras | e75f3194ac4ed6741bc64583fda483dc2f6dfe09 |
0.4 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | [
"torch.device",
"torch.cuda.manual_seed_all",
"torch.isnan",
"torch.distributed.init_process_group",
"torch.no_grad",
"torch.utils.data.SequentialSampler",
"torch.nn.parallel.DistributedDataParallel",
"torch.cuda.device_count",
"torch.manual_seed",
"torch.cuda.is_available",
"torch.tensor",
"t... | 0.4.1 | Theerit/bert | 2251eac7031f5ca4e7fdcec88c3c96a4a1595cff |
1.9 | import torch
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
import torch.nn.functional as F
import sys
sys.path.append('/home/goda/Undergraduate/capstone_design_base/src')
from src.dataset.dataset import MVP
from src.models.pointnet import PointNetCls, feature_transform_regularizer
from... | [
"torch.device",
"torch.optim.lr_scheduler.StepLR",
"torch.max",
"torch.no_grad",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"torch.nn.functional.nll_loss"
] | 1.9.1 | GoDa-Choe/capstone_design | cb3ce264c7720594a64b7e1717247ad12c522116 |
1.0 | import tempfile
import torch
from transformers import MODEL_WITH_HEADS_MAPPING, AutoModelForSequenceClassification, AutoModelWithHeads
from transformers.adapters.composition import BatchSplit, Stack
from transformers.testing_utils import require_torch, torch_device
from .test_adapter_common import create_twin_models... | [
"torch.zeros",
"torch.isclose",
"torch.equal",
"torch.ones"
] | 1.0 | HimashiRathnayake/adapter-transformers | d9c06ecbf4aaa33756e848b8fc5b3ec65f5ff4f4 |
1.7 | # Task Inference based meta-rl algorithm using Gaussian mixture models and gated Recurrent units (TIGR)
import os
import numpy as np
import click
import json
import torch
import copy
from rlkit.envs import ENVS
from rlkit.envs.wrappers import NormalizedBoxEnv
from rlkit.torch.sac.policies import TanhGaussianPolicy
fr... | [
"torch.manual_seed",
"torch.set_num_threads"
] | 1.7.0 | lknak/tigr | 614a6435c483a25cb8183c08184d140120053a4f |
1.2 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import torch
from torch.utils.data import Dataset, DataLoader
import os
import numpy as np
import h5py
import os.path as osp
import sys
import scipy.misc
if sys.version_info[0] == 2:
import cPickle as pickle
else:
impo... | [
"torch.cat",
"torch.stack",
"torch.FloatTensor",
"torch.from_numpy",
"torch.LongTensor",
"torch.utils.data.DataLoader",
"torch.transpose",
"torch.matmul"
] | 1.2.0 | skelemoa/synse-zsl | 90f39a118170d708843c5d4305bd807905cb4c54 |
1.2 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import torch
from torch.utils.data import Dataset, DataLoader
import os
import numpy as np
import h5py
import os.path as osp
import sys
import scipy.misc
if sys.version_info[0] == 2:
import cPickle as pickle
else:
impo... | [
"torch.cat",
"torch.stack",
"torch.FloatTensor",
"torch.from_numpy",
"torch.LongTensor",
"torch.utils.data.DataLoader",
"torch.transpose",
"torch.matmul"
] | 1.2.0 | skelemoa/synse-zsl | 90f39a118170d708843c5d4305bd807905cb4c54 |
1.9 | from functools import reduce
from math import sqrt
from typing import Any, Optional, Sequence, Tuple, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
from ai_traineree.networks import NetworkType
from ai_traineree.types import FeatureType
def hidden_init(layer: nn.Module):
fan_in = laye... | [
"torch.zeros",
"torch.nn.Linear",
"torch.nn.Identity",
"torch.nn.ModuleList",
"torch.nn.MaxPool2d",
"torch.no_grad",
"torch.nn.init.xavier_uniform_",
"torch.nn.functional.linear",
"torch.nn.Conv2d"
] | 1.9.0 | laszukdawid/ai-traineree | af32940eba8e11012de87b60d78f10f5a3b96c79 |
1.7 | import torch
import torch.nn as nn
import torch.nn.functional as f
class DoubleConvolution(nn.Module):
"""
Class used to initialize the conv 3x3, ReLu step.
"""
def __init__(self, in_channels: int, out_channels: int, mid_channels: int = None):
"""
Parameters
----------
... | [
"torch.cat",
"torch.nn.MaxPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.ConvTranspose2d",
"torch.nn.ReLU",
"torch.nn.Upsample",
"torch.nn.Conv2d",
"torch.nn.functional.pad"
] | 1.7.0 | gil-uav/semantic-image-segmentation | eaf29cda77f67e432756c3f594f3bf035e9c05c4 |
1.9 |
import torch.nn as nn
class FashionMNISTCNN(nn.Module):
def __init__(self):
super(FashionMNISTCNN, self).__init__()
self.layer1 = nn.Sequential(
nn.Conv2d(1, 16, kernel_size=5, padding=2),
nn.BatchNorm2d(16),
nn.ReLU(),
nn.MaxPool2d(2))
se... | [
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.Flatten"
] | 1.9.0 | ahreurink/fltk-testbed | f36581cb4a36e7d6c4d9c87618be67a77aeef13b |
1.6 | """
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
import numpy as np
import torch, math
import torch.nn.functional as F
from models.networks.base_network import BaseNetwork... | [
"torch.zeros",
"torch.nn.functional.avg_pool2d",
"torch.nn.Sequential",
"torch.nn.LeakyReLU",
"torch.nn.Conv2d",
"torch.tensor",
"torch.nn.functional.conv2d",
"torch.randn",
"torch.nn.functional.leaky_relu"
] | 1.6.0 | ustato/sber-swap | 1140e085e165ed14e1098d81b7abd63feafedecf |
1.11 | import torch.nn as nn
import torch.nn.functional as F
import torch
from torch.distributions import Categorical
def entropy(probs):
log_probs = -torch.log(probs)
entropy = -torch.sum(probs * log_probs, axis=-1, keepdim=True)
return entropy
class DenseDirichlet(nn.Module):
def __init__(self, in_dim, ... | [
"torch.nn.Linear",
"torch.nn.functional.sigmoid",
"torch.log",
"torch.exp",
"torch.sum"
] | 1.11.0 | Tuttusa/EvidentialDL | 7813c2705784bfeee21d25643259fd28d75b5f95 |
1.8 | import datetime
import logging
import os
import torch
from ..base.base_sampler import BaseSampler
from .rhvae_config import RHVAESamplerConfig
from .rhvae_model import RHVAE
logger = logging.getLogger(__name__)
# make it print to the console.
console = logging.StreamHandler()
logger.addHandler(console)
logger.setLe... | [
"torch.rand",
"torch.cat",
"torch.norm",
"torch.no_grad",
"torch.randn_like",
"torch.tensor",
"torch.exp"
] | 1.8.1 | clementchadebec/pyraug | d1b36c060fe56427ed158ecb38cdbc6cc3bc0f74 |
0.4 | import torch
import torch.nn as nn
from . import resnet, resnext, mobilenet, hrnet
from mit_semseg.lib.nn import SynchronizedBatchNorm2d
BatchNorm2d = SynchronizedBatchNorm2d
class SegmentationModuleBase(nn.Module):
def __init__(self):
super(SegmentationModuleBase, self).__init__()
def pixel_acc(self... | [
"torch.cat",
"torch.nn.ModuleList",
"torch.max",
"torch.nn.functional.interpolate",
"torch.nn.init.kaiming_normal_",
"torch.nn.functional.log_softmax",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.load",
"torch.nn.functional.softmax",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Dropout2d",
"torch.... | 0.4.1 | starkgines/PDI | dd6908c022179f935ae25d3afee9ea44bb49f162 |
0.4 | """
This HRNet implementation is modified from the following repository:
https://github.com/HRNet/HRNet-Semantic-Segmentation
"""
import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from .utils import load_url
from mit_semseg.lib.nn import SynchronizedBatchNorm2d
BatchNorm2d = Synchroniz... | [
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.Sequential",
"torch.nn.functional.interpolate",
"torch.nn.ReLU",
"torch.nn.Conv2d"
] | 0.4.1 | starkgines/PDI | dd6908c022179f935ae25d3afee9ea44bb49f162 |
0.4 | import torch
import torch.multiprocessing as multiprocessing
from torch._C import _set_worker_signal_handlers, \
_remove_worker_pids, _error_if_any_worker_fails
try:
from torch._C import _set_worker_pids
except:
from torch._C import _update_worker_pids as _set_worker_pids
from .sampler import SequentialSamp... | [
"torch.multiprocessing.Process",
"torch.stack",
"torch.is_tensor",
"torch.cuda.current_device",
"torch.manual_seed",
"torch.cuda.set_device",
"torch.DoubleTensor",
"torch.cuda.is_available",
"torch._C._set_worker_signal_handlers",
"torch.LongTensor",
"torch.from_numpy",
"torch.multiprocessing.... | 0.4.1 | starkgines/PDI | dd6908c022179f935ae25d3afee9ea44bb49f162 |
1.4 | """ Twins
A PyTorch impl of : `Twins: Revisiting the Design of Spatial Attention in Vision Transformers`
- https://arxiv.org/pdf/2104.13840.pdf
Code/weights from https://github.com/Meituan-AutoML/Twins, original copyright/license info below
"""
# --------------------------------------------------------
# Twins
# ... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"torch.nn.Identity",
"torch.nn.ModuleList",
"torch.nn.init.constant_",
"torch.nn.Conv2d",
"torch.nn.functional.pad"
] | 1.4.0 | visualCalculus/pytorch-image-models | 54a6cca27a9a3e092a07457f5d56709da56e3cf5 |
0.2 | import numpy as np
import pandas as pd
import pytorch_lightning as pl
import torch
import os
from omegaconf import DictConfig
from src.utils.technical_utils import load_obj
class VentilatorRegression(pl.LightningModule):
def __init__(self, cfg: DictConfig):
super(VentilatorRegression, self).__init__()
... | [
"torch.tensor"
] | 0.2.1 | Erlemar/ventilator_kaggle_models | 216e5fcfde28cd20773d0ccf996fff3ff1775921 |
1.5 | """
(C) Copyright 2021 IBM Corp.
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, software
d... | [
"torch.nn.Identity",
"torch.cat",
"torch.nn.ReLU",
"torch.nn.Dropout3d",
"torch.nn.Conv3d",
"torch.nn.functional.softmax",
"torch.nn.AdaptiveMaxPool3d"
] | 1.5.0 | afoncubierta/fuse-med-ml | 2c502c018635f138f00e017f243fd73154abdec2 |
1.5 | import logging
import os
import sys
from dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple
from tqdm.auto import tqdm, trange
from seqeval.metrics import f1_score, precision_score, recall_score
import numpy as np
import torch
from torch import nn
from torch.utils.data.dataset import Da... | [
"torch.utils.data.sampler.SequentialSampler",
"torch.no_grad",
"torch.cuda.is_available",
"torch.utils.data.DataLoader"
] | 1.5.0 | jiangfeng1124/ChemRxnExtractor | 124ea09d944abb4375be38294a74f0de4b1087fa |
1.3 | from __future__ import division
import torch
import math
import random
from PIL import Image, ImageOps, ImageEnhance
try:
import accimage
except ImportError:
accimage = None
import numpy as np
import numbers
import types
import collections
import warnings
import scipy.ndimage.interpolation as itpl
import ski... | [
"torch.is_tensor"
] | 1.3.1 | vision-and-sensing/Adaptive-LiDAR-Sampling | fa49901cd9662393ffc2d267633ebe0b65be0a30 |
1.7 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# import _init_paths
import os
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from models.decode import exct_decode, agnex_ct_decode
from models.utils import flip_tensor
... | [
"torch.cuda.synchronize",
"torch.no_grad"
] | 1.7.1 | vivym/OpenKS | ea380782162de2e4c1a413f37ad12b85ccb7048a |
1.7 | import torch
import torch.nn as nn
import torch.nn.functional as F
from queue import Queue
import numpy as np
import math
from ..util import box_ops
from ..util.misc import accuracy, get_world_size, is_dist_avail_and_initialized
def focal_loss(preds, gts, alpha, gamma):
pos_inds = gts.gt(0).float()
neg_inds ... | [
"torch.nn.functional.binary_cross_entropy_with_logits",
"torch.cat",
"torch.nn.functional.l1_loss",
"torch.no_grad",
"torch.ones",
"torch.full_like",
"torch.full",
"torch.distributed.all_reduce",
"torch.zeros_like",
"torch.log",
"torch.pow"
] | 1.7.1 | vivym/OpenKS | ea380782162de2e4c1a413f37ad12b85ccb7048a |
3 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import numpy as np
import torch
from common_testing import TestCaseMixin
from pytorch3d.commo... | [
"torch.rand",
"torch.device",
"torch.manual_seed",
"torch.Tensor"
] | 3 | janEbert/pytorch3d | accdac80fb29e82f72d4e8e73135ba8fd790b6c0 |
1.4 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain... | [
"torch.save",
"torch.tensor",
"torch.load",
"torch.distributed.barrier",
"torch.utils.data.TensorDataset"
] | 1.4.0 | yeongjoon/NER | d2c93597726ed9507bfddea9197007d30aeaad8b |
1.5 | import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import pdb
from .layers import *
import torch
import torch.nn as nn
class Speech2Gesture_G(nn.Module):
'''
Baseline: http://people.eecs.berkeley.edu/~shir... | [
"torch.nn.Sequential",
"torch.nn.LeakyReLU",
"torch.nn.ModuleList",
"torch.nn.Conv1d"
] | 1.5.0 | chahuja/mix-stage | 6f47626ce46bd9b28c45d1255b328b17b3650c4f |
1.0 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors, Facebook AI Research 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 L... | [
"torch.nn.Linear",
"torch.cat",
"torch.einsum",
"torch.nn.Parameter",
"torch.ones",
"torch.load",
"torch.nn.BCEWithLogitsLoss",
"torch.nn.functional.pad",
"torch.nn.CrossEntropyLoss",
"torch.topk",
"torch.nn.LayerNorm",
"torch.gather",
"torch.is_tensor",
"torch.nn.init.normal_",
"torch.t... | 1.0 | cbrochtrup/transformers | c89bdfbe720bc8f41c7dc6db5473a2cb0955f224 |
1.3 | import os
from distutils.version import LooseVersion
from importlib.util import find_spec
from typing import Optional, Union
from unittest.mock import patch
import pytest
import torch
from pytest import approx
from torch.nn import Linear
from torch.nn.functional import mse_loss
from torch.optim import SGD
import igni... | [
"torch.nn.Linear",
"torch.cuda.is_available",
"torch.tensor",
"torch.jit.trace",
"torch.randn"
] | 1.3 | Devanshu24/ignite | 2f0ba3e65cfa36b43bc87b315733fd3f3585e430 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.