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.4 | import numpy as np, sys, os, random, pdb, json, uuid, time, argparse
from pprint import pprint
import logging, logging.config
from collections import defaultdict as ddict
from ordered_set import OrderedSet
# PyTorch related imports
import torch
from torch.nn import functional as F
from torch.nn.init import xavier_norm... | [
"torch.rfft",
"torch.stack",
"torch.nn.init.xavier_normal_",
"torch.Tensor"
] | 1.4.0 | syedhamzazaidi/CompGCN | 76de7466b18ee39416fd9fc0d45996f0caa60186 |
1.0 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from enum import Enum
import torch.nn as nn
import torch.nn.functional as F
import torch
import os
class MnistModel(Enum):
MODEL_A = "mo... | [
"torch.nn.Linear",
"torch.device",
"torch.nn.Dropout",
"torch.nn.Conv2d",
"torch.nn.functional.max_pool2d"
] | 1.0.0 | hugobb/OnlineAttacks | 5cc971eba014e625ec43f67f6c5eadf713c4141c |
1.7 | import pandas as pd
import numpy as np
import os
import albumentations as A
import torch
from torch.utils.data import Dataset
import random
# import cv2
from skimage.io import imread
SEED = 42
TRAIN_RATIO = 0.9
class PadChest(Dataset):
"""
PadChest dataset
Hospital San Juan de Alicante - University of Alic... | [
"torch.from_numpy"
] | 1.7.0 | SLAMPAI/large-scale-pretraining-transfer | 730c1f25e56bbe5c70e5933f845824f98c015876 |
1.8 | import torch
from all.core import State, StateArray
from ._body import Body
class FrameStack(Body):
def __init__(self, agent, size=4, lazy=False):
super().__init__(agent)
self._frames = []
self._size = size
self._lazy = lazy
self._to_cache = TensorDeviceCache()
def pro... | [
"torch.is_tensor",
"torch.device",
"torch.cat"
] | 1.8.0 | drozzy/autonomous-learning-library | 67b27aa71e6689e3447f1b342296b4360419ac38 |
1.0 | # coding=utf-8
# Copyright 2018 the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | [
"torch.nn.Linear",
"torch.ones",
"torch.cuda.is_available",
"torch.allclose",
"torch.nn.DataParallel",
"torch.nn.LayerNorm",
"torch.randint",
"torch.tensor",
"torch.zeros",
"torch.cuda.device_count",
"torch.nn.functional.mse_loss",
"torch.optim.lr_scheduler.LambdaLR",
"torch.randn"
] | 1.0 | Yokohide0317/transformers | 1089c30a4a3c56dcf017e500ba4b44e5c39f68dd |
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.no_grad",
"torch.ones"
] | 1.0 | Yokohide0317/transformers | 28e091430eea9e0d40839e56fd0d57aec262f5f9 |
1.0 | import torch
from transformers import AutoConfig, AutoModelForSeq2SeqLM, BartTokenizer, BartForConditionalGeneration, BartExtendedForConditionalGeneration, BartConfig, BartExtendedModel
# Loading trained model
PATH = "/home/ec2-user/moymarce/transformers/checkpoints/5-source_oracle-double/"
tokenizer = BartTokenizer.f... | [
"torch.Tensor"
] | 1.0 | MarcelGM/transformers | aad1d9b6d5c58fd974618ac0aead1c5bd1119467 |
1.0 | # coding=utf-8
# Copyright 2020 The Google AI Language Team Authors, The HuggingFace Inc. team and Microsoft Corporation.
# 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.... | [
"torch.distributed.get_world_size",
"torch.utils.data.RandomSampler",
"torch.cuda.is_available",
"torch.load",
"torch.nn.DataParallel",
"torch.distributed.init_process_group",
"torch.manual_seed",
"torch.tensor",
"torch.utils.data.DataLoader",
"torch.distributed.get_rank",
"torch.device",
"tor... | 1.0 | MarcelGM/transformers | aad1d9b6d5c58fd974618ac0aead1c5bd1119467 |
1.4 | # Copyright 2018 Uber Technologies, Inc. All Rights Reserved.
# Modifications copyright (C) 2019 Intel Corporation
# Modifications copyright (C) 2020, 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 Li... | [
"torch.nn.Linear",
"torch.cat",
"torch.ones",
"torch.nn.Parameter",
"torch.cuda.is_available",
"torch.LongTensor",
"torch.cuda.FloatTensor",
"torch.load",
"torch.allclose",
"torch.IntTensor",
"torch.is_tensor",
"torch.FloatTensor",
"torch.manual_seed",
"torch.optim.Optimizer.__subclasses__... | 1.4.0 | xinyual/horovod | 65ae9afd05b854bc0dc9719dc246454edadf9487 |
1.5 | """
Copyright (c) 2020 Intel 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 writin... | [
"torch.rand",
"torch.nn.Conv2d",
"torch.nn.ConvTranspose2d",
"torch.rand_like"
] | 1.5.0 | sarthakpati/nncf | 29ad62c664c1dd53b3c8c50fc001a1b36bd1e8ac |
1.5 | """
Copyright (c) 2019-2020 Intel 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 w... | [
"torch.nn.ModuleDict",
"torch.no_grad",
"torch.tensor",
"torch.Tensor.as_subclass"
] | 1.5.0 | sarthakpati/nncf | 29ad62c664c1dd53b3c8c50fc001a1b36bd1e8ac |
1.5 | """
Copyright (c) 2019 Intel 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 writin... | [
"torch.from_numpy"
] | 1.5.0 | sarthakpati/nncf | 29ad62c664c1dd53b3c8c50fc001a1b36bd1e8ac |
0.27 | # Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
"""
Tests a variety of export options with our surgery methods applied, including
torchscript, torch.fx, and ONNX.
"""
import os
import pathlib
from typing import Any, Callable, Type
import pytest
import torch
import torch.fx
from compo... | [
"torch.rand",
"torch.fx.symbolic_trace",
"torch.onnx.export",
"torch.jit.script",
"torch.Tensor"
] | 0.27 | moinnadeem/composer | bc3f41b766bd4450f05a99f44db4a6b3901ea1c8 |
0.27 | # Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
"""Core Exponential Moving Average (EMA) classes and functions."""
from __future__ import annotations
import copy
import itertools
import logging
from typing import Any, Dict, List, Optional, Union
import torch
from composer.core impo... | [
"torch.no_grad"
] | 0.27 | moinnadeem/composer | bc3f41b766bd4450f05a99f44db4a6b3901ea1c8 |
1.4 | import torch
import torch.nn as nn
class CharbonnierLoss(nn.Module):
"""Charbonnier Loss (L1)"""
def __init__(self, eps=1e-6):
super(CharbonnierLoss, self).__init__()
self.eps = eps
def forward(self, x, y):
diff = x - y
loss = torch.sum(torch.sqrt(diff * diff + self.eps))... | [
"torch.zeros",
"torch.device",
"torch.sqrt",
"torch.trace",
"torch.nn.MSELoss",
"torch.empty_like",
"torch.autograd.grad",
"torch.nn.BCEWithLogitsLoss",
"torch.Tensor",
"torch.sum"
] | 1.4.0 | P0lyFish/noise2-series | a21ad1b7cb20e44161393156efd7dcdab729b4a3 |
1.4 | #!/usr/bin/env python3
import argparse
import logging
import os
from typing import Tuple
import torch
import torchaudio
from torchaudio.models.wav2vec2.utils.import_huggingface import import_huggingface_model
from greedy_decoder import Decoder
TORCH_VERSION: Tuple[int, ...] = tuple(int(x) for x in torch.__version__.s... | [
"torch.jit.script",
"torch.__version__.split",
"torch.quantization.quantize_dynamic"
] | 1.4.0 | albertvillanova/audio | 0cd25093626d067e008e1f81ad76e072bd4a1edd |
1.4 | import math
from typing import Optional
from itertools import permutations
import torch
def sdr(
estimate: torch.Tensor,
reference: torch.Tensor,
mask: Optional[torch.Tensor] = None,
epsilon: float = 1e-8
) -> torch.Tensor:
"""Computes source-to-distortion ratio.
1. scale the... | [
"torch.zeros",
"torch.log10"
] | 1.4.0 | albertvillanova/audio | 0cd25093626d067e008e1f81ad76e072bd4a1edd |
1.10 | import argparse
import os
import random
import shutil
import time
import warnings
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.optim
import torch.multiprocessing as mp
import torch.utils.data
import torch.utils.data.distr... | [
"torch.arange",
"torch.distributed.init_process_group",
"torch.save",
"torch.no_grad",
"torch.multiprocessing.spawn",
"torch.nn.parallel.DistributedDataParallel",
"torch.cuda.device_count",
"torch.manual_seed",
"torch.cuda.set_device",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
... | 1.10.0 | 415905716/MQBench | 3f8321ec9ab9fd05d99c21700a901b1ff6a90a1e |
1.8 | import torch
from torch.quantization import FakeQuantizeBase
from torch.quantization.observer import MovingAverageMinMaxObserver
from torch.quantization.fake_quantize import _is_per_channel, _is_per_tensor
from mqbench.utils import is_symmetric_quant
class QuantizeBase(FakeQuantizeBase):
r""" This is an extensio... | [
"torch.quantization.fake_quantize._is_per_channel",
"torch.tensor",
"torch.quantization.fake_quantize._is_per_tensor",
"torch.log2"
] | 1.8.1 | 415905716/MQBench | 3ac8928ef6641e0ea78f9a5f0524b574a835463e |
1.3 | from abc import ABCMeta, abstractmethod
import torch
from pfrl.agents.dqn import DQN
from pfrl.utils.recurrent import pack_and_forward
class AbstractDPP(DQN, metaclass=ABCMeta):
"""Dynamic Policy Programming.
See: https://arxiv.org/abs/1004.2027.
"""
@abstractmethod
def _l_operator(self, qout)... | [
"torch.no_grad",
"torch.logsumexp"
] | 1.3.0 | ummavi/pfrl-1 | e856a7cca30fcc3871024cdf7522d066006a5f0c |
1.0 | import pathlib
import sys
import torch
here = pathlib.Path(__file__).resolve().parent
sys.path.append(str(here / '..' / '..'))
import controldiffeq
class NeuralCDE(torch.nn.Module):
"""A Neural CDE model. Provides a wrapper around the lower-level cdeint function, to get a flexible Neural CDE
model.
Spe... | [
"torch.nn.Linear",
"torch.cat",
"torch.zeros"
] | 1.0.0 | dungxibo123/NeuralCDE | 19f7ed24223f5822142c676127c92d818d290903 |
0.4 | import torch
import torch.nn as nn
from saliency.saliency import Saliency
class DeconvSaliency(Saliency):
"""docstring for DeconvSaliency."""
def __init__(self, model):
super(DeconvSaliency, self).__init__(model)
def guided_relu_hook(self, module, grad_in, grad_out):
return (torch.nn.fun... | [
"torch.zeros_like",
"torch.nn.functional.relu"
] | 0.4.0 | dendisuhubdy/pytorch-saliency | dcb3499be127637435a577cb42161b3e096aa28d |
0.4 | import torch
from saliency.saliency import Saliency
import numpy as np
from scipy.ndimage import label
import torchvision
from torch.autograd import Variable
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import to... | [
"torch.zeros",
"torch.nn.Linear",
"torch.nn.L1Loss",
"torch.from_numpy"
] | 0.4.0 | dendisuhubdy/pytorch-saliency | dcb3499be127637435a577cb42161b3e096aa28d |
1.7 | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"torch.nn.Linear",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Flatten"
] | 1.7.1 | billy-horn/lightning-flash | 61c741d37182d137f39b771879254db8fd20308f |
1.7 | from __future__ import print_function
import os
import argparse
import torch
import torch.backends.cudnn as cudnn
from PIL import Image
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as transforms
import numpy as np
import time
from data.config import cfg_mobilenetv2
from layers.fun... | [
"torch.cuda.current_device",
"torch.load",
"torch.sum",
"torch.FloatTensor",
"torch.Tensor",
"torch.device",
"torch.from_numpy",
"torch.set_grad_enabled"
] | 1.7 | lyp-deeplearning/MOS-Multi-Task-Face-Detect | 1bea754752e13fafdeb06f5fedcba1bd08e836de |
1.10 | import torch
from torch.utils.data import RandomSampler
from pathlib import Path
import sys
FILE = Path(__file__).resolve()
ROOT = FILE.parents[0].parents[0] # CogKGE root directory
if str(ROOT) not in sys.path:
sys.path.append(str(ROOT)) # add CogKGE root directory to PATH
from cogkge import *
device=init_cog... | [
"torch.utils.data.RandomSampler",
"torch.optim.lr_scheduler.ReduceLROnPlateau"
] | 1.10.1 | CogNLP/CogKGE | 70d851d6489600c1e90eb25b0388a3ceba2f078c |
1.7 | import torch
from torch import nn as nn
from torch.nn.functional import binary_cross_entropy_with_logits, cross_entropy
from bases.nn.conv2d import DenseConv2d
from bases.nn.linear import DenseLinear
from bases.nn.models.base_model import BaseModel
from bases.nn.sequential import DenseSequential
from .utils import is_... | [
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.BatchNorm2d",
"torch.nn.Parameter",
"torch.nn.ReLU",
"torch.tensor",
"torch.zeros_like"
] | 1.7.1 | yeshwanthv5/PruneFL | ad1f7f33b0605d1d79abfbe42ef287fcc613a943 |
1.1 | # Copyright (c) 2019. TsumiNa. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import torch
from torch import nn
__all__ = ['ConvLayer', 'CrystalGraphConvNet']
class ConvLayer(nn.Module):
"""
Convolutional operation on graphs
... | [
"torch.nn.Linear",
"torch.nn.LogSoftmax",
"torch.cat",
"torch.nn.Dropout",
"torch.nn.Sigmoid",
"torch.nn.BatchNorm1d",
"torch.nn.Softplus",
"torch.mean",
"torch.sum"
] | 1.1.0 | qi-zh/XenonPy | e91c680c773022982b80686c9faaf962e304916d |
1.8 | import torch
from torch import nn
from transformers import BertTokenizer, VisualBertModel, VisualBertConfig
import numpy as np
class VisualBertClassifier(nn.Module):
def __init__(self,
visual_bert_model,
num_classes: int = 8,
initial_visual_embedding_dim: int = 9... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.unsqueeze",
"torch.from_numpy",
"torch.ones"
] | 1.8.1 | inzva/emotion-recognition-drawings | 56435f42d76c10c10fa58149ccbcc8d05efccdc0 |
0.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 a cop... | [
"torch.distributed.get_world_size",
"torch.utils.data.RandomSampler",
"torch.cuda.is_available",
"torch.nn.CrossEntropyLoss",
"torch.nn.DataParallel",
"torch.distributed.init_process_group",
"torch.manual_seed",
"torch.tensor",
"torch.utils.data.DataLoader",
"torch.distributed.get_rank",
"torch.... | 0.4.1 | SebastianMuszynski/pytorch-pretrained-BERT | 1892015692a28096859a46243ae458f9f8aa003f |
1.3 | import numpy as np
from torchvision import datasets
import torchvision.transforms as transforms
import random
from torch.utils.data.sampler import SubsetRandomSampler
from torch.utils.data import DataLoader, Dataset
import torch
normalize_birds = transforms.Normalize(mean=[0.485, 0.456, 0.406],
... | [
"torch.utils.data.DataLoader"
] | 1.3.1 | RicoFio/disentangle_mlp | 1fb3b6070b5846051b8b9e9333e8ee61418f4893 |
1.6 | import pytest
import torch
import numpy as np
import gym
from d3rlpy.dataset import MDPDataset, Episode
from d3rlpy.preprocessing import create_action_scaler
from d3rlpy.preprocessing import MinMaxActionScaler
@pytest.mark.parametrize("scaler_type", ["min_max"])
def test_create_action_scaler(scaler_type):
scaler... | [
"torch.rand",
"torch.tensor"
] | 1.6.0 | jamartinh/d3rlpy | 87f478451674ef769eb8ce74e3663c4d3b1c325d |
1.8 | import torch
import torch.nn as nn
from .midas.midas_net import MidasNet
class DoepdNet(torch.nn.Module):
"""
There are 3 run modes available for this model.
1. Yolo : Trains/Inferences only yolo layer, while ignoring midas and planeRCNN
2. PlaneRCNN : Trains/Inferences only PlaneRCN... | [
"torch.nn.Conv2d",
"torch.load",
"torch.nn.Parameter"
] | 1.8.1 | namanshrimali/doepd.ai | fc57af2e131965d9d6c89e39a3eeab41c8dff40b |
1.1 | import torch
import torch.nn as nn
from mmcv.cnn import normal_init
from mmdet.core import distance2bbox, force_fp32, multi_apply, multiclass_nms, multiclass_nms_with_mask
from mmdet.ops import ModulatedDeformConvPack
from ..builder import build_loss
from ..registry import HEADS
from ..utils import ConvModule, Scale,... | [
"torch.cos",
"torch.cat",
"torch.sqrt",
"torch.nn.ModuleList",
"torch.sin",
"torch.arange",
"torch.nn.ReLU",
"torch.range",
"torch.nn.Conv2d",
"torch.meshgrid",
"torch.Tensor"
] | 1.1 | PanAndy/PolarMask | 0421f03a66ad4cbf7bdfe7a17a2e47e9fcc53737 |
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 ... | [
"torch.cat",
"torch.no_grad",
"torch.multiprocessing.set_start_method",
"torch.multiprocessing.set_sharing_strategy"
] | 0.4.0 | LangwenH/AlphaPose-for-Mice-Behavior | 357923f5993a521507fe7359fa763d2b5d2493f7 |
1.1 | import torch.utils.data as data
import torch
import albumentations
import cv2
import numpy as np
import random
import math
from settings import train_png_dir
def generate_transforms(image_size):
IMAGENET_SIZE = image_size
train_transform = albumentations.Compose([
albumentations.Resize(IMAGENET_SIZE, ... | [
"torch.FloatTensor",
"torch.utils.data.DataLoader"
] | 1.1.0 | BhaveshJP25/RSNA | 48d85faf82651b1ae4fdcd829ce2d4978a858d3f |
0.4 | import torch as th
from torch.distributions import Categorical
from .epsilon_schedules import DecayThenFlatSchedule
REGISTRY = {}
class MultinomialActionSelector():
def __init__(self, args):
self.args = args
self.schedule = DecayThenFlatSchedule(args.epsilon_start, args.epsilon_finish, args.eps... | [
"torch.distributions.Categorical",
"torch.rand_like"
] | 0.4.1 | PMatthaei/pymarl | eeec978e930c9e36d8102724c3b4d0459547cb36 |
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.tensor"
] | 1.3.1 | avinashsai/metrics | e383af24085bf7c0bd4e08db2757c25ff4feccdc |
1.7 | import torch.nn as nn
from wilds.common.metrics.loss import ElementwiseLoss, Loss, MultiTaskLoss
from wilds.common.metrics.all_metrics import MSE
def initialize_loss(config, d_out):
if config.get('loss_function') == 'cross_entropy':
return ElementwiseLoss(loss_fn=nn.CrossEntropyLoss(reduction='none')... | [
"torch.nn.CrossEntropyLoss",
"torch.nn.BCEWithLogitsLoss"
] | 1.7.0 | itsjohnward/wilds | aeafefd01456840c7bd5173d714b184ec86758af |
1.10 | from abc import ABC, abstractmethod
import random
import hashlib
import os
import traceback
import pathlib
import h5py
import torch
import numpy as np
from nn_analysis import utils
def attach_hooks(model, layer_names, get_hook):
handles = []
for layer_name, module in model.named_modules():
if layer_n... | [
"torch.no_grad",
"torch.utils.data.DataLoader",
"torch.arange"
] | 1.10.1 | hchau630/nn-analysis | 0fbe7ad7b2b4566b9f88d8f21413a6d405f96bdc |
1.10 | from argparse import Namespace
import torch
import torch.nn as nn
import torchvision.models as models
def off_diagonal(x):
# return a flattened view of the off-diagonal elements of a square matrix
n, m = x.shape
assert n == m
return x.flatten()[:-1].view(n - 1, n + 1)[:, 1:].flatten()
class BarlowTwi... | [
"torch.nn.Linear",
"torch.nn.Identity",
"torch.diagonal",
"torch.nn.Sequential",
"torch.nn.ReLU",
"torch.nn.BatchNorm1d",
"torch.distributed.all_reduce"
] | 1.10.1 | hchau630/nn-analysis | 0fbe7ad7b2b4566b9f88d8f21413a6d405f96bdc |
1.0 | from distutils.version import LooseVersion
import logging
import math
import random
import six
import numpy as np
import torch
import torch.nn.functional as F
from argparse import Namespace
from espnet.nets.ctc_prefix_score import CTCPrefixScore
from espnet.nets.ctc_prefix_score import CTCPrefixScoreTH
from espnet.n... | [
"torch.nn.Linear",
"torch.cat",
"torch.stack",
"torch.nn.ModuleList",
"torch.LongTensor",
"torch.topk",
"torch.index_select",
"torch.div",
"torch.zeros",
"torch.nn.LSTMCell",
"torch.fmod",
"torch.nn.Module.__init__",
"torch.nn.functional.log_softmax",
"torch.cuda.empty_cache",
"torch.nn.... | 1.0.1 | koso019003/espnet | 7735c992b3d71fabbc0f0c48c1d8f78d72785e17 |
1.5 | import logging
import os
import torch
import dill
import json
import pickle
import msgpack
from eisen.utils import EisenModuleWrapper
from eisen_deploy.utils import encode_data, decode_data
logger = logging.getLogger(__name__)
def json_file_to_dict(json_file):
if not os.path.exists(json_file):
raise Fi... | [
"torch.cuda.is_available",
"torch.Tensor",
"torch.load"
] | 1.5.0 | eisen-ai/eisen-deploy | ab1cdf0f8726cbfbdc7029616b1c753706b0039c |
1.2 | import csv
import errno
import hashlib
import logging
import os
import sys
import tarfile
import threading
import zipfile
from queue import Queue
import torch
import urllib
from torch.utils.data import Dataset
from torch.utils.model_zoo import tqdm
def unicode_csv_reader(unicode_csv_data, **kwargs):
r"""Since th... | [
"torch.utils.model_zoo.tqdm",
"torch.save",
"torch.load"
] | 1.2.0 | tomassosorio/audio | 0f8fa5f82af47543a68f1d3fb8921f8f9b6b15f8 |
1.0 | #!/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.
r"""
Batch acquisition functions using the reparameterization trick in combination
with (quasi) Monte-Carlo sampling. S... | [
"torch.is_tensor",
"torch.sigmoid"
] | 1.0.0 | shalijiang/bo | af13f0a38b579ab504f49a01f1ced13532a3ad49 |
1.0 | import torch
from torch import Tensor
import numpy as np
import matplotlib.pyplot as plt
from botorch.acquisition.analytic import ExpectedImprovement
from botorch.models import SingleTaskGP
from rollout import rollout, rollout_quad
import warnings
import time
import pickle
warnings.filterwarnings("ignore")
bound = 1.... | [
"torch.max",
"torch.no_grad",
"torch.linspace",
"torch.manual_seed",
"torch.Tensor"
] | 1.0.0 | shalijiang/bo | af13f0a38b579ab504f49a01f1ced13532a3ad49 |
1.7 | import torch
def corner_to_center(xmin, ymin, xmax, ymax):
cx, cy = (xmin + xmax) / 2, (ymin + ymax) / 2
w = xmax - xmin
h = ymax - ymin
return cx, cy, w, h
def center_to_corner(cx, cy, w, h):
xmin, ymin = cx - 0.5 * w, cy - 0.5 * h
xmax, ymax = cx + 0.5 * w, cy + 0.5 * h
return xmin, ymin... | [
"torch.sigmoid",
"torch.cat",
"torch.exp",
"torch.arange"
] | 1.7.0 | DavianYang/yolo.ai | 0856d4f1e84428667046ee27270ff1bf742e658a |
1.7 | from typing import Sequence, Union, Callable, AnyStr, Any
import torch
from torch import nn
import torch.nn.functional as F
from torch import Tensor
from yolo.models.modules.activation import get_activation_layer
class ConvBlock(nn.Module):
def __init__(
self,
in_channels: int,
out_channe... | [
"torch.rand",
"torch.nn.Sigmoid",
"torch.div",
"torch.nn.SiLU",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Upsample",
"torch.nn.Conv2d",
"torch.nn.AdaptiveAvgPool2d"
] | 1.7.0 | DavianYang/yolo.ai | 0856d4f1e84428667046ee27270ff1bf742e658a |
1.10 | import numpy as np
import scipy.stats.stats as sciStats
import torch
import torch.nn as nn
import torch.nn.functional as F
import logging
from volsim.params import *
class CorrelationLoss(nn.modules.loss._Loss):
def __init__(self, params:Params, useGPU:bool):
super(CorrelationLoss, self).__init__()
... | [
"torch.isnan",
"torch.nn.functional.l1_loss",
"torch.norm",
"torch.max",
"torch.zeros_like",
"torch.pow",
"torch.nn.functional.mse_loss",
"torch.tensor",
"torch.mean",
"torch.sum"
] | 1.10.0 | tum-pbs/VOLSIM | 795a31c813bf072eb88289126d7abd9fba8b0e54 |
1.9 | from gettext import find
import torch
from ezflow.utils import (
AverageMeter,
coords_grid,
endpointerror,
find_free_port,
forward_interpolate,
is_port_available,
upflow,
)
def test_endpointerror():
pred = torch.rand(4, 2, 256, 256)
target = torch.rand(4, 2, 256, 256)
_ = en... | [
"torch.rand"
] | 1.9.0 | neu-vig/ezflow | 1eb6f675e72b1de6db7b35d61ca4ef0082bae890 |
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.nn.Linear",
"torch.cat",
"torch.cuda.manual_seed",
"torch.ones",
"torch.squeeze",
"torch.cuda.is_available",
"torch.load",
"torch.transpose",
"torch.nn.CrossEntropyLoss",
"torch.sum",
"torch.sigmoid",
"torch.sqrt",
"torch.nn.Softmax",
"torch.manual_seed",
"torch.tensor",
"torch.... | 0.4.1 | mjj1094/Attention_BERT_62 | 22cae03ab7bcb09cfd3f8b0b9f2239f8e3ba56ce |
1.5 | import logging
import math
import os
import pickle
import random
import sys
import time
from math import ceil, log
from pathlib import Path
from typing import Dict, List, Set, Tuple
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import torch
import torch.nn as nn
import to... | [
"torch.nn.Linear",
"torch.sigmoid",
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.max",
"torch.nn.Embedding"
] | 1.5.0 | qqhann/KnowledgeTracing | cecdb9af0c44efffd1ce3359f331d7d7782f551b |
1.6 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import csv
import os
import shutil
from PIL import Image
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torch.utils... | [
"torch.device",
"torch.no_grad",
"torch.from_numpy",
"torch.cuda.is_available",
"torch.load",
"torch.nn.DataParallel"
] | 1.6.0 | Zhou1993napolun/Pose_enabler | 669fffd6cea57fec5fa9bd95868cc48347700f42 |
1.7 | import torch
import torch.nn as nn
from torchvision import models, transforms
from dataset import HCPDataset
# from torch.utils.data import DataLoader
from torch_geometric.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
import torch.nn.functional as F
EPOCHS = 120
IS_SEX = True # comment: decl... | [
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.nn.functional.dropout",
"torch.unsqueeze",
"torch.nn.Conv2d",
"torch.cuda.is_available",
"torch.nn.CrossEntropyLoss",
"torch.reshape"
] | 1.7.1 | vimarkova/dggru | 019106a491f28f15aa33a3ae1b575794f1a6e1af |
1.9 | import torch
from torch import Tensor, log
from ..neko_module import NekoModule
class Log(NekoModule):
"""
The module version of :func:`torch.log` operation.
Args:
eps (``float``, optional): A bias applied to the input to avoid ``-inf``. Default ``0``.
Examples::
>>> log = Log()
... | [
"torch.log"
] | 1.9.0 | ControlNet/tensorneko | 70dfb2f6395e1703dbdf5d5adcfed7b1334efb8f |
1.9 | from typing import Union
import torch
from numpy import ndarray
from torch import Tensor
def iou_1d(pred: Union[Tensor, ndarray], real: Union[Tensor, ndarray]) -> Tensor:
"""
Calculate 1D IOU for N proposals with L labels.
Args:
pred (:class:`~torch.Tensor` | :class:``): The predicted array with... | [
"torch.clamp",
"torch.tensor",
"torch.minimum",
"torch.maximum"
] | 1.9.0 | ControlNet/tensorneko | 70dfb2f6395e1703dbdf5d5adcfed7b1334efb8f |
1.8 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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 o... | [
"torch.cuda.reset_peak_memory_stats",
"torch.cuda.max_memory_allocated",
"torch.cuda.memory_allocated"
] | 1.8 | facebookresearch/opacus | 5cc574ff877b0be5634dde8fdd5130b7090491a6 |
1.0 | import argparse
import atexit
import copy
import datetime
import numpy as np
import os
import torch
import tensorboardX
from functools import partial
from prob_mbrl import utils, models, algorithms, envs
if __name__ == '__main__':
parser = argparse.ArgumentParser("Deep-PILCO with moment matching")
parser.add_... | [
"torch.manual_seed",
"torch.cuda.is_available",
"torch.tensor",
"torch.set_flush_denormal",
"torch.set_num_threads"
] | 1.0 | gamerDecathlete/prob_mbrl | efba089bb066f32ad9133ac2504099e05aac5846 |
1.2 | #!/usr/bin/env python3
import typing
from enum import Enum
from inspect import signature
from typing import Any, Callable, List, Tuple, Union, cast, overload
import torch
from torch import Tensor, device
from torch.nn import Module
from .._utils.typing import Literal, TargetType
class ExpansionTypes(Enum):
repe... | [
"torch.cat",
"torch.tensor",
"torch.numel"
] | 1.2 | vinnamkim/captum | b7429d1561b6018e0d53d68eaafc6632e97ac164 |
1.10 | import torch
import pandas as pd
class ESXDataset(torch.utils.data.Dataset):
def __init__(self, train_X, train_Y, train_T, train_E):
self.train_X = torch.from_numpy(train_X).float()
self.train_T = torch.from_numpy(train_T).float() # label of treatment status
self.train_Y = torch.from_nump... | [
"torch.from_numpy"
] | 1.10.1 | kailiang-zhong/DESCN | 2aab9da518f1426d8bc753e82e2be6d8d54ce537 |
1.7 | import argparse
import os
import pickle
from types import SimpleNamespace
from typing import OrderedDict
from pytorch_lightning import callbacks
from torch._C import device
from utils.vocab import build_vocab, load_vocab
from utils.data_loader import get_loader
from utils import NLGEval
from torchvision.transforms imp... | [
"torch.nn.MSELoss",
"torch.cuda.is_available",
"torch.tensor",
"torch.nn.CrossEntropyLoss",
"torch.multiprocessing.set_sharing_strategy"
] | 1.7.0 | nihirv/blt-vqg | 73ce8510fb2a696b44b686e38418cc0a11982162 |
0.4 | import numpy as np
from sklearn.cluster import KMeans
import torch
import torch.nn as nn
from torch.utils.data.dataloader import DataLoader, default_collate
from typing import Tuple, Callable, Optional, Union
from tqdm import tqdm
from ptdec.utils import target_distribution, cluster_accuracy
def train(
dataset: ... | [
"torch.cat",
"torch.utils.data.dataloader.DataLoader",
"torch.no_grad",
"torch.tensor",
"torch.nn.KLDivLoss"
] | 0.4.0 | giorgosVardakas/pt-dec | c29b9634eb74c828efd9d2b87c613cdb0ddd1dd5 |
1.9 | from sklearn.model_selection import GridSearchCV
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import VotingClassifier
from sklearn.svm import S... | [
"torch.nn.Linear",
"torch.nn.LogSoftmax",
"torch.no_grad",
"torch.from_numpy",
"torch.cuda.is_available",
"torch.tensor",
"torch.nn.CrossEntropyLoss"
] | 1.9.0 | ChristianCKKoch/Projektarbeit_Digethic | 80999e48de29106545398252bbc6cea2b8b953ce |
1.2 | """
This includes: LossComputeBase and the standard NMTLossCompute, and
sharded loss compute stuff.
"""
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
import onmt
from onmt.modules.sparse_losses import SparsemaxLoss
from onmt.modules.sparse_activations... | [
"torch.nn.NLLLoss",
"torch.autograd.backward",
"torch.gt",
"torch.min",
"torch.lt",
"torch.split",
"torch.nn.functional.kl_div",
"torch.full",
"torch.nn.functional.cross_entropy",
"torch.tensor",
"torch.zeros_like",
"torch.nn.functional.nll_loss",
"torch.topk"
] | 1.2 | silverriver/AdaLabel | baefd765d79d90869ed4d28f76418c1a39eb0ae8 |
1.7 | """Internal utilities."""
import functools
import numbers
import numpy as np
import scipy.sparse
import torch
from pymde.average_distortion import _project_gradient
_DEVICE = torch.device("cpu")
class SolverError(Exception):
pass
def get_default_device():
return str(_DEVICE)
def _canonical_device(devi... | [
"torch.stack",
"torch.triu_indices",
"torch.enable_grad",
"torch.cuda.current_device",
"torch.eye",
"torch.sum",
"torch.sqrt",
"torch.tensor",
"torch.zeros",
"torch.device",
"torch.cos",
"torch.isclose",
"torch.matmul",
"torch.sin",
"torch.split",
"torch.deg2rad",
"torch.randn",
"t... | 1.7.1 | kruus/pymde | 0bfa9c308660bda2fa5161ffce00ce22ef6e773b |
1.6 | from flash_pytorch import FLASHTransformer
from flash_pytorch.autoregressive_wrapper import AutoregressiveWrapper
import random
import tqdm
import gzip
import numpy as np
import torch
import torch.optim as optim
from torch.nn import functional as F
from torch.utils.data import DataLoader, Dataset
# constants
NUM_BAT... | [
"torch.no_grad",
"torch.utils.data.DataLoader",
"torch.from_numpy"
] | 1.6 | dumpmemory/FLASH-pytorch | 8e0d2fd7925c0de9703d666ea2cc004327f6e544 |
1.0 | import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '../utils'))
import numpy as np
import argparse
import librosa
import matplotlib.pyplot as plt
import torch
from utilities import create_folder, get_filename
from models import *
from pytorch_utils import move_data_to_device
import config
def audio_t... | [
"torch.device",
"torch.no_grad",
"torch.cuda.device_count",
"torch.cuda.is_available",
"torch.load",
"torch.nn.DataParallel"
] | 1.0.1 | rollingman1/audioset_tagging_cnn | 5036f772dfa8dd05fbfb0b6fa5bfedcea10cfb10 |
1.4 | """ Split BatchNorm
A PyTorch BatchNorm layer that splits input batch into N equal parts and passes each through
a separate BN layer. The first split is passed through the parent BN layers with weight/bias
keys the same as the original BN. All other splits pass through BN sub-layers under the '.aux_bn'
namespace.
Thi... | [
"torch.cat",
"torch.nn.BatchNorm2d"
] | 1.4.0 | wenh18/OnDeviceNAS | d6e39500b794ddd9737ef4bc631cf4f977b47617 |
1.4 | """ EfficientNet, MobileNetV3, etc Blocks
Hacked together by / Copyright 2019, Ross Wightman
"""
import torch
import torch.nn as nn
from torch.nn import functional as F
from .layers import create_conv2d, drop_path, make_divisible, create_act_layer
from .layers.activations import sigmoid
__all__ = [
'SqueezeExci... | [
"torch.nn.Linear",
"torch.nn.Conv2d",
"torch.nn.Identity",
"torch.nn.functional.adaptive_avg_pool2d"
] | 1.4.0 | wenh18/OnDeviceNAS | d6e39500b794ddd9737ef4bc631cf4f977b47617 |
0.1 | import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, config):
super(Model, self).__init__()
self.conv1 = nn.Conv2d(3, 16, (3, 3), padding=1)
self.conv1_bn = nn.BatchNorm2d(16)
self.conv2 = nn.Conv2d(16, 32, (3, 3), padding=1, s... | [
"torch.nn.Linear",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d"
] | 0.1.2 | andrearosasco/DistilledReplay | 2a4efa88d22b9afc7016f07549114688f346dbe8 |
0.1 | import importlib
import os
from collections import OrderedDict
import torch
from torchvision.transforms import transforms
model_config = OrderedDict([
('arch', 'mlp2'),
('n_classes', 10),
('dropout', 0.5)
])
data_config = OrderedDict([
('dataset', 'PermutedMNIST'),
('valid', 0.0),
('num_worke... | [
"torch.FloatTensor"
] | 0.1.2 | andrearosasco/DistilledReplay | 2a4efa88d22b9afc7016f07549114688f346dbe8 |
1.7 | from typing import Optional, Any
import torch
import numpy as np
from abc import ABC, abstractmethod
from functools import lru_cache
from slam.common.utils import check_tensor, assert_debug
def torch__spherical_projection(t_pointcloud: torch.Tensor,
height: int,
... | [
"torch.arange",
"torch.norm",
"torch.argsort",
"torch.ones",
"torch.floor",
"torch.atan2",
"torch.asin"
] | 1.7.1 | Pandinosaurus/pyLiDAR-SLAM | 1baa21a67bd32f144f8e17583251ac777f81345e |
1.4 | '''
A module which implements the basic Transformer
'''
import uuid
import threading
import pdb
import torch
from torch import nn
from models.new_attention import NewAttention
from models.attention import MultiHeadedAttention
from models.embeddings import PositionEmbedding, TokenEmbedding
from models.utils import Labe... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"torch.cat",
"torch.nn.init.constant_",
"torch.nn.init.xavier_uniform_",
"torch.nn.ReLU",
"torch.nn.init.calculate_gain",
"torch.nn.CrossEntropyLoss"
] | 1.4.0 | Khoale1096/stupidNMT | 894536c16dc7ff958aa5571828a89ecabfcb72d7 |
1.0 | import torchvision
from torchvision.models import resnet as vrn
import torch.utils.model_zoo as model_zoo
from .utils import register
class ResNet(vrn.ResNet):
'Deep Residual Network - https://arxiv.org/abs/1512.03385'
def __init__(self, layers=[3, 4, 6, 3], bottleneck=vrn.Bottleneck, outputs=[5], groups=1, ... | [
"torch.utils.model_zoo.load_url"
] | 1.0.0 | Mo5mami/retinanet-examples | f7ad4ff6a99fe3e66f8a9c8e8a6e03b870f84700 |
1.8 | import argparse
import random
import numpy as np
import torch
from tsformer.exp_autoformer import Exp_Main
fix_seed = 2021
random.seed(fix_seed)
torch.manual_seed(fix_seed)
np.random.seed(fix_seed)
parser = argparse.ArgumentParser(
description='Autoformer & Transformer family for Time Series Forecasting')
# ba... | [
"torch.manual_seed",
"torch.cuda.empty_cache",
"torch.cuda.is_available"
] | 1.8.0 | Fanxingye/TsFormer | da6e7eee1bddb44e2e98f07c9f0d374793e80da6 |
1.0 | import cv2
import numpy as np
import torch
import torch.nn as nn
from torch.nn import functional as F
class GuidedBackProp():
def __init__(self, model, use_cuda):
self.model = model.eval()
self.use_cuda = use_cuda
if self.use_cuda:
self.model = self.model.cuda()
... | [
"torch.clamp",
"torch.from_numpy",
"torch.sum"
] | 1.0.0 | kamata1729/visualize-pytorch | ec1b3fe0952c5db187a5d4875cd1539a1b7a1270 |
0.4 | import torch as th
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class PointLikeMixer(nn.Module):
def __init__(self, args):
super(PointLikeMixer, self).__init__()
self.args = args
self.n_agents = args.n_agents
self.n_groups = args.mixing_group_dim
... | [
"torch.nn.Linear",
"torch.bmm",
"torch.nn.ReLU"
] | 0.4.1 | wjh720/pymarl | 9392407568d440c4808a1c7c98ddf1ef52e0c009 |
1.8 | import torch
from pytorchfi.core import fault_injection as pfi_core
from .util_test import helper_setUp_CIFAR10_same
class TestWeightFIcpu:
"""
Testing focuses on weight perturbations.
"""
def setup_class(self):
torch.manual_seed(0)
self.BATCH_SIZE = 1
self.WORKERS = 1
... | [
"torch.manual_seed",
"torch.no_grad"
] | 1.8.1 | TarekAloui/pytorchfi | 29915e158941a21fc786e6a59c958ec751a59167 |
0.4 | import json
import math
import logging
import string
import nltk
import scipy
import torch
from nltk.stem.porter import *
import numpy as np
from collections import Counter
import os
from torch.autograd import Variable
import config
import pykp
from utils import Progbar
from pykp.metric.bleu import bleu
stemmer = ... | [
"torch.cuda.is_available",
"torch.LongTensor"
] | 0.4.0 | malarinv/seq2seq-keyphrase-pytorch | 14350477867bbaafe285d6ac0e7a814f4cda1bdf |
1.4 | import torch
from torch import Tensor
EPS = torch.tensor(1e-8)
@torch.jit.script
def dist_iou_ab(box_a: Tensor, box_b: Tensor, eps=EPS):
"""
Args:
box_a: tensor of shape [batch_size, boxes_a, 4]
box_b: tensor of shape [batch_size, boxes_b, 4]
gamma: float
eps: float
Origi... | [
"torch.prod",
"torch.min",
"torch.max",
"torch.clamp_min_",
"torch.tensor",
"torch.zeros_like",
"torch.pow"
] | 1.4.0 | dmitry-vorobiev/kaggle-global-wheat-detection | adf75b73f5955848488477c361c66f1b0510b2bb |
0.4 | # -*- coding: utf-8 -*-
"""
@author:XuMing(xuming624@qq.com)
@description:
"""
import os
import sys
import torch
import torch.nn as nn
from torch.utils.data.dataset import TensorDataset
sys.path.append("..")
from rater.datasets.criteo import Criteo
from rater.models.ctr.flen import FLEN
from rater.models.model impo... | [
"torch.utils.data.dataset.TensorDataset",
"torch.cuda.is_available",
"torch.LongTensor",
"torch.nn.BCELoss",
"torch.Tensor"
] | 0.4.1 | shibing624/rater | 8437dea8baf0137ab3c07dd19c5f2bb8c15b4435 |
0.4 | # -*- coding: utf-8 -*-
"""
@author:XuMing(xuming624@qq.com)
@description:
@reference: https://github.com/tkipf/pygcn; https://github.com/dawnranger/pytorch-AGNN
"""
from __future__ import division
from __future__ import print_function
import argparse
import time
import numpy as np
import torch
import torch.nn.func... | [
"torch.cuda.manual_seed",
"torch.autograd.Variable",
"torch.manual_seed",
"torch.cuda.is_available",
"torch.nn.functional.nll_loss"
] | 0.4.1 | shibing624/rater | 8437dea8baf0137ab3c07dd19c5f2bb8c15b4435 |
1.4 | # encoding: utf-8
"""
@author: liaoxingyu
@contact: sherlockliao01@gmail.com
"""
import torch
import torch.nn.functional as F
from fastreid.utils import comm
from fastreid.layers import GatherLayer
from .utils import concat_all_gather, euclidean_dist, normalize
def softmax_weights(dist, mask):
max_v = torch.ma... | [
"torch.max",
"torch.nn.functional.margin_ranking_loss",
"torch.nn.functional.soft_margin_loss",
"torch.exp",
"torch.sum"
] | 1.4.0 | tenghehan/reid_without_id | d1d0ff273b1ef19fc6da8cbbf210527779b37455 |
0.4 | # pylint: disable=invalid-name,no-self-use,protected-access
from collections import namedtuple
import os
import pytest
from flaky import flaky
from numpy.testing import assert_almost_equal
import torch
from allennlp.common.testing import ModelTestCase
from allennlp.training.metrics.wikitables_accuracy import SEMPRE_A... | [
"torch.FloatTensor",
"torch.LongTensor"
] | 0.4.1 | csbhagav/allennlp | 4c99f8e82f7fd70c86652109bfca5282d470e981 |
1.8 | """Test cases for datahandling."""
import unittest
import torch
from dfadetect.datasets import AudioDataset
from dfadetect.utils import find_wav_files
from tests.utils import REAL_PATH, load_real, load_special
class TestAudioDataset(unittest.TestCase):
def test_loading_audio(self):
dataset = load_real(... | [
"torch.allclose"
] | 1.8.1 | RUB-SysSec/WaveFake | d52d51b9ccdb0cec3f484e84b228791f06b955be |
1.1 | # 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 torch.utils import data
import numpy as np
from functools import reduce
from egg.zoo.objects_game.util import compute_binomia... | [
"torch.from_numpy"
] | 1.1.0 | Shawn-Guo-CN/EGG | 0a5b258108e2cd1c873d7f67e8c92551bb3d809c |
1.0 | import sys
import pytest
import numpy as np
import torch
from numpy.testing import assert_
sys.path.append("../../../")
from pycroscopy.learn import Trainer, models
def assert_weights_equal(m1, m2):
eq_w = []
for p1, p2 in zip(m1.values(), m2.values()):
eq_w.append(np.array_equal(
p1.det... | [
"torch.manual_seed",
"torch.randn"
] | 1.0.0 | itsalexis962/pycroscopy | 8a6557408ffdc332cef102616be16e26a396532f |
1.0 | import logging
import pytest
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchgeometry as tgm
logger = logging.getLogger(__name__)
class TestIntegrationFocalLoss:
# optimization
thresh = 1e-1
lr = 1e-3
num_iterations = 1000
num_classes = ... | [
"torch.rand",
"torch.nn.init.xavier_uniform_",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.LongTensor"
] | 1.0.0 | fkluger/torchgeometry | 5f1a4dc8ff3647a60901b79aa90a4e799829a7a2 |
1.0 | from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from .one_hot import one_hot
# based on:
# https://github.com/kevinzakka/pytorch-goodies/blob/master/losses.py
class TverskyLoss(nn.Module):
r"""Criterion that computes Tversky Coeficient loss.
According to [1],... | [
"torch.sum",
"torch.is_tensor",
"torch.mean",
"torch.nn.functional.softmax"
] | 1.0.0 | fkluger/torchgeometry | 5f1a4dc8ff3647a60901b79aa90a4e799829a7a2 |
1.6 | import torch
from torch.optim import SGD
from d3rlpy.models.torch.v_functions import create_value_function
from d3rlpy.models.torch.policies import squash_action, create_normal_policy
from d3rlpy.models.torch.policies import create_categorical_policy
from .utility import torch_api, train_api, eval_api
from .utility im... | [
"torch.no_grad"
] | 1.6.0 | DenDen047/d3rlpy | 6184518d52f961ba6ca9f045761f810706110aa7 |
1.4 | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"torch.isfinite"
] | 1.4 | loic-beheshti/pytorch-lightning | 6ac16ff34822cef9b3c16e54f872655b585a066a |
1.8 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch
class _InfiniteSampler(torch.utils.data.Sampler):
"""Wraps another Sampler to yield an infinite stream."""
def __init__(self, sampler):
self.sampler = sampler
def __iter__(self):
while True:
... | [
"torch.utils.data.WeightedRandomSampler",
"torch.utils.data.RandomSampler",
"torch.utils.data.BatchSampler"
] | 1.8.1 | VinAIResearch/mDSDI | 8ec49085d8389ab490ec633c3ae4bf66be085366 |
1.5 | import unittest
import torch
from models import VanillaVAE
from torchsummary import summary
class TestVAE(unittest.TestCase):
def setUp(self) -> None:
# self.model2 = VAE(3, 10)
self.model = VanillaVAE(3, 10)
def test_summary(self):
print(summary(self.model, (3, 64, 64), device="cpu"... | [
"torch.randn"
] | 1.5.0 | threewisemonkeys-as/PyTorch-VAE | 4ed0fc7581d4792b435134aa9e06d5e35a5db118 |
1.5 | from typing import List, Optional
import torch
from torch import nn
from torch.nn import functional as F
from torchvision.models import vgg19_bn
from .base import BaseVAE
class DFCVAE(BaseVAE):
def __init__(
self,
in_channels: int,
latent_dim: int,
hidden_dims: List = None,
... | [
"torch.nn.Linear",
"torch.nn.Sequential",
"torch.nn.Tanh",
"torch.nn.BatchNorm2d",
"torch.nn.ConvTranspose2d",
"torch.nn.LeakyReLU",
"torch.nn.functional.mse_loss",
"torch.randn_like",
"torch.nn.Conv2d",
"torch.flatten",
"torch.exp",
"torch.randn"
] | 1.5.0 | threewisemonkeys-as/PyTorch-VAE | 4ed0fc7581d4792b435134aa9e06d5e35a5db118 |
1.5 | from typing import List, Optional
import torch
from torch import nn
from torch.distributions import Normal
from torch.nn import functional as F
from .base import BaseVAE
class MIWAE(BaseVAE):
def __init__(
self,
in_channels: int,
latent_dim: int,
hidden_dims: List = None,
... | [
"torch.nn.Linear",
"torch.nn.Sequential",
"torch.nn.Tanh",
"torch.nn.BatchNorm2d",
"torch.nn.ConvTranspose2d",
"torch.nn.LeakyReLU",
"torch.randn_like",
"torch.nn.Conv2d",
"torch.nn.functional.softmax",
"torch.flatten",
"torch.exp",
"torch.randn",
"torch.sum"
] | 1.5.0 | threewisemonkeys-as/PyTorch-VAE | 4ed0fc7581d4792b435134aa9e06d5e35a5db118 |
3 | import torch
import torch.nn as nn
from torch3d.nn import functional as F
from torch3d.nn.utils import _single
class FeaturePropagation(nn.Sequential):
"""
The feature propagation from the `"PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space" <https://arxiv.org/abs/1706.02413>`_ pa... | [
"torch.cat",
"torch.nn.Conv1d",
"torch.nn.Sequential",
"torch.gather",
"torch.nn.Sigmoid",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.BatchNorm1d",
"torch.reciprocal"
] | 3 | zhangmozhe/torch3d | d47e9b243e520f9c0c72a26c271d2c7ad242cb65 |
1.1 | # -*- coding: utf-8 -*-
# @Date : 2019-07-25
# @Author : Xinyu Gong (xy_gong@tamu.edu)
# @Link : None
# @Version : 0.0
import comet_ml
import os
import numpy as np
import torch
import torch.nn as nn
from torchvision.utils import make_grid
import torch.nn.functional as F
from imageio import imsave
from tqdm impo... | [
"torch.argmin",
"torch.ones",
"torch.sum",
"torch.nn.init.constant_",
"torch.nn.init.normal_",
"torch.nn.BCELoss",
"torch.nn.init.orthogonal_",
"torch.neg",
"torch.zeros",
"torch.nn.functional.softplus",
"torch.min",
"torch.max",
"torch.nn.ReLU",
"torch.cuda.empty_cache",
"torch.log",
... | 1.1.0 | gargrohin/sngan.pytorch | 58d200c731935360f1b0fdcb1865c366c633e56c |
1.6 | import argparse
import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
from torch.utils import data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.utils as... | [
"torch.autograd.Variable",
"torch.no_grad",
"torch.manual_seed",
"torch.load",
"torch.utils.tensorboard.SummaryWriter"
] | 1.6.0 | microsoft/event-vae-rl | cb64c2809bcbfec81e84fff93a912f65c72f73d3 |
1.10 | import torch
from torch.utils.data import Dataset
import cv2
import numpy as np
import pandas as pd
__all__ = ['VideoDataset', 'VideoLabelDataset']
class VideoDataset(Dataset):
""" Video Dataset for loading video.
It will output only path of video (neither video file path or video folder path).
... | [
"torch.utils.data.DataLoader"
] | 1.10.0 | Jo951128/2021-2-MIP | 511e0a38816d16fdba9631f76cf913ba51c43138 |
1.1 | # 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 argparse
import json
from torch.nn import functional as F
import torch.utils.data
from torchvision import datasets, transforms
import to... | [
"torch.nn.functional.nll_loss"
] | 1.1.0 | Slowika/GameBias-EmeCom2020 | 5b94c47559f8202bca99c26fc1bcb078dd0509a6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.