version stringclasses 25
values | code stringlengths 75 178k | apis list | full_version stringlengths 1 6 | repo_name stringlengths 9 78 | hexsha stringlengths 40 40 |
|---|---|---|---|---|---|
1.0 | ###############################################################################
# BSD 3-Clause License
#
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Author & Contact: Guilin Liu (guilinl@nvidia.com)
###############################################################################
import torch
impo... | [
"torch.mul",
"torch.no_grad",
"torch.clamp",
"torch.ones",
"torch.nn.functional.conv2d"
] | 1.0.0 | dukebw/MichiGAN | 3048e259dd2d368bb7a790a034e54d46f3da2a20 |
1.2 | import torch
from overrides import overrides
from allennlp.modules.span_extractors.span_extractor import SpanExtractor
from allennlp.modules.time_distributed import TimeDistributed
from allennlp.nn import util
@SpanExtractor.register("self_attentive")
class SelfAttentiveSpanExtractor(SpanExtractor):
"""
Compu... | [
"torch.nn.Linear"
] | 1.2.0 | tkim135/allennlp | 397f46bd83e24ad8c40a9febd2b5be49583012a6 |
0.3 | import json
import os
import pickle
import re
import torch
from tqdm import tqdm
classes = {
'number':['0','1','2','3','4','5','6','7','8','9','10'],
'material':['rubber','metal'],
'color':['cyan','blue','yellow','purple','red','green','gray','brown'],
'shape':['sphere'... | [
"torch.autograd.Variable",
"torch.LongTensor",
"torch.stack",
"torch.arange"
] | 0.3.1 | mesnico/RelationNetworks-CLEVR | b8e0e7af12408877c8a18d8f2802d88138605983 |
1.3 | # Copyright 2018 Dong-Hyun Lee, Kakao Brain.
# (Strongly inspired by original Google BERT code and Hugging Face's code)
""" Fine-tuning on A Classification Task with pretrained Transformer """
import itertools
import csv
import os
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
fro... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.cat",
"torch.utils.data.Dataset.__init__",
"torch.nn.ReLU",
"torch.tensor",
"torch.utils.data.DataLoader",
"torch.nn.CrossEntropyLoss",
"torch.nn.AdaptiveMaxPool1d"
] | 1.3.1 | theblackcat102/ALBERT-Pytorch | eebf3465cbc82c643dbe561b480bed0116f34d21 |
1.1 | import torch.optim as optim
from models import build_dual_model
from dataset import MetricLearningDataset
from torch.utils.data import DataLoader
from augmentation import transform_train, transform_test
from torch.autograd import Variable
import math
import torch
import numpy as np
from trainer.trainer import compute_k... | [
"torch.zeros",
"torch.cat",
"torch.cuda.manual_seed",
"torch.unique",
"torch.no_grad",
"torch.softmax",
"torch.manual_seed",
"torch.utils.data.DataLoader",
"torch.load",
"torch.Tensor",
"torch.mean"
] | 1.1.0 | aioz-ai/BMVC20_CBSwR | fd24336c3cba0b85c0fa2482bf82409457534266 |
1.4 | from collections import namedtuple
import os
from ding.torch_utils.data_helper import to_device, to_dtype, to_tensor
import torch
from torchvision import transforms
import numpy as np
from typing import Dict, List, Any, Optional
from .base_carla_policy import BaseCarlaPolicy
from core.models import PIDController, Cust... | [
"torch.device",
"torch.no_grad",
"torch.eye",
"torch.cuda.is_available"
] | 1.4 | timothijoe/DI-drive | 3cddefc85bbbca6bcdd8a4d796decacaf8d81778 |
1.4 | import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.org/models/resnet34-333f... | [
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.AvgPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.init.kaiming_normal_",
"torch.utils.model_zoo.load_url",
"torch.nn.init.constant_",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.AdaptiveAvgPool2d"
] | 1.4 | timothijoe/DI-drive | 3cddefc85bbbca6bcdd8a4d796decacaf8d81778 |
1.9 | from conf import *
import torch
import random
import numpy as np
import os
from typing import Dict, Tuple, Any
from sklearn.metrics import roc_auc_score
from scipy.special import expit, softmax
from sklearn.metrics import precision_score
def set_seed(seed=1234):
random.seed(seed)
os.environ['PYTHONHASHSEE... | [
"torch.device",
"torch.cat",
"torch.cuda.manual_seed",
"torch.manual_seed",
"torch.ones_like",
"torch.topk"
] | 1.9.0 | iamkaiwei/kaggle-landmark-recognition-2020-1st-place | 97df71ecfd37122730b7f0b29fde09ac36358609 |
0.4 | import numpy as np
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import copy
import time
import logging
from torch.autograd import Variable
import pdb
from src.components.utils import *
from src.components.encoder import *
from src.components.decoder import *
... | [
"torch.nn.Linear",
"torch.nn.init.xavier_uniform_"
] | 0.4.0 | arkilpatel/Transformer-Computation-Analysis | 82341f5f2f9cd0831e390f44b338165e45cd6413 |
1.1 | import torch
from tqdm import tqdm
from ...utils.learning import adjust_learning_rate
from ...utils.log import logger
from ...base.module import Module
from .config import DEVICE, DEFAULT_CONFIG
from .model import Config, BiLstmCrf
from .tool import cws_tool
from .utils.convert import bis_cws
seed = 2019
torch.manua... | [
"torch.manual_seed",
"torch.cuda.manual_seed",
"torch.tensor"
] | 1.1.0 | CNLPT/lightNLP | c7f128422ba5b16f514bb294145cb3b562e95829 |
1.0 | #
# Copyright (c) 2018 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... | [
"torch.zeros_like",
"torch.nn.Parameter"
] | 1.0.1 | HatsuneMiku4/distiller | 8fbacb01ebcb7d70c5d3ecb6a88093e6c4d42137 |
1.4 | """Functions for runtime type checking. More strict but slower than availabe
static type checking. Off by default.
"""
import os
from typing import Any, Optional, Tuple
import torch
def assert_joint_probability(
x: torch.Tensor, shape: Tuple[int, ...], allow_improper: bool = False
) -> None:
"""Assert `x` is... | [
"torch.Tensor"
] | 1.4.0 | tcfuji/capi | 4c0f648216ae22d29c537318fb9a646d430cf310 |
0.6 | import math
import numpy as np
from typing import Optional
import torch
import torch.nn.functional as F
__all__ = [
"focal_loss_with_logits",
"softmax_focal_loss_with_logits",
"soft_jaccard_score",
"soft_dice_score",
"wing_loss",
]
def to_tensor(x, dtype=None) -> torch.Tensor:
if isinstance... | [
"torch.nn.functional.binary_cross_entropy_with_logits",
"torch.from_numpy",
"torch.nn.functional.log_softmax",
"torch.nn.functional.nll_loss",
"torch.log",
"torch.exp",
"torch.sum"
] | 0.6.3 | vietnhatthai/segmentation_models.pytorch | 9052aa2a4f09a600f687120e69ad2b57c04cc0dd |
1.4 | # -*- coding: utf-8 -*-
from collections.abc import Sequence
import io
import math
import warnings
from typing import Optional, Tuple
import torch
from torch import Tensor
from torchaudio._internal import module_utils as _mod_utils
import torchaudio
__all__ = [
"spectrogram",
"griffinlim",
"amplitude_to_... | [
"torch.round",
"torch.cat",
"torch.view_as_real",
"torch.stack",
"torch.istft",
"torch.nn.functional.pad",
"torch.exp",
"torch.stft",
"torch.sum",
"torch.sqrt",
"torch.log1p",
"torch.norm",
"torch.view_as_complex",
"torch.i0",
"torch.abs",
"torch.tensor",
"torch.polar",
"torch.zero... | 1.4.0 | jaeyeun97/audio | 8a347b62cf5c907d2676bdc983354834e500a282 |
1.2 | """
Fixtures for unit tests.
"""
import pytest
import numpy as np
import torch
from lettuce import (
stencils, Stencil, get_subclasses, Transform, Lattice, moments
)
STENCILS = list(get_subclasses(Stencil, stencils))
TRANSFORMS = list(get_subclasses(Transform, moments))
@pytest.fixture(
params=["cpu", pyte... | [
"torch.cuda.is_available"
] | 1.2 | je-santos/lettuce | 9455449b997eb245cd714c5759d7a7cd4c33b1dc |
1.2 | """
Collision models
"""
import torch
from lettuce.equilibrium import QuadraticEquilibrium
from lettuce.util import LettuceException
__all__ = [
"BGKCollision", "KBCCollision2D", "KBCCollision3D", "MRTCollision", "RegularizedCollision",
"SmagorinskyCollision", "TRTCollision", "BGKInitialization"
]
class BG... | [
"torch.zeros",
"torch.zeros_like",
"torch.isnan",
"torch.einsum"
] | 1.2 | je-santos/lettuce | 9455449b997eb245cd714c5759d7a7cd4c33b1dc |
0.4 | #!/usr/bin/env python3
import gym
from collections import namedtuple
import numpy as np
from tensorboardX import SummaryWriter
import torch
import torch.nn as nn
import torch.optim as optim
HIDDEN_SIZE = 128
BATCH_SIZE = 16
PERCENTILE = 70
class Net(nn.Module):
def __init__(self, obs_size, hidden_size, n_actio... | [
"torch.nn.Linear",
"torch.nn.Softmax",
"torch.FloatTensor",
"torch.nn.ReLU",
"torch.LongTensor",
"torch.nn.CrossEntropyLoss"
] | 0.4.1 | castorfou/drl_handson | 4f5a07611c483ad20022afd37961559131c5bf31 |
1.7 | """
(c) 2020 Spencer Rose, MIT Licence
Python Landscape Classification Tool (PyLC)
Reference: An evaluation of deep learning semantic segmentation
for land cover classification of oblique ground-based photography,
MSc. Thesis 2020.
<http://hdl.handle.net/1828/12156>
Spencer Rose <spencerrose@uvic.ca>, June 2020
Uni... | [
"torch.save",
"torch.tensor",
"torch.as_tensor"
] | 1.7.0 | scrose/pylc | 9c4c4e84a14cb3adc0b4226199e4cd5841384b0b |
1.7 | import torch
import torch.utils.data as td
from typing import Optional, Dict, Union
from transformers import BatchEncoding
from argparse import Namespace
import numpy as np
import pandas as pd
from pytorch_quik import io
Tensor_Target = Union[str, np.ndarray]
Tensor_Data = Union[pd.DataFrame, torch.Tensor, BatchEncodi... | [
"torch.LongTensor",
"torch.save",
"torch.tensor",
"torch.utils.data.TensorDataset"
] | 1.7.0 | donchesworth/pytorch-quik | e59ea3393bf017a17ab92991f14fe3bd6c5b2d0c |
1.5 | import torch
import torch.nn as nn
class HEDLN(nn.Module):
def __init__(self, input_size, hidden_size, num_layers,
dropout, bidirectional, num_classes1, num_classes2):
super(HEDLN, self).__init__()
self.num_directions = 2 if bidirectional else 1
self.num_classes1 ... | [
"torch.nn.Linear",
"torch.cat",
"torch.nn.LSTM",
"torch.nn.Sigmoid"
] | 1.5.0 | jiabijue/md_mrle | 21830842ca4e663153b9abb94ca2db604059a91f |
1.0 | import numpy as np
import torch
import matplotlib.pyplot as plt
import seaborn as sns
# two_stage_baseline_data = [torch.load(f"sparse_dr_{i}M_eval.pt") for i in range(1, 5)]
# curl_data = torch.load(f"curl_eval.pt")
# dense_dr_data = torch.load(f"dense_dr_eval.pt")
clrs = [
'#1f77b4', # muted blue
'#ff7f0e',... | [
"torch.load"
] | 1.0.1 | harry-uglow/Curriculum-Reinforcement-Learning | cb050556e1fdc7b7de8d63ad932fc712a35ac144 |
1.11 | #!/bin/python3
# The MIT License (MIT)
# Copyright © 2021 Yuma Rao
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, ... | [
"torch.zeros",
"torch.autograd.set_detect_anomaly",
"torch.arange"
] | 1.11 | opentensor/BitTensor | 59de2d0fe48f3bd02ba5bff6159e6625bd6cb945 |
1.11 | import binascii
import multiprocessing
import ctypes
import struct
import hashlib
from Crypto.Hash import keccak
import math
import bittensor
import random
import rich
import time
import torch
import numbers
import pandas
import requests
from substrateinterface.utils import ss58
from substrateinterface import Keypair, ... | [
"torch.randperm",
"torch.topk"
] | 1.11 | opentensor/BitTensor | 59de2d0fe48f3bd02ba5bff6159e6625bd6cb945 |
1.1 | ##################################################################################
# Fast-SCNN: Fast Semantic Segmentation Network
# Paper-Link: https://arxiv.org/pdf/1902.04502.pdf
##################################################################################
import torch
import torch.nn as nn
import tor... | [
"torch.cat",
"torch.nn.Dropout",
"torch.nn.Sequential",
"torch.nn.functional.interpolate",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.cuda.is_available",
"torch.nn.AdaptiveAvgPool2d",
"torch.randn"
] | 1.1.0 | Ethan-ye/Efficient-Segmentation-Networks | 27272e43126a507a6d93b21cd2372f5432f61237 |
1.1 | ##################################################################################
#ContextNetX10: Exploring Context and Detail for Semantic Segmentation in Real-time
#Paper-Link: https://arxiv.org/abs/1805.04554
##################################################################################
import torch
import to... | [
"torch.nn.Dropout",
"torch.nn.Sequential",
"torch.nn.functional.interpolate",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.cuda.is_available",
"torch.randn"
] | 1.1.0 | Ethan-ye/Efficient-Segmentation-Networks | 27272e43126a507a6d93b21cd2372f5432f61237 |
1.1 | ###################################################################################################
#ESPNetv2: A Light-weight, Power Efficient, and General Purpose Convolutional Neural Network
#Paper-Link: https://arxiv.org/pdf/1811.11431.pdf
#############################################################################... | [
"torch.cat",
"torch.nn.functional.interpolate",
"torch.cuda.is_available",
"torch.load",
"torch.nn.Dropout2d",
"torch.randn",
"torch.nn.DataParallel"
] | 1.1.0 | Ethan-ye/Efficient-Segmentation-Networks | 27272e43126a507a6d93b21cd2372f5432f61237 |
1.1 | # *- coding: utf-8 -*
###########################################################################
# https://github.com/Soulempty/BiSeNetV2-pytorch
import torch
import torch.nn as nn
from torch.nn import functional as F
from torchsummary import summary
from utils.activations import NON_LINEARITY
from fvcore.nn.flop_cou... | [
"torch.cat",
"torch.nn.MaxPool2d",
"torch.nn.Sigmoid",
"torch.nn.AvgPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.functional.interpolate",
"torch.nn.init.kaiming_normal_",
"torch.nn.init.constant_",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.cuda.is_available",
"torch.nn.init.normal_",
"torch.n... | 1.1.0 | Ethan-ye/Efficient-Segmentation-Networks | 27272e43126a507a6d93b21cd2372f5432f61237 |
1.2 | from typing import Any, Iterator, Iterable, Tuple, List, Callable
import warnings
import _collections_abc
import random
import itertools
import lineflow as lf
from torch.utils.data import IterableDataset
from torch.utils.data import get_worker_info
class Dataset(IterableDataset):
def __init__(self, dataset: Iter... | [
"torch.utils.data.get_worker_info"
] | 1.2.0 | yasufumy/torchdata | ed837afa366638fb19656bcc234903d266ac2910 |
1.6 | import os
import torch
from pathlib import Path
from args import get_parser
# set root path
ROOT_PATH = Path(os.path.dirname(__file__))
# read parser
parser = get_parser()
args = parser.parse_args()
# model name
MODEL_NAME = 'LASAGNE'
# define device
CUDA = 'cuda'
CPU = 'cpu'
DEVICE = torch.device(CUDA if torch.cud... | [
"torch.cuda.is_available"
] | 1.6.0 | endrikacupaj/LASAGNE | 6321ab5161999905b357bd9b67906dcac04b8644 |
1.6 | import argparse
import os
import numpy as np
import torch
from seqeval.metrics import accuracy_score, f1_score, precision_score, recall_score
from torch.utils.data import DataLoader
from tqdm import tqdm
from transformers import BertTokenizer, BertConfig
from model import Model
from utils.data_utils import NluDataset... | [
"torch.cuda.manual_seed_all",
"torch.no_grad",
"torch.manual_seed",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"torch.load"
] | 1.6.1 | Dog0320/BERT-NLU | c760a09faee141526dbb241040d73d0870118f6d |
1.9 | """
learn2learn examples: https://github.com/learnables/learn2learn/tree/master/examples/vision
4CNN l2l hack:
- since SL needs to have 64 output units, I unfortuantely, hardcoded mdl.cls = nn.Linear(...,64).
doing the setter does change the .classifier to point to the right thing (see the setter decorator, also, I as... | [
"torch.nn.Linear",
"torch.randn"
] | 1.9.1 | patricks-lab/ultimate-utils | e32922d79eddba8cbe9f954a96ef2205491d8a4a |
1.9 | """
Notes:
- 1. For the conv layer we have H' = H since H' = H+2p-k+1 = H' for p=1, k=3. i.e. same as previous layer
- since stride=1 as default (so only moves by 1) since you want to see all the image for a conv.
- 2. For the avg pool layer we have H' = H/2 i.e. half of previous layer
- since stride=kernel_siz... | [
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.randn"
] | 1.9.1 | patricks-lab/ultimate-utils | e32922d79eddba8cbe9f954a96ef2205491d8a4a |
1.0 | import numpy as np
import torch.nn as nn
from .inventory import model_urls
from .layer_factory import convbnrelu, InvertedResidualBlock, conv1x1
from .model_zoo import load_url
from ..misc.utils import make_list
__all__ = ["mobilenetv2"]
class MobileNetv2(nn.Module):
"""MobileNet-v2 definition.
More inform... | [
"torch.nn.ReLU6",
"torch.nn.Sequential"
] | 1.0.0 | DrSleep/DenseTorch | f90bef075429d763fc08338dea8222d28b0a4516 |
1.0 | import pytest
import torch
import kornia as kornia
from torch.autograd import gradcheck
from torch.testing import assert_allclose
import utils # test utilities
from common import device_type
class TestPinholeCamera:
def _create_intrinsics(self, batch_size, fx, fy, cx, cy):
intrinsics = torch.eye(4).exp... | [
"torch.eye",
"torch.testing.assert_allclose",
"torch.tensor",
"torch.ones"
] | 1.0.0 | jiangwei221/kornia | a211d4952355e440b944b1bda8eed4c2a7457c2d |
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.cat",
"torch.manual_seed",
"torch.randint",
"torch.cuda.is_available",
"torch.tensor",
"torch.zeros_like",
"torch.randn"
] | 1.3.1 | vatch123/metrics | 1841cad3839f5d1907a1bb8bb6a266de5c5333f9 |
1.4 | """ Classifier head and layer factory
Hacked together by / Copyright 2020 Ross Wightman
"""
from torch import nn as nn
from torch.nn import functional as F
from .adaptive_avgmax_pool import SelectAdaptivePool2d
def _create_pool(num_features, num_classes, pool_type='avg', use_conv=False):
flatten_in_pool = not u... | [
"torch.nn.Linear",
"torch.nn.Identity",
"torch.nn.Conv2d",
"torch.nn.Flatten"
] | 1.4.0 | Robert-JunWang/pytorch-image-models | 7c67d6aca992f039eece0af5f7c29a43d48c00e4 |
1.8 | from torch import nn
from torch.nn import functional as F
from model.layers import SNConv2d
class ReshapeNet(nn.Module):
"""The "initial reconstruction network" of SCSNet"""
def __init__(self, in_channels, block_size=4):
super().__init__()
self.block_size = block_size
self.conv = nn.C... | [
"torch.nn.BatchNorm2d",
"torch.nn.ConvTranspose2d",
"torch.nn.functional.interpolate",
"torch.nn.ReLU",
"torch.nn.Conv2d"
] | 1.8.1 | stephenllh/bcs-unet | be534a25e28cbe3501278d0ee6e2417b2cd737d3 |
1.8 | import os
from pathlib import Path
import time
import argparse
import warnings
import numpy as np
import cv2
import scipy.ndimage
import scipy.io
import math
import torch
import pytorch_lightning as pl
from .learner import ReconNetLearner
from utils import voltage2pixel, load_config
parser = argparse.ArgumentParser()... | [
"torch.FloatTensor"
] | 1.8.1 | stephenllh/bcs-unet | be534a25e28cbe3501278d0ee6e2417b2cd737d3 |
1.3 | import os
import argparse
import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import pickle as pkl
parser = argparse.ArgumentParser('ODE demo')
parser.add_argument('--method', type=str, choices=['dopri5', 'adams'], default='dopri5')
parser.add_argument('--data_size', type=in... | [
"torch.nn.Linear",
"torch.cuda.is_available",
"torch.vstack",
"torch.nn.init.constant_",
"torch.normal",
"torch.abs",
"torch.nn.init.normal_",
"torch.tensor",
"torch.nn.Tanh",
"torch.linspace",
"torch.mm",
"torch.no_grad"
] | 1.3.0 | nikihowe/torchdiffeq | 6d717af9d4e836294be314a9610e3baee764e31b |
1.6 | """
This script tests the approach on the BUCC 2018 shared task on finding parallel sentences:
https://comparable.limsi.fr/bucc2018/bucc2018-task.html
You can download the necessary files from there.
We have used it in our paper (https://arxiv.org/pdf/2004.09813.pdf) in Section 4.2 to evaluate different multili... | [
"torch.nn.Identity",
"torch.tensor"
] | 1.6.0 | danielperezr88/sentence-transformers | 56a7990c56c484e7948cf6400b54f27114bb267c |
1.4 | # -*- coding: utf-8 -*
import torch
import torch.nn as nn
from videoanalyst.model.backbone.backbone_base import (TRACK_BACKBONES,
VOS_BACKBONES)
from videoanalyst.model.common_opr.common_block import conv_bn_relu
from videoanalyst.model.module_base import... | [
"torch.nn.init.constant_",
"torch.no_grad",
"torch.nn.MaxPool2d"
] | 1.4.0 | ShiAngWang/video_analyst | de4f86363cc408695428b423e8d6e346aa35149b |
1.1 | import torch
from MerCBO.graphGP.kernels.diffusionkernel import DiffusionKernel
from MerCBO.graphGP.models.gp_regression import GPRegression
from MerCBO.graphGP.inference.inference import Inference
from MerCBO.graphGP.sampler.tool_partition import group_input
from MerCBO.acquisition.acquisition_functions import expec... | [
"torch.cat",
"torch.stack",
"torch.sum"
] | 1.1.0 | aryandeshwal/MerCBO | 526dfbc05bb7be3a77a30d8943233707f1636f14 |
1.10 | from ..base_module import RegressionModel, PairedModel
from .base_model import CnnModel
import torch.nn as nn
class RegressionCnnModel(RegressionModel):
def __init__(self, cfg, train_df = None, val_df = None, test_df = None):
super().__init__(cfg, CnnModel(cfg), train_df, val_df, test_df)
def forward(self, i... | [
"torch.nn.MarginRankingLoss"
] | 1.10.0 | alexvishnevskiy/jigsaw | 7fc2c4cd3700a54e9c5cbc02870bf4057b0a9fe3 |
1.4 | # Copyright (c) 2021, Soohwan Kim. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | [
"torch.device",
"torch.cuda.is_available",
"torch.LongTensor",
"torch.rand"
] | 1.4.0 | daiyaanarfeen/kospeech | 5aff5c7647e5cceceddf7b22c991777fc3792400 |
1.10 | import random
from pathlib import Path
import cv2
import numpy as np
import torch
from vp_suite.base.base_dataset import VPDataset, VPData
import vp_suite.constants as constants
from vp_suite.utils.utils import set_from_kwarg
class KITTIRawDataset(VPDataset):
r"""
Dataset class for the "raw data" regime of ... | [
"torch.zeros"
] | 1.10.1 | angelvillar96/vp-suite | 3e7c7d852862bad09a771d754fc56a71abf0a25f |
1.7 | import copy
import logging
import math
import numpy as np
import PIL
import scipy
import torch
from .preprocess import Preprocess
from .. import utils
LOG = logging.getLogger(__name__)
class RotateBy90(Preprocess):
def __init__(self, angle_perturbation=0.0, fixed_angle=None):
super().__init__()
... | [
"torch.rand"
] | 1.7.1 | adujardin/openpifpaf | 4fa79162f5529f5b0de72e2312aab54d410bee3f |
1.6 | import os, time
import numpy as np
import torch
import torch.nn.functional as F
from sklearn.metrics import roc_auc_score, auc, precision_recall_curve
from skimage.measure import label, regionprops
from tqdm import tqdm
from visualize import *
from model import load_decoder_arch, load_encoder_arch, positionalencoding2d... | [
"torch.randperm",
"torch.exp",
"torch.tensor",
"torch.utils.data.DataLoader",
"torch.max",
"torch.cuda.synchronize",
"torch.nn.Sigmoid",
"torch.arange",
"torch.no_grad",
"torch.optim.Adam",
"torch.nn.functional.interpolate",
"torch.nn.LogSigmoid"
] | 1.6.0 | Msmhasani/cflow-ad | bc8bcf796723ba885587a72a6fbbf45ecb4b7bf4 |
1.0 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
# model file: example-models/ARM/Ch.21/radon_vary_intercept_nofloor_chr.stan
import torch
import pyro
import pyro.distributions as dist
def init_vector(name, dims=None):
return pyro.sample(name, dist.Normal(torch.zeros(dims), 0.2 ... | [
"torch.zeros",
"torch.ones"
] | 1.0.1 | jpchen/pyro-models | b9e6ae6271e6cd622fbb4d34d67c450d5a954c9b |
1.0 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
# model file: example-models/ARM/Ch.13/y_x.stan
import torch
import pyro
import pyro.distributions as dist
def init_vector(name, dims=None):
return pyro.sample(name, dist.Normal(torch.zeros(dims), 0.2 * torch.ones(dims)).to_event(... | [
"torch.zeros",
"torch.ones"
] | 1.0.1 | jpchen/pyro-models | b9e6ae6271e6cd622fbb4d34d67c450d5a954c9b |
1.0 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
# model file: example-models/ARM/Ch.12/radon_no_pool.stan
import torch
import pyro
import pyro.distributions as dist
def init_vector(name, dims=None):
return pyro.sample(name, dist.Normal(torch.zeros(dims), 0.2 * torch.ones(dims))... | [
"torch.zeros",
"torch.ones"
] | 1.0.1 | jpchen/pyro-models | b9e6ae6271e6cd622fbb4d34d67c450d5a954c9b |
1.0 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
# model file: example-models/ARM/Ch.10/ideo_reparam.stan
import torch
import pyro
import pyro.distributions as dist
def init_vector(name, dims=None):
return pyro.sample(name, dist.Normal(torch.zeros(dims), 0.2 * torch.ones(dims)).... | [
"torch.zeros",
"torch.ones"
] | 1.0.1 | jpchen/pyro-models | b9e6ae6271e6cd622fbb4d34d67c450d5a954c9b |
1.5 | """
test:
- running some numbers through two versions of sru, checking they come out the sam
- save sru in older version, and loading in new version
"""
import torch
import sru
import pytest
import sys
EPSILON = 1e-6
ARTIFACT_DIR = 'test/regression/artifacts'
@pytest.mark.parametrize(
"sru_prev_version",
... | [
"torch.manual_seed",
"torch.no_grad",
"torch.load"
] | 1.5.1 | visionscaper/sru | 6e0038ec675be0a37d870865f7f8fa22f1ad2254 |
1.9 | import torch
from PIL import Image
import io
def get_yolov5():
# local best.pt
model = torch.hub.load('./yolov5', 'custom', path='./model/best.pt', source='local') # local repo
model.conf = 0.5
return model
def get_image_from_bytes(binary_image, max_size=1024):
input_image = Image.open(io.Bytes... | [
"torch.hub.load"
] | 1.9.1 | DanielChuDC/yolov5-fastapi | 27eef7d52cf72cda0c14856a745a8798d51d9383 |
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.Size",
"torch.rand",
"torch.cuda.device_count"
] | 1.7.1 | ar90n/lightning-flash | 61e1a2d3b72f8fbbffe6ace14fb5b5bb35c5f131 |
1.0 | import torch
from torch import nn
from visdialch.utils import DynamicRNN
class DiscriminativeDecoder(nn.Module):
def __init__(self, config, vocabulary):
super().__init__()
self.config = config
self.word_embed = nn.Embedding(
len(vocabulary),
config["word_embedding... | [
"torch.nn.LSTM",
"torch.sum"
] | 1.0.0 | shubhamagarwal92/visdial-challenge-starter-pytorch | 474ceb338b5f5dbed8236fc59212a4debcb40576 |
1.6 | """
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
"""
import copy
import gzip
import json
import lzma
import os
import re
import shutil
import sys
import tarfile
import tempfile
import time
im... | [
"torch.cuda.get_rng_state_all",
"torch.cuda.manual_seed_all",
"torch.cuda.set_rng_state_all",
"torch.random.get_rng_state",
"torch.random.manual_seed",
"torch.cuda.is_available",
"torch.random.set_rng_state"
] | 1.6.0 | source-data/datasets | 987df6b4e9e20fc0c92bc9df48137d170756fd7b |
1.3 | import mmcv
import numpy as np
import torch
from os import path as osp
from torch.nn import functional as F
from basicsr.data.transforms import mod_crop, totensor
def read_img_seq(path, require_mod_crop=False, scale=1):
"""Read a sequence of images from a given folder path.
Args:
path (list[str] | s... | [
"torch.stack",
"torch.from_numpy",
"torch.nn.functional.pad",
"torch.nn.functional.conv2d"
] | 1.3 | yicrane/BasicSR | 5924d3bc20334381798099b7e841a26b6be90a4b |
1.6 | import os
import logging
import argparse
import numpy as np
from tqdm import tqdm
import torch
from torch.serialization import default_restore_location
from seq2seq import models, utils
from seq2seq.data.dictionary import Dictionary
from seq2seq.data.dataset import Seq2SeqDataset, BatchSampler
from seq2seq.beam impor... | [
"torch.cat",
"torch.stack",
"torch.no_grad",
"torch.softmax",
"torch.ones",
"torch.manual_seed",
"torch.where",
"torch.serialization.default_restore_location"
] | 1.6.0 | aditen/atmt | 7bd17fecc095e019c9e79ec02788e1e979d7a8e8 |
1.1 | import math
import torch
from torch.optim.optimizer import Optimizer
from .types import OptFloat, OptLossClosure, Params
__all__ = ('SGDP',)
class SGDP(Optimizer):
r"""Implements SGDP algorithm.
It has been proposed in `Slowing Down the Weight Norm Increase in
Momentum-based Optimizers`__
Argumen... | [
"torch.zeros_like"
] | 1.1.0 | muupan/pytorch-optimizer | efeea8fe4d06c5f4612f1f5bc34acf0c7d7682e1 |
1.2 | import glob
import random
import time
import os
import os.path as osp
import cv2
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn.functional as F
from torchvision.ops import nms
def mkdir_if_missing(dir):
os.makedirs(dir, exist_ok=True)
def float3(x): # format ... | [
"torch.cat",
"torch.cuda.manual_seed",
"torch.stack",
"torch.LongTensor",
"torch.load",
"torch.exp",
"torch.sum",
"torch.nn.init.constant_",
"torch.ByteTensor",
"torch.manual_seed",
"torch.nn.init.normal_",
"torch.zeros_like",
"torch.zeros",
"torch.cuda.manual_seed_all",
"torch.min",
"... | 1.2.0 | tjulitianyi1997/Towards-Realtime-MOT-1 | cda44e18022fd90411cb7f8911cb7ed9fd9b140d |
1.3 | import numbers
import warnings
from typing import Any, Callable, List, Optional, Union
import torch
import torch.nn as nn
from torch.optim import Optimizer
from ignite.contrib.handlers.base_logger import (
BaseLogger,
BaseOptimizerParamsHandler,
BaseOutputHandler,
BaseWeightsHistHandler,
BaseWeigh... | [
"torch.utils.tensorboard.SummaryWriter"
] | 1.3 | ibotdotout/ignite | d2da93d2ff0aab139218e578dee1d0dc8c6481db |
1.9 | from typing import Any
from typing import Callable
import torch
from torch import Tensor
from torch.testing import assert_close
def assert_monotone(
fn: Callable[[Tensor], Tensor],
x1: Tensor,
x2: Tensor,
increasing: bool = False,
allow_equal: bool = False,
) -> None:
"""Assert ``fn`` is mono... | [
"torch.full_like"
] | 1.9.0 | YieldLabs/pfhedge | a5ba9d054a8418cb8b27bb67d81a8fc8fb83ef57 |
1.8 | import sys
import time
from typing import Any, Dict, List, Optional, Tuple, Type, Union
import gym
import numpy as np
import torch as th
from torch.nn import functional as F
from stable_baselines3.active_tamer.policies import SACPolicy
from stable_baselines3.common.buffers import ReplayBuffer
from stable_baselines3.c... | [
"torch.cat",
"torch.min",
"torch.no_grad",
"torch.ones",
"torch.nn.functional.mse_loss",
"torch.from_numpy"
] | 1.8.1 | corgiTrax/stable-baselines3 | 95dc5e30ab6a21225da4b718953e83870e4f146b |
1.1 | import torch
class FGM(object):
"""
refer to the paper: FGM(Fast Gradient Method)
Adversarial training methods for semi-supervised text classification
"""
def __init__(self, model):
self.model = model
self.backup = {}
def attack(self, epsilon=1e-6, emd_name="embe... | [
"torch.norm",
"torch.isnan"
] | 1.1 | zhengmidon/jingju_baseline | 4c6ef80ac14b4640efb1f81cde38df2ac35eacd2 |
1.1 | import re
import librosa
import numpy as np
import torch
from scipy.interpolate import interp1d
from sklearn.preprocessing import normalize
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
skeleton_line_pairs = [(0, 1, 'b'), (1, 2, 'darkred'), (2, 3, 'r'), (3, 4, 'orange'), (1, 5, 'darkgreen'... | [
"torch.cuda.is_available"
] | 1.1.0 | er1ca/Gesture-Generation-from-Trimodal-Context | 6d988a7211a4d8294e1ef4b45c45ee25d12455d2 |
1.1 | import logging
import torch
import torch.nn.functional as F
loss_i = 0
def custom_loss(output, target, args, epoch):
n_element = output.numel()
# mae
mse_loss = F.mse_loss(output, target)
mse_loss *= args.loss_regression_weight
# continuous motion
diff = [abs(output[:, n, :] - output[:, n-1, ... | [
"torch.nn.functional.mse_loss",
"torch.norm",
"torch.stack",
"torch.sum"
] | 1.1.0 | er1ca/Gesture-Generation-from-Trimodal-Context | 6d988a7211a4d8294e1ef4b45c45ee25d12455d2 |
1.3 | import inspect
import logging
import warnings
from typing import Callable, Dict, List, Optional, Sequence, Union
import numpy as np
import pandas as pd
import torch
from scvi._compat import Literal
logger = logging.getLogger(__name__)
Number = Union[int, float]
class DifferentialComputation:
"""
Unified c... | [
"torch.no_grad"
] | 1.3 | gitter-badger/scvi-tools | 8948405f6b393baede73ccd6a0a5ac0824e16c0d |
1.1 | import torch
import copy
from utils.misc import deprecated
def unprocessed_collate(batch):
"""
A dummy function to prevent Pytorch's data loader from converting and stacking batch data.
:param batch:
:return:
"""
return batch # List of data tuples (sequence, timeline, label)
@deprecated
d... | [
"torch.zeros",
"torch.LongTensor",
"torch.clamp",
"torch.pow"
] | 1.1.0 | howieraem/KinectActionDetection | ff64030e9fa2eb3d512b5cc1dae79e6a07ab8e5c |
1.10 | ####################################################################################################################################################
####################################################################################################################################################
"""
Dataloader definit... | [
"torch.initial_seed",
"torch.Generator",
"torch.utils.data.DataLoader"
] | 1.10 | SteveCruz/icpr2022-autoencoder-attractors | 0935179b514fd49e1d2410005d91ff49db9978ac |
1.0 | import os
import sys
import torch
import mydatasets
import torch.autograd as autograd
import argparse
import torchtext.data as data
torch.manual_seed(3)
parser = argparse.ArgumentParser(description='Predictor api')
parser.add_argument('--snapshot', type=str, default='saved-models/best-cnn.pt', help='filename of model ... | [
"torch.max",
"torch.autograd.Variable",
"torch.manual_seed",
"torch.tensor",
"torch.load"
] | 1.0.0 | rangwani-harsh/char-cnn-char-rnn-sentiment-analysis | 48238232ba053f8c12e66383fd65fc075c532dad |
1.7 | import argparse
import torch
import torch.nn as nn
import torch.utils.data as data
import torchvision
from tqdm import tqdm
import utils
from model import DummyModel
def main():
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
# Type of experiment
parser.add_argument('--test_type', type=str... | [
"torch.max",
"torch.nn.CrossEntropyLoss",
"torch.load",
"torch.utils.data.DataLoader"
] | 1.7.0 | agemor/pytorch-project-template | 9b43db0578d6ea0aa40d2fec577cb50e86e57c7d |
1.7 | from pathlib import Path
from copy import deepcopy
from argparse import ArgumentParser
import torch
from torch.nn import BCEWithLogitsLoss
from torchvision.models import resnet
import pytorch_lightning as pl
from pytorch_lightning import LightningModule, Trainer
from pytorch_lightning.loggers import TensorBoardLogger
... | [
"torch.zeros",
"torch.sigmoid",
"torch.optim.Adam",
"torch.optim.lr_scheduler.ExponentialLR",
"torch.nn.BCEWithLogitsLoss"
] | 1.7.1 | SaeidAbdolian/seasonal-contrast | 5395c027922569f5c5b1785ad1ccddd839749c36 |
0.27 | # Copyright 2021 MosaicML. All Rights Reserved.
import functools
import numpy as np
import pytest
import torch
from PIL import Image
from torch.utils.data import DataLoader
from composer.algorithms import ColOut, ColOutHparams
from composer.algorithms.colout.colout import ColOutTransform, colout_batch
from composer.... | [
"torch.rand",
"torch.manual_seed",
"torch.utils.data.DataLoader",
"torch.allclose",
"torch.Tensor"
] | 0.27 | vahidfazelrezai/composer | a18a1bc3d965b0877f782e1d43a39a4ce6721c24 |
0.4 | import torch
import torch.nn as nn
import torch.nn.functional as F
from src.base.base_net import BaseNet
class CIFAR10_LeNet(BaseNet):
def __init__(self):
super().__init__()
# 这里的这个fc的输出维度和mnist的不同
self.rep_dim = 128
self.pool = nn.MaxPool2d(2, 2)
self.conv1 = nn.Conv2d... | [
"torch.nn.Linear",
"torch.sigmoid",
"torch.nn.MaxPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.ConvTranspose2d",
"torch.nn.Conv2d",
"torch.nn.BatchNorm1d",
"torch.nn.init.calculate_gain",
"torch.nn.functional.leaky_relu"
] | 0.4.1 | Flsahkong/Deep-SVDD-PyTorch | c20442fb394f679222ae49d299bcb3c95e2d67c8 |
1.4 | import os, sys
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" # see issue #152
os.environ["CUDA_VISIBLE_DEVICES"]="0"
from opt import get_opts
import torch
import torchvision.transforms as transforms
from collections import defaultdict
from torch.utils.data import DataLoader
from datasets import dataset_dict
# model... | [
"torch.cat",
"torch.stack",
"torch.utils.data.DataLoader",
"torch.no_grad"
] | 1.4.0 | Jake-Jay/StyleNeRF_pl | c9cc35bc0453a72f51b63512b3517e5f79da12a6 |
1.6 | from torch.nn import *
import torch
import torch.nn.functional as F
class BCEDiceLoss(Module):
def __init__(self):
super().__init__()
def forward(self, input, target):
bce = F.binary_cross_entropy_with_logits(input, target)
smooth = 1e-10
input = torch.sigmoid(input)
nu... | [
"torch.nn.functional.binary_cross_entropy_with_logits",
"torch.sigmoid"
] | 1.6.0 | Ian-Dx/DxTorchUtils | af1d522f58f1b7baed8f661757dd45c13343ddcd |
1.8 | from __future__ import annotations
from typing import Any, Iterable, Optional, Tuple, Union
import torch, warnings
from .protocols import _DeviceMovable
CPU = torch.device('cpu')
GPU = torch.device('cuda')
def data_parallel(raw_model: torch.nn.Module, *args, **kwargs) -> Tuple[Union[torch.nn.Module, torch.nn.parall... | [
"torch.device",
"torch.nn.parallel.DataParallel",
"torch.cuda.is_available",
"torch.cuda.empty_cache"
] | 1.8.2 | kisonho/torchmanager | ac01c61a132238bc0d39bf2173dfd37f44dbbf30 |
1.1 | import os
from argparse import Namespace
import numpy as np
import torch
# from pl_examples import LightningTemplateModel
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.loggers import TestTubeLogger, TensorBoardLogger
from tests.base import Lightni... | [
"torch.manual_seed",
"torch.tensor",
"torch.mean",
"torch.argmax",
"torch.sum"
] | 1.1 | baldassarreFe/pytorch-lightning | 3f1e4b953f84ecdac7dada0c6b57d908efc9c3d3 |
1.0 | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team and Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | [
"torch.cuda.manual_seed_all",
"torch.distributed.init_process_group",
"torch.manual_seed",
"torch.cuda.set_device",
"torch.cuda.is_available"
] | 1.0 | sripadh8/transformers | 9f6a0fa573b25c90191d58443661db7d187de511 |
1.2 | #!/usr/bin/env python
""" ImageNet Validation Script
This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained
models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes
canonical PyTorch, standard Python style, and good performa... | [
"torch.nn.CrossEntropyLoss",
"torch.jit.script",
"torch.no_grad",
"torch.jit.optimized_execution"
] | 1.2.0 | FDSJK/pytorch-image-models | 5eb0e363a63e823f27810ea6bf5b6b8e136c4176 |
1.5 | import os
import gym
import numpy as np
import torch
from gym.spaces.box import Box
from gym.spaces.dict import Dict
from baselines import bench
from baselines.common.atari_wrappers import make_atari, wrap_deepmind
from baselines.common.vec_env import VecEnvWrapper
from baselines.common.vec_env.dummy_vec_env import D... | [
"torch.zeros",
"torch.device",
"torch.from_numpy"
] | 1.5.0 | sriyash421/CrowdNav_DSRNN | 968f54f1f37ae65ee0a13a5a8e96eda1af1916ab |
1.3 | """File for accessing YOLOv5 via PyTorch Hub https://pytorch.org/hub/
Usage:
import torch
model = torch.hub.load('ultralytics/yolov5_', 'yolov5s', pretrained=True, channels=3, classes=80)
"""
dependencies = ['torch', 'yaml']
import torch
from models.yolo import Model
from utils import google_utils
def crea... | [
"torch.load"
] | 1.3.0 | paszti96/RODSIE_yolov5 | 2419802dbd897028f02ad45232342316d4a73233 |
1.8 | """ Test a finetuned model. """
import torch
import torch.nn.functional as F
import numpy as np
import pandas as pd
import wandb
from transformers import MBart50TokenizerFast, MBartForConditionalGeneration, MBartConfig
from datasets import load_dataset
from itertools import combinations
import time
from common.prepro... | [
"torch.cuda.is_available",
"torch.utils.data.DataLoader"
] | 1.8.1 | IanYHWu/tied-representation-learning | bda9814dc40cf552f7bdd2ade78f5e2958a7ea83 |
1.3 | import torch
def euclidean_metric(a, b):
return torch.cdist(a, b, p=2) | [
"torch.cdist"
] | 1.3.0 | aiyolo/prototypical-network-pytorch-lightning | e6fb9397f98314cd8f4b42282ca3f28e46c51d4a |
1.8 | import torch
import torch.nn as nn
class NeuralNet(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNet, self).__init__()
self.l1 = nn.Linear(input_size, hidden_size)
self.l2 = nn.Linear(hidden_size, hidden_size)
self.l3 = nn.Linear(hidden_size, nu... | [
"torch.nn.Linear",
"torch.nn.ReLU"
] | 1.8.1 | thomasbreydo/mental-health-nlp-chatbot | 62cb6f558f8e3282f24f4699770e838a272cc346 |
1.5 | import torch.utils.data as torchdata
from modules.data.utils import collate_fn
from modules.data.dataset import ICDAR
class ICDARDataLoader:
def __init__(self, config):
self.config = config
self.batch_size = config['data_loader']['batch_size']
self.shuffle = config['data_loader']['shuffle... | [
"torch.utils.data.random_split",
"torch.utils.data.DataLoader"
] | 1.5.0 | ishin-pie/e2e-scene-text-spotting | a3f5ba1f486c5d52bb6263aff6663a03ab4effbf |
0.2 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar, Union
import numpy as np
import torch
T = TypeVa... | [
"torch.device"
] | 0.2.2 | EricZLou/Ax | 3f8fc6f4a055e93cb69fda3799be41ee9572ef02 |
1.4 | import numpy as np
import torch
from dg_util.python_utils import misc_util
from dg_util.python_utils import pytorch_util as pt_util
from dg_util.python_utils.tensor_dataset import TensorDataset
class NPZDataset(TensorDataset):
"""
Convenience class for fast reading of saved numpy image arrays without the nee... | [
"torch.no_grad"
] | 1.4.0 | gabrielsluz/vince | f4e17a2cf70c080a7e01e46d15537e33224c869b |
1.1 | from typing import List, Dict, Tuple
import pickle
import torch
import numpy as np
from ditk import logging
from copy import deepcopy
from easydict import EasyDict
from torch.utils.data import Dataset
from ding.utils import DATASET_REGISTRY, import_module
from ding.rl_utils import discount_cumsum
@DATASET_REGISTRY.... | [
"torch.zeros",
"torch.arange",
"torch.from_numpy",
"torch.ones",
"torch.tensor"
] | 1.1.0 | kxzxvbk/DI-engine | 268d77db3cb54401b2cfc83e2bc3ec87c31e7b83 |
1.1 | """The code is adapted from https://github.com/nikhilbarhate99/min-decision-transformer
"""
from typing import List, Dict, Any, Tuple, Union
from collections import namedtuple
from torch.distributions import Normal, Independent
from ding.torch_utils import Adam, to_device
from ditk import logging
from ding.rl_utils im... | [
"torch.zeros",
"torch.device",
"torch.arange",
"torch.no_grad",
"torch.from_numpy",
"torch.nn.functional.mse_loss",
"torch.ones",
"torch.nn.functional.cross_entropy",
"torch.clone",
"torch.argmax"
] | 1.1.0 | kxzxvbk/DI-engine | 268d77db3cb54401b2cfc83e2bc3ec87c31e7b83 |
0.4 | # CometML needs to be imported first.
try:
import comet_ml
except ImportError:
pass
from model import SampleRNN, Predictor
from model import CNNSeq2SampleRNN
from optim import gradient_clipping
from nn import sequence_nll_loss_bits
from trainer import Trainer
from trainer.plugins import (
TrainingLossMonit... | [
"torch.cuda.device_count",
"torch.utils.trainer.plugins.Logger",
"torch.load"
] | 0.4.1 | gcunhase/Scene2Wav | 99a3ad6c9f2cea1d58590a0bb834203bc525ced8 |
1.6 | import os
# os.environ["CUDA_VISIBLE_DEVICES"] = '1'
import torch
torch.multiprocessing.set_sharing_strategy('file_system')
import random
import numpy as np
from tqdm import tqdm
from torch_geometric.data import DataLoader, DataListLoader
from torch_geometric.nn.data_parallel import DataParallel
import scipy... | [
"torch.cat",
"torch.nn.ModuleList",
"torch.no_grad",
"torch.cuda.empty_cache",
"torch.cuda.is_available",
"torch.load",
"torch.multiprocessing.set_sharing_strategy"
] | 1.6.0 | kaai520/GATI-Rec | 1cc2efbbeeef2705add0256dfec2262da1df7119 |
1.10 | from typing import Dict, Any
import random
import numpy as np
import torch
class Callback:
def __init__(self, update_frequency_type: str = 'batch', update_frequency: int = 100):
self.update_frequency_type = update_frequency_type
self.update_frequency = update_frequency
self._num_batches =... | [
"torch.set_rng_state",
"torch.get_rng_state"
] | 1.10.1 | paulosoaresua/mlbase | 8b60b80fd1745d6565fd38e9bc9d2e203033ae27 |
1.10 | import torch
import torch.nn as nn
from mlbase.model.base_model import BaseModel
from typing import List
from mlbase.callback.callback import Callback
from mlbase.callback.validation_check import ValidationCheck
from torch.utils.data import Dataset, DataLoader
import random
import numpy as np
class ModelRunner:
d... | [
"torch.set_rng_state",
"torch.load",
"torch.utils.data.DataLoader"
] | 1.10.1 | paulosoaresua/mlbase | 8b60b80fd1745d6565fd38e9bc9d2e203033ae27 |
1.1 | import argparse
import experiment_buddy
import torch
import torch.nn as nn
from altmin import get_mods, get_codes, update_codes, update_last_layer_, update_hidden_weights_adam_
from altmin import scheduler_step
from models import LeNet
from models import test
from utils import get_devices, load_dataset
# Training se... | [
"torch.no_grad",
"torch.cuda.is_available",
"torch.nn.CrossEntropyLoss"
] | 1.1.0 | manuel-delverme/online-alt-min | 83f2c7d8bf9d6c8de8a8812e4fee73f9b58e05ad |
1.0 | # coding=utf-8
# Copyright 2020-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | [
"torch.cat",
"torch.cuda.amp.autocast",
"torch.Generator",
"torch.cuda.random.set_rng_state",
"torch.random.get_rng_state",
"torch.cuda.random.set_rng_state_all",
"torch.cuda.is_available",
"torch.load",
"torch.cuda.random.get_rng_state_all",
"torch.nn.DataParallel",
"torch.utils.data.sampler.Ra... | 1.0 | rejinjoy18/transformers | 71346c4a9099d84685c91fab626d0b8b1704ef08 |
1.8 | import torch
from colossalai.gemini.tensor import stateful_op_impl
from ..stateful_tensor import StatefulTensorV2
from packaging import version
@stateful_op_impl(torch.nn.functional.linear)
def stateful_linear(types, args, kwargs, pg):
"""Handles ``__torch_function__`` dispatch for ``torch.nn.functional.linear``.... | [
"torch.nn.functional.linear"
] | 1.8 | weiplanet/ColossalAI | ab962b9735ea323eb84c5bc4bce534bf2376960e |
1.5 | import torch
import torch.nn as nn
from torch.autograd import Variable
from abc import ABCMeta, abstractmethod
class AbstractPrimitive(nn.Module, metaclass=ABCMeta):
"""
Use this class when creating new operations for edges.
This is required because we are agnostic to operations
at the edges. As a co... | [
"torch.cat",
"torch.nn.MaxPool2d",
"torch.nn.Sequential",
"torch.nn.AvgPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d"
] | 1.5.0 | deepdad/NASLib-1 | 6c93788f145187fe8cda446531f5b9f98e4ab48b |
1.5 | from typing import List, Optional
import torch
from torch import nn
import numpy as np
import logging
from src.utils.pytorch_linear_reg_utils import fit_linear, linear_reg_pred, outer_prod, add_const_col
from src.data.data_class import TrainDataSet, TestDataSet, TrainDataSetTorch, TestDataSetTorch
logger = logging.ge... | [
"torch.norm",
"torch.no_grad",
"torch.tensor"
] | 1.5.0 | liyuan9988/DeepFeatureIV | 54b04e9e9e4c88d4859ea65d34ceb69dd1b58bc2 |
0.4 | """
Loss functions for recommender models.
The pointwise, BPR, and hinge losses are a good fit for
implicit feedback models trained through negative sampling.
The regression and Poisson losses are used for explicit feedback
models.
"""
import torch
import torch.nn.functional as F
from spotlight.torch_utils import ... | [
"torch.nn.functional.binary_cross_entropy_with_logits",
"torch.nn.functional.sigmoid",
"torch.max",
"torch.clamp",
"torch.log"
] | 0.4.0 | paprocki-r/spotlight | a7dd31bf5e225b9e8ec8dc6ffcd0f2093d43336c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.