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.2
import torch from terminaltables import AsciiTable from copy import deepcopy import numpy as np import torch.nn.functional as F def get_sr_flag(epoch, sr): # return epoch >= 5 and sr return sr def parse_module_defs(module_defs): CBL_idx = [] Conv_idx = [] ignore_idx = set() ...
[ "torch.cat", "torch.nn.functional.softplus", "torch.sign", "torch.from_numpy", "torch.sum", "torch.tensor", "torch.sort", "torch.nn.functional.leaky_relu" ]
1.2
qianyuqian-DeepLearning/YoloV3-prune-layer
5b4a4d6346d980b36235eae5335003f2c43a28cf
0.4
# -*- coding: utf-8 -*- """ Module to handle getting data loading classes and helper functions. """ import json import io import torch import numpy as np from scipy.sparse import * from collections import Counter, defaultdict from torch.utils.data import Dataset from .bert_utils import * from .eval_utils import norm...
[ "torch.zeros", "torch.cuda.empty_cache", "torch.LongTensor", "torch.Tensor", "torch.set_grad_enabled" ]
0.4.1
joe3d1998/GraphFlow
8a751e4fc69a1e0c06ded23b7d1096f3161931a1
1.6
import unittest import torch import torch.nn as nn from pytorch_ner.nn_modules.rnn import DynamicRNN embeddings = torch.randn(10, 20, 128) # [batch_size, seq_len, emb_dim] lengths = torch.arange(start=20, end=10, step=-1) rnn = DynamicRNN( rnn_unit=nn.RNN, input_size=128, hidden_size=256, num_laye...
[ "torch.Size", "torch.randn", "torch.arange" ]
1.6.0
abdallah1097/pytorch_ner
b1729d97ccb168e5796045cf9b387b35536803eb
1.6
from warnings import filterwarnings import numpy as np import onnx import onnxruntime import torch import torch.nn as nn from pytorch_ner.utils import to_numpy filterwarnings(action="ignore", category=UserWarning) def _onnx_export( model: nn.Module, path_to_save: str, ): """ Export PyTorch model to...
[ "torch.no_grad", "torch.tensor", "torch.onnx.export" ]
1.6.0
abdallah1097/pytorch_ner
b1729d97ccb168e5796045cf9b387b35536803eb
1.10
from onnxruntime.quantization.quantize import quantize from transformers import Wav2Vec2ForCTC import torch import argparse def convert_to_onnx(model_id_or_path, onnx_model_name): print(f"Converting {model_id_or_path} to onnx") model = Wav2Vec2ForCTC.from_pretrained(model_id_or_path) audio_len = 250000 ...
[ "torch.randn", "torch.onnx.export" ]
1.10.1
Sewanex/wav2vec2-service
fe9c5fa61bfe85f3e36c78cf71a3bcbe3959ac13
1.9
from src.model_blocks import * import torch.nn as nn import timm from src.activations import Swish_Module from src.config import YAMLConfig import typing import gc from src.utils import * """ Test two pytorch models are the same """ """ This is a testing for RANZCR. Note that the model weights will never match unles...
[ "torch.nn.Linear", "torch.rand", "torch.cat", "torch.nn.Dropout", "torch.hub.load_state_dict_from_url", "torch.torch.nn.Linear", "torch.load", "torch.nn.AdaptiveAvgPool2d", "torch.torch.nn.Dropout", "torch.nn.Flatten" ]
1.9.0
reigHns/RANZCR-CLiP---Catheter-and-Line-Position-Challenge
80d4177bf74f9ffa5f7906687ebe648832ec84e1
1.0
import os import torch import torch.nn.functional as F from torch.optim import Adam, lr_scheduler from sac_src.utils import soft_update, hard_update from sac_src.model import GaussianPolicy, QNetwork, DeterministicPolicy class SAC(object): def __init__(self, num_inputs, action_space, args): self.gamma = ...
[ "torch.zeros", "torch.device", "torch.optim.lr_scheduler.StepLR", "torch.min", "torch.no_grad", "torch.optim.Adam", "torch.FloatTensor", "torch.nn.functional.mse_loss", "torch.tensor", "torch.load", "torch.Tensor" ]
1.0.0
ZhiningLiu1998/mesa
fd024e4754570374b1f0935e00ca1eab6b23f584
1.7
# -*- coding: utf-8 -*- # @Time : 2021/1/14 # @Author : Chengyuan Li # @Email : 2017202049@ruc.edu.cn r""" NNCF ################################################ Reference: Ting Bai et al. "A Neural Collaborative Filtering Model with Interaction-based Neighborhood." in CIKM 2017. Reference code: ...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.mul", "torch.cat", "torch.nn.Conv1d", "torch.nn.Sigmoid", "torch.nn.ReLU", "torch.nn.init.normal_", "torch.tensor", "torch.nn.BCELoss", "torch.nn.MaxPool1d", "torch.nn.Embedding" ]
1.7.0
ShanleiMu/RecBole-1
9ec15faf90126dfb512901d0f2303ef3c2efb71d
1.4
# part of the code are from https://github.com/hill-a/stable-baselines/ import random from collections import namedtuple import numpy as np import torch from generic import to_np from segment_tree import SumSegmentTree, MinSegmentTree Transition = namedtuple('Transition', ('observation_list', ...
[ "torch.stack" ]
1.4.0
YunqiuXu/H-KGA
694a36baf9e51ffb97be269d8182a2b906eb0da5
1.1
import argparse import os import torch class BaseHyperparameters: def __init__(self): self.parser = argparse.ArgumentParser() self.opt = None def initalize(self): # set directory for inputs and outputs self.parser.add_argument('--data_dir', type=str, default='./', help='datase...
[ "torch.cuda.is_available" ]
1.1
YcShentu/CoralSegmentation
6ae30c61f7efa1caef9d191d29a7668296f75f8d
1.5
import torch from torch import nn from torch.nn import BCEWithLogitsLoss from transformers import DistilBertModel from Utils.Eval.Metrics import ComputeMetrics as CoMe class FFNNMulti(nn.Module): def __init__(self, input_size, hidden_size_1, hidden_size_2, hidden_dropout_prob_1, hidden_dropout_prob_2): s...
[ "torch.nn.Linear", "torch.sigmoid", "torch.nn.Dropout", "torch.nn.ReLU", "torch.nn.BCEWithLogitsLoss" ]
1.5.0
MaurizioFD/recsys-challenge-2020-twitter
567f0db40be7db3d21c360f2ca6cdf2addc7c698
1.6
import json import logging import os import shutil from collections import OrderedDict from typing import List, Dict, Tuple, Iterable, Type, Union, Callable from zipfile import ZipFile import requests import numpy as np from numpy import ndarray import transformers import torch from torch import nn, Tensor, device from...
[ "torch.device", "torch.nn.functional.normalize", "torch.stack", "torch.cuda.amp.autocast", "torch.is_tensor", "torch.no_grad", "torch.hub._get_torch_home", "torch.cuda.device_count", "torch.multiprocessing.get_context", "torch.cuda.is_available", "torch.tensor", "torch.cuda.amp.GradScaler" ]
1.6.0
adbelniak/sentence-transformers
a36e6f126cf0e333e1b00eb7cfcef2863f8919ad
1.9
import random from typing import Any, Callable, Optional import torch from torchmetrics import Metric class CentroidAggregator(Metric): """ The centroid aggregator aggregates kmeans centroids over batches and processes. """ def __init__( self, num_clusters: int, num_features: ...
[ "torch.zeros", "torch.rand", "torch.cat", "torch.arange", "torch.finfo", "torch.empty" ]
1.9.0
borchero/leviathan
7430fa4a515fe5ea7afbaad108226b4cd9111d8c
1.3
import torch import torch.nn as nn from torch.nn.utils import weight_norm # Code from https://github.com/locuslab/TCN class Chomp1d(nn.Module): def __init__(self, chomp_size): super(Chomp1d, self).__init__() self.chomp_size = chomp_size def forward(self, x): return x[:, :, :-self.chom...
[ "torch.nn.ReLU", "torch.nn.Dropout", "torch.nn.Sequential", "torch.nn.Conv1d" ]
1.3.1
abelrguezr/Deep-SAD-PyTorch
268ca21570a4a8dadc331a9dbf26ccade36ae5d9
1.0
"""Contains classes describing linguistic tasks of interest on annotated data.""" from collections import Counter, OrderedDict import numpy as np import sys import torch import math import itertools PTB_TRAIN_EMPIRICAL_POS_DISTRIBUTION = [0.00003789361998, 0.00006105083219, 0.0001021022538, 0.0001494692788, 0.000176...
[ "torch.zeros" ]
1.0.0
lunayach/control-tasks
f333b03d7dc31f89ae56c82e22a9ea588547590f
1.6
import torch from torch.nn.parallel import DistributedDataParallel as DDP from ..utils import common_functions as c_f # modified from https://github.com/allenai/allennlp def is_distributed(): return torch.distributed.is_available() and torch.distributed.is_initialized() # modified from https://github.com/JohnG...
[ "torch.distributed.get_world_size", "torch.cat", "torch.distributed.is_available", "torch.nn.parallel.DistributedDataParallel", "torch.distributed.is_initialized", "torch.ones_like", "torch.distributed.get_rank" ]
1.6.0
mlopezantequera/pytorch-metric-learning
1fb343124d15fd2f63d535df26aa1463daf4ceee
1.6
import torch from ..distances import CosineSimilarity from ..reducers import DivisorReducer from ..utils import common_functions as c_f from ..utils import loss_and_miner_utils as lmu from .base_metric_loss_function import BaseMetricLossFunction from .mixins import WeightRegularizerMixin # adapted from # https://git...
[ "torch.nn.functional.one_hot", "torch.Tensor", "torch.sum" ]
1.6.0
mlopezantequera/pytorch-metric-learning
1fb343124d15fd2f63d535df26aa1463daf4ceee
1.7
import numpy as np import torch import torch.optim as optim from torch import nn as nn from collections import OrderedDict import lifelong_rl.torch.pytorch_util as ptu from lifelong_rl.torch.distributions import TanhNormal from lifelong_rl.util.eval_util import create_stats_ordered_dict from lifelong_rl.core.rl_algor...
[ "torch.nn.MSELoss", "torch.einsum", "torch.norm", "torch.eye", "torch.exp", "torch.sum" ]
1.7.1
snu-mllab/EDAC
c21d8aa354d13dbe884fd2fb809fe9a85c65e6c9
1.0
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
[ "torch.no_grad", "torch.ones", "torch.from_numpy", "torch.tensor", "torch.isinf", "torch.ones_like", "torch.allclose", "torch.argmax" ]
1.0
dctelus/transformers
b18dfd95e1f60ae65a959a7b255fc06522170d1b
1.0
# coding=utf-8 # Copyright 2021 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.tensor" ]
1.0
dctelus/transformers
b18dfd95e1f60ae65a959a7b255fc06522170d1b
1.0
# coding=utf-8 # Copyright 2020 The HuggingFace Team 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
[ "torch.zeros", "torch.min", "torch.eq", "torch.max", "torch.no_grad", "torch.ones", "torch.manual_seed", "torch.randint", "torch.tensor", "torch.ones_like", "torch.zeros_like", "torch.allclose" ]
1.0
dctelus/transformers
b18dfd95e1f60ae65a959a7b255fc06522170d1b
1.0
#!/usr/bin/env python # coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
[ "torch.stack" ]
1.0
dctelus/transformers
6786cbc4b14ebff0ac59c768cadd109391db9a08
1.6
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://w...
[ "torch.cuda.is_available", "torch.cuda.amp.autocast", "torch.tensor" ]
1.6.0
hasukmin12/nnUNet_MDD_UNet_with_Semi_Supervised
58c5665a5d89d1ad77038e5d6420be76fadab136
1.7
# @Time : 2020/6/28 # @Author : Zihan Lin # @Email : linzihan.super@foxmail.com # UPDATE # @Time : 2020/10/04, 2021/3/2, 2021/2/17 # @Author : Shanlei Mu, Yupeng Hou, Jiawei Guan # @Email : slmu@ruc.edu.cn, houyupeng@ruc.edu.cn, Guanjw@ruc.edu.cn """ recbole.config.configurator ################################ ...
[ "torch.cuda.is_available" ]
1.7.0
ghazalehnt/RecBole
f1219847005e2c8d72b8c3cd5c49a138fe83276d
1.7
import time import numpy import torch from torch_sparse import SparseTensor from recbole.config import Config from recbole.data import create_dataset, data_preparation from recbole.model.abstract_recommender import GeneralRecommender from recbole.utils import InputType, ModelType, init_seed, get_model import jnius_c...
[ "torch.zeros", "torch.tensor" ]
1.7.0
ghazalehnt/RecBole
f1219847005e2c8d72b8c3cd5c49a138fe83276d
0.4
# # 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.numel" ]
0.4.0
amishacorns/dnn-quant-ocs
a43b9f101dbf95e034c404f89162ce0082e12ecf
1.2
# # File: odesolver.py # import abc import torch class Euler: @staticmethod def step_func(func, t, dt, y, u, transforms=None): return tuple(dt * f_ for f_ in func(t, y, u=u)) @property def order(self): return 1 class Midpoint: @staticmethod def step_func(func, t, dt, y, u...
[ "torch.is_tensor", "torch.is_floating_point" ]
1.2
sisl/CEEM
6154587fe3cdb92e8b7f70eedb1262caa1553cc8
1.2
# # File: smoother.py # import numpy as np import torch from numpy.random import choice from scipy.optimize import least_squares, minimize from torch.distributions.multivariate_normal import MultivariateNormal from ceem import utils from ceem.opt_criteria import GroupSOSCriterion, STRStateCriterion from tqdm import t...
[ "torch.zeros", "torch.no_grad", "torch.inverse", "torch.eye", "torch.tensor", "torch.randn" ]
1.2
sisl/CEEM
6154587fe3cdb92e8b7f70eedb1262caa1553cc8
0.4
""" A stacked bidirectional LSTM with skip connections between layers. """ from typing import Optional, Tuple, List import warnings import torch from torch.nn.utils.rnn import PackedSequence, pad_packed_sequence with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=FutureWarning) import h5...
[ "torch.cat", "torch.stack", "torch.FloatTensor", "torch.nn.utils.rnn.pad_packed_sequence" ]
0.4.0
LiyuanLucasLiu/allennlp
da81516cbe78b58c2f2a3a9e56ef2526bd72fb9f
1.7
import torch.nn as nn class LeNet(nn.Module): def __init__(self, out_dim=10, in_channel=1, img_sz=32, hidden_dim=500): super(LeNet, self).__init__() feat_map_sz = img_sz//4 self.n_feat = 50 * feat_map_sz * feat_map_sz self.hidden_dim = hidden_dim self.conv = nn.Sequenti...
[ "torch.nn.Linear", "torch.nn.MaxPool2d", "torch.nn.BatchNorm2d", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.nn.BatchNorm1d", "torch.nn.Flatten" ]
1.7.1
lihr04/PCA-OGD
196d03701f22110479af9c1feb619fef6fe1562b
2
from mmdet2trt.models.builder import register_wraper, build_wraper import torch from torch import nn import torch.nn.functional as F from .bbox_head import BBoxHeadWraper @register_wraper("mmdet.models.roi_heads.bbox_heads.sabl_head.SABLHead") class SABLHeadWraper(BBoxHeadWraper): def __init__(self, module, test_...
[ "torch.cat", "torch.nn.functional.softmax" ]
2
jackweiwang/mmdetection-to-tensorrt
c31c32ee4720ff56010bcda77bacf3a110d0526c
3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. import torch import torch.nn as nn from pytorch3d import _C from torch.autograd import Function from torch.autograd.function import once_differentiable class GraphConv(nn.Module): """A single graph convolution layer.""" def __init__( ...
[ "torch.zeros_like", "torch.nn.init.normal_", "torch.cuda.is_available", "torch.nn.Linear" ]
3
martinruenz/pytorch3d
7f1e63aed1252ba8145d4a66ce2272331d60cdae
1.6
from typing import Optional, Any, cast import gym import gym_minigrid.minigrid import numpy as np import torch from babyai.utils.format import InstructionsPreprocessor from gym_minigrid.minigrid import MiniGridEnv from allenact.base_abstractions.sensor import Sensor, prepare_locals_for_super from allenact.base_abstra...
[ "torch.nn.functional.pad" ]
1.6.0
klemenkotar/dcrl
457be7af1389db37ec12e165dfad646e17359162
1.4
import collections import itertools import json import os import attr import torch import torch.nn.functional as F import numpy as np from tensor2struct.models import abstract_preproc, encoder, batched_encoder from tensor2struct.modules import embedders, lstm, attention, permutation from tensor2struct.utils import se...
[ "torch.nn.Linear", "torch.zeros", "torch.cat", "torch.stack", "torch.einsum", "torch.bmm", "torch.logsumexp", "torch.matmul", "torch.bernoulli", "torch.LongTensor", "torch.nn.utils.rnn.pack_padded_sequence", "torch.zeros_like", "torch.nn.functional.pad", "torch.exp", "torch.randn" ]
1.4.0
chenyangh/tensor2struct-public
d3257cba6d76d3c658a58a78f687d986bdc755cf
1.4
import collections import itertools import json import os import attr import nltk.corpus import torch import torchtext import numpy as np from tensor2struct.models import abstract_preproc from tensor2struct.utils import serialization, vocab, registry from tensor2struct.modules import rat, lstm, embedders, bert_tokeni...
[ "torch.cat", "torch.LongTensor" ]
1.4.0
chenyangh/tensor2struct-public
d3257cba6d76d3c658a58a78f687d986bdc755cf
1.4
import torch from fairseq.models.bart import BARTModel import argparse from pprint import pprint from tqdm import tqdm import os from os.path import join import shutil import logging import numpy as np import json import random import string import files2rouge import time def test_rouge(cand, ref, outpath=None, tmp_d...
[ "torch.no_grad", "torch.cuda.is_available" ]
1.4.0
yakushechkin/scitldr
c8090d0c8d62bafc878a0050dcfb7c33e3c54dc5
1.6
import torch from torch import nn from .metric import Metric class Accuracy(Metric): def __init__(self, name="accuracy", dtype=None, reduction="sum", **kwargs): super().__init__(name, dtype, **kwargs) assert reduction in {"sum", "mean", "max", "min"} # TODO: mo...
[ "torch.tensor", "torch.sum" ]
1.6.0
kisekizzz/GraphGallery
fd4a1f474c244f774397460ae95935638ef48f5b
1.10
from Models.MNIST_Model import MNIST_Model as Model from Dataloaders.Mnist import Mnist as Dataloader from Clients.SGDClient import SGDClient as Client from Servers.FedKpServer import FedKpServer from Servers.FedAvgServer import FedAvgServer from Algorithms.FedAvg import FedAvg as Alg import matplotlib.pyplot as plt fr...
[ "torch.cuda.current_device", "torch.cuda.is_available", "torch.manual_seed" ]
1.10.2
MartinHex/master-thesis
b5077d9acce60fd42467f73df6e39c61fd3e19b2
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.log", "torch.clamp" ]
1.3.1
GiannisVagionakis/metrics
12d0746e0e9ef9eeeca11cef1e118a156c1518ec
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.zeros", "torch.distributed.get_world_size", "torch.eq", "torch.distributed.init_process_group", "torch.multiprocessing.spawn", "torch.cuda.device_count", "torch.tensor", "torch.load" ]
1.3
nightlessbaron/pytorch-lightning
239bea5c29cef0d1a0cfb319de5dbc9227aa2a53
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.nn.Linear", "torch.rand", "torch.nn.Dropout", "torch.nn.LSTM", "torch.nn.Sigmoid", "torch.nn.Tanh", "torch.nn.LeakyReLU", "torch.nn.functional.mse_loss", "torch.nn.functional.cross_entropy", "torch.nn.BatchNorm1d", "torch.tanh", "torch.randn", "torch.nn.functional.binary_cross_entropy...
1.3
nightlessbaron/pytorch-lightning
239bea5c29cef0d1a0cfb319de5dbc9227aa2a53
1.5
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from torch.autograd import grad def velocity_verlet(z, r, potential_fn, kinetic_grad, step_size, num_steps=1, z_grads=None): r""" Second order symplectic integrator that uses the velocity verlet algorithm. :param dic...
[ "torch.autograd.grad" ]
1.5.0
ashishfarmer/pyro
11a96cde05756def826c232d76f9cff66f6e6d4f
1.5
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import operator from functools import partial, reduce import torch from torch.distributions import constraints from torch.distributions.utils import _sum_rightmost from pyro.distributions.conditional import ConditionalTransformMo...
[ "torch.distributions.utils._sum_rightmost", "torch.cat", "torch.exp" ]
1.5.0
ashishfarmer/pyro
54d48627a7c5c0575c2fe69d5b6c80f3c47b287b
1.2
import torch from .functional import auxiliary_classification_loss from .loss import DiscriminatorLoss, GeneratorLoss __all__ = [ "AuxiliaryClassifierGeneratorLoss", "AuxiliaryClassifierDiscriminatorLoss", ] class AuxiliaryClassifierGeneratorLoss(GeneratorLoss): r"""Auxiliary Classifier GAN (ACGAN) loss...
[ "torch.randint", "torch.randn" ]
1.2
torchgan/torchgan
cfd5da4b7ffcec544c6cc4a22257edf40fd31f9d
1.6
import transformers from transformers.models.auto.configuration_auto import AutoConfig from transformers import AutoModel, AutoModelForSequenceClassification from transformers import AutoTokenizer from src.dataset.wic_dataset import * from transformers import AutoTokenizer from src.models.modeling import BaseEncoderMod...
[ "torch.device", "torch.cuda.amp.autocast" ]
1.6.0
cr1m5onk1ng/text_similarity
2123621bf153683b35e9433835237812605bd42f
1.7
import math import torch import torch.nn as nn import torch.nn.functional as F """ Original Author: Wei Yang """ __all__ = ['wrn'] class BasicBlock(nn.Module): def __init__(self, in_planes, out_planes, stride, dropRate=0.0): super(BasicBlock, self).__init__() self.bn1 = nn.BatchNorm2d(in_planes)...
[ "torch.nn.Linear", "torch.nn.functional.avg_pool2d", "torch.nn.ModuleList", "torch.nn.Sequential", "torch.nn.BatchNorm2d", "torch.nn.functional.dropout", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.randn" ]
1.7.0
hanseungwook/SimSiam
ff363f2cfdee07ecfee6c25ae3e920fdb9302e57
1.0
#!/usr/bin/env python3 import torch def inv_softplus(x): return torch.log(torch.exp(x) - 1) def inv_sigmoid(x): return torch.log(x / (1 - x)) def _get_inv_param_transform(param_transform, inv_param_transform=None): reg_inv_tf = TRANSFORM_REGISTRY.get(param_transform, None) if reg_inv_tf is None: ...
[ "torch.log", "torch.exp" ]
1.0.0
beyucel/gpytorch
a5394937495756945b831d83035349579d8fac31
1.0
#!/usr/bin/env python3 import torch import unittest from gpytorch.lazy import BlockDiagLazyTensor, NonLazyTensor from test.lazy._lazy_tensor_test_case import LazyTensorTestCase class TestBlockDiagLazyTensor(LazyTensorTestCase, unittest.TestCase): seed = 0 should_test_sample = True def create_lazy_tensor...
[ "torch.zeros", "torch.eye", "torch.randn" ]
1.0.0
beyucel/gpytorch
a5394937495756945b831d83035349579d8fac31
1.3
from torch.utils.tensorboard import SummaryWriter def log(*args): iteration, loss, accuracy = args writer = SummaryWriter() writer.add_scalar("Loss", loss, iteration) writer.add_scalar("Accuracy", accuracy, iteration)
[ "torch.utils.tensorboard.SummaryWriter" ]
1.3.0
Mrityunjay2668/ObjectDetection
d3582311e5cf563c4f2ba7fdd87d8f56b60cccb1
1.5
# Copyright 2020 - 2021 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in wri...
[ "torch.nn.Linear", "torch.nn.Identity", "torch.nn.functional.softplus", "torch.nn.ModuleList", "torch.nn.functional.mse_loss", "torch.randn_like", "torch.log", "torch.mean" ]
1.5
JoHof/MONAI
70483b648fba92f0a8346e53dc14d686e56120a3
1.5
# Copyright 2020 - 2021 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in wri...
[ "torch.cat" ]
1.5
JoHof/MONAI
70483b648fba92f0a8346e53dc14d686e56120a3
0.4
# coding: utf-8 import torch from torch import nn from torch.autograd import Variable import numpy as np from nnmnkwii.autograd import unit_variance_mlpg class AbstractModel(object): """Interface for VC and TTS models """ def include_parameter_generation(self): """Whether model includes paramet...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.nn.LSTM", "torch.nn.Sigmoid", "torch.nn.LeakyReLU", "torch.nn.utils.rnn.pad_packed_sequence", "torch.nn.utils.rnn.pack_padded_sequence" ]
0.4.1
karkirowle/gantts
f61d2b1ecb9493980338c9f598d74fc46120afe2
1.8
import torch import torch.nn as nn #import torch.nn.functional as F import math class PositionalEmbedding(nn.Module): ''' Encode position index to d_model dimension feature ''' def __init__(self, d_model, max_len=5000): super(PositionalEmbedding, self).__init__() # buffer placeholder ...
[ "torch.nn.Linear", "torch.cos", "torch.nn.Dropout", "torch.__version__.split", "torch.zeros", "torch.sin", "torch.nn.Conv1d", "torch.arange", "torch.nn.init.kaiming_normal_", "torch.nn.Parameter", "torch.nn.Embedding" ]
1.8.0
macul99/Informer2020
7e1e3979ea912879e16194e3bf93062458f2cb9e
1.0
import torch from terra.io import reader, writer @writer(torch.Tensor) def write_tensor(out, path): torch.save(out, path) return path @reader(torch.Tensor) def read_tensor(path): return torch.load(path) class TerraModule: def __terra_write__(self, path): torch.save({"state_dict": self.sta...
[ "torch.save", "torch.load" ]
1.0.0
seyuboglu/terra
7d5f8d8cdfbf819b52fb997b5b9746746d86b295
1.9
"""Evaluate training/validation set using models in checkpoints""" import logging import torch from mlbench_core.aggregation.pytorch.centralized import AllReduceAggregation from mlbench_core.controlflow.pytorch.helpers import iterate_dataloader from mlbench_core.utils.pytorch.distributed import global_average logger...
[ "torch.no_grad" ]
1.9.0
mlbench/mlbench-core
4fd3c7e6f1a5be69e52383ab2eb64cad257218c2
1.9
import torch @torch.jit.script def orthogonalize(matrix, eps=torch.FloatTensor([1e-16])): """Function used to orthogonalize a matrix. Args: matrix (torch.Tensor): Matrix to orthogonalize eps (torch.FloatTensor): Used to avoid division by zero (default: 1e-16) """ n, m = matrix.shape ...
[ "torch.FloatTensor", "torch.empty", "torch.sum" ]
1.9.0
mlbench/mlbench-core
4fd3c7e6f1a5be69e52383ab2eb64cad257218c2
1.6
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from transformers import BertPreTrainedModel, BertModel class BiEncoder(BertPreTrainedModel): def __init__(self, config, *inputs, **kwargs): super().__init__(config, *inputs, **kwargs) self.bert = kwargs['bert'] ...
[ "torch.nn.Linear", "torch.cdist", "torch.arange", "torch.nn.functional.log_softmax", "torch.abs", "torch.nn.init.normal_", "torch.eye", "torch.nn.functional.softmax", "torch.matmul", "torch.nn.Embedding" ]
1.6.0
Anpopaicoconat/Poly-Encoder
779a6ec19bd6477947fcf44199fa06fc6353e18a
1.5
import transformers import torch MAX_LEN = 512 TRAIN_BATCH_SIZE = 4 VALID_BATCH_SIZE = 8 NUM_CLASSES = 5 DEVICE = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu') EPOCHS = 2 BERT_PATH = './input/prunebert-base-uncased-6-finepruned-w-distil-squad' MODEL_PATH = './model/pytorch_model.bin' TRAI...
[ "torch.device", "torch.cuda.is_available" ]
1.5.0
robmarkcole/BERT_as_serverless_service
fbc4004677ae3811b08f89d577b5a45ce0bfbbd0
1.7
#!/usr/bin/env python3 # # Copyright 2020 Xiaomi Corporation (authors: Fangjun Kuang) # # See ../../../LICENSE for clarification regarding multiple authors # # 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...
[ "torch.device", "torch.rand", "torch.rand_like", "torch.arange", "torch.nn.utils.rnn.pad_sequence", "torch.nn.functional.log_softmax", "torch.manual_seed", "torch.cuda.device_count", "torch.cuda.set_device", "torch.cuda.is_available", "torch.tensor", "torch.randint", "torch.allclose", "tor...
1.7.1
EmreOzkose/k2
818b138b33eabe440601df8910a2b97ac088594b
1.8
import xitorch import torch import pytest from xitorch._core.pure_function import get_pure_function, PureFunction def func1(x, a, b): return x * a + b @torch.jit.script def jitfunc1(x, a, b): return x * a + b class TorchModule(torch.nn.Module): def __init__(self, a, b): super().__in...
[ "torch.allclose", "torch.tensor" ]
1.8
Jaikinator/xitorch
053db8d27a7777baa7f572c2d37004e788ff4cb8
1.8
import torch import numpy as np ################### metropolis hastings ################### def mh(logpfcn, x0, pparams, nsamples=10000, nburnout=5000, step_size=1.0, **unused): """ Perform Metropolis-Hasting steps to collect samples Keyword arguments ----------------- nsamples: int ...
[ "torch.zeros", "torch.rand", "torch.numel", "torch.cos", "torch.tan", "torch.atan", "torch.randn_like", "torch.tensor", "torch.empty", "torch.empty_like" ]
1.8
Jaikinator/xitorch
053db8d27a7777baa7f572c2d37004e788ff4cb8
1.3
from __future__ import print_function, division import sys sys.path.append('core') import argparse import os import cv2 import time from datetime import datetime import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tqdm import tqdm import torch import torch.nn as nn import torch.optim as o...
[ "torch.cat", "torch.optim.lr_scheduler.OneCycleLR", "torch.split", "torch.no_grad", "torch.cuda.device_count", "torch.tensor", "torch.utils.data.DataLoader", "torch.load", "torch.nn.functional.conv2d", "torch.nn.DataParallel", "torch.sum" ]
1.3.1
gallif/raft
11a35ff5ede31918a360eca2f1481bc5fec9b5e5
1.8
import torch import pandas as pd import sys import numpy as np from tqdm import tqdm from model_arch.discriminator import DiscriminatorLaw from dfencoder.autoencoder import AutoEncoder from dfencoder.dataframe import EncoderDataFrame from utils.evaluate_func import evaluate_pred, evaluate_distribution, evaluate_fairne...
[ "torch.device", "torch.cuda.is_available", "torch.load" ]
1.8.1
tridungduong16/counterfactual_fairness_game_theoretic
794d5224f9c656c06e5eb197ebbe1875f1856e7e
1.8
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 4 20:55:24 2021 @author: trduong """ import pandas as pd import numpy as np import logging import yaml import pyro import torch import pyro.distributions as dist import sys from sklearn.linear_model import LinearRegression from sklearn import pr...
[ "torch.tensor" ]
1.8.1
tridungduong16/counterfactual_fairness_game_theoretic
794d5224f9c656c06e5eb197ebbe1875f1856e7e
1.6
# Copyright (c) Facebook, Inc. and its affiliates. # Initial version was taken from https://github.com/ChenRocks/UNITER/ # and adapted for MMF. import copy import logging import random from collections import MutableMapping, namedtuple from dataclasses import asdict, dataclass, field from typing import Any, Dict, Lis...
[ "torch.nn.Linear", "torch.zeros", "torch.cat", "torch.nn.Dropout", "torch.nn.LayerNorm", "torch.nn.ModuleDict", "torch.full", "torch.tensor", "torch.clone", "torch.nn.Embedding" ]
1.6.0
sisilmehta2000/mmf
ac1bb736f281ffbde367cfe9cf6f4f78fc890fc4
1.6
import torch import numpy as np from sklearn import model_selection from torchvision import datasets from torchvision import transforms from torch.utils.data.sampler import SubsetRandomSampler, SequentialSampler from cutout import Cutout from autoaugment import CIFAR10Policy import pickle def get_train_valid_loader...
[ "torch.utils.data.sampler.SequentialSampler", "torch.utils.data.DataLoader" ]
1.6.0
VascoLopes/LCMNAS
f5a5707c3bd6306a5831d1c78a30a1fd2d7c9912
1.6
import torch from torch import nn class RunningStats(nn.Module): def __init__(self, shape, eps = 1e-5): super().__init__() shape = shape if isinstance(shape, tuple) else (shape,) self.shape = shape self.eps = eps self.n = 0 self.register_buffer('old_mean', torch.ze...
[ "torch.zeros", "torch.zeros_like" ]
1.6
lucidrains/anymal-belief-state-encoder-decoder-pytorch
e8d4acfa2c81073a88980832185212ba2802287b
1.4
""" Vision Transformer (ViT) in PyTorch A PyTorch implement of Vision Transformers as described in: 'An Image Is Worth 16 x 16 Words: Transformers for Image Recognition at Scale' - https://arxiv.org/abs/2010.11929 `How to train your ViT? Data, Augmentation, and Regularization in Vision Transformers` - https:...
[ "torch.nn.Linear", "torch.zeros", "torch.cat", "torch.nn.Dropout", "torch.nn.Identity", "torch.nn.init.constant_", "torch.nn.Tanh", "torch.no_grad", "torch.nn.functional.interpolate", "torch.nn.init.xavier_uniform_", "torch.linspace", "torch.from_numpy", "torch.jit.ignore", "torch.nn.init....
1.4.0
ares89/pytorch-image-models
dc51334cdc05757dc9004583aac8668ebd892b03
1.1
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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 Lice...
[ "torch.nn.Linear", "torch.cat", "torch.nn.ParameterList", "torch.einsum", "torch.nn.ModuleList", "torch.ones", "torch.load", "torch.chunk", "torch.ger", "torch.nn.init.constant_", "torch.tril", "torch.nn.init.normal_", "torch.Tensor", "torch.zeros", "torch.nn.functional.log_softmax", "...
1.1.0
9173860/WMSeg
526d3ad0bf17bc657d9100cbcb7a0d8682b10643
1.6
import numpy as np import torch class FeaturesLinear(torch.nn.Module): def __init__(self, field_dims, output_dim=1): super().__init__() self.fc = torch.nn.Embedding(sum(field_dims), output_dim) self.bias = torch.nn.Parameter(torch.zeros((output_dim, ))) self.offsets = np.array((0,...
[ "torch.zeros" ]
1.6
jianzhnie/AutoTabular
d630c78290a52f8c73885afb16884e18135c34f6
1.7
import io import PIL.Image import numpy as np import matplotlib import matplotlib.pyplot as plt import torch import torchvision.utils as vutils from torchvision.transforms import ToTensor from utils.utils import enforce_orthog, get_inverse_tf, get_T_ba from utils.utils import getApproxTimeStamps, wrapto2pi def convert...
[ "torch.sum", "torch.nonzero" ]
1.7.1
MPieter/hero_radar_odometry
107c1a07b22784fec54c22e5f8bb03251cc9f786
1.7
from networks.twobranch import twobranch import torch import utils from copy import deepcopy class twobranch_sum(twobranch): def __init__(self, pretrained=False, backbone='resnet18', num_out=100, togray="mean", scramble=False,select_kernels='all', remove_batchnorm=None): self.backbone = backbone ...
[ "torch.nn.Linear" ]
1.7.1
dberga/FACIL
c11dd157bc53cfac91814a52c57bddc385365c61
1.4
# Copyright 2020 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, s...
[ "torch.device", "torch.no_grad", "torch.cuda.is_available" ]
1.4
murraycutforth/MONAI
ad06dff7f85711048690b2e85c99d51001612708
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.nn.ReLU", "torch.nn.Conv2d", "torch.nn.BatchNorm2d", "torch.load" ]
1.5.0
xiao1228/nncf
307262119ee3f50eec2fa4022b2ef96693fd8448
1.3
#!/usr/bin/env python # original all-but-the-top code: # https://gist.github.com/lgalke/febaaa1313d9c11f3bc8240defed8390 import sys, os import logging import argparse logger = logging.getLogger(__name__) import numpy as np from sklearn.decomposition import PCA from gensim.models import KeyedVectors import torch def ...
[ "torch.from_numpy", "torch.functional.F.normalize" ]
1.3.1
toshohirasawa/mmt-with-monolingual-data
3f80f3a1807e1a837ef82d75917c1cf581270b84
1.2
# -*- coding: utf-8 -*- import importlib import re import torch import torch.nn as nn import attacut from attacut import logger log = logger.get_logger(__name__) def get_device(): if torch.cuda.is_available(): return "cuda" else: return "cpu" class ConvolutionBatchNorm(nn.Module): def...
[ "torch.nn.BatchNorm1d", "torch.cuda.is_available", "torch.load", "torch.nn.Conv1d" ]
1.2.0
huak95/attacut
100333931023cd009daeddec0cba4cdfce3d0b68
1.6
import logging import os from dataclasses import dataclass from typing import Any, Dict, Optional, Union import torch.optim.lr_scheduler from allennlp.common import Registrable from allennlp.common.checks import ConfigurationError, check_for_gpu from allennlp.common.util import int_to_device logger = logging.getLogg...
[ "torch.cuda.device_count" ]
1.6.0
alle-pawols/allennlp
7d4a67263d7a210aca22d4f2b03e8568d3c34a48
1.6
""" A suite of differentiable methods to compute the bias direction or concept subspace representing binary protected variables. """ import torch import sklearn import numpy as np from allennlp.common.checks import ConfigurationError class BiasDirection: """ Parent class for bias direction classes. # P...
[ "torch.pca_lowrank", "torch.linalg.norm", "torch.mean", "torch.Tensor", "torch.set_grad_enabled" ]
1.6.0
alle-pawols/allennlp
7d4a67263d7a210aca22d4f2b03e8568d3c34a48
1.5
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import argparse import logging import numpy as np import torch import pyro import pyro.distributions as dist from pyro.contrib.examples.bart import load_bart_od from pyro.contrib.forecast import ForecastingModel, backtest from pyro.o...
[ "torch.zeros", "torch.stack", "torch.ones", "torch.full", "torch.eye" ]
1.5.0
ciguaran/pyro
11a96cde05756def826c232d76f9cff66f6e6d4f
1.8
import json import logging from pathlib import Path import random import tarfile import tempfile import warnings import matplotlib.pyplot as plt import numpy as np import pandas as pd import pandas_path from PIL import Image import torch import fasttext from torch.nn.utils.rnn import pad_sequence from torchvision.tra...
[ "torch.is_tensor", "torch.nn.utils.rnn.pad_sequence", "torch.LongTensor", "torch.Tensor" ]
1.8.1
nav13n/multimodal-learning
283d09989ab5e547acc881547276e03e00c0ff39
1.4
from typing import List import torch from code_transformer.modeling.constants import SEP_TOKEN, CLS_TOKEN, MAX_NUM_TOKENS from code_transformer.modeling.data_utils import sample_targets, permutation_attention_mask from code_transformer.preprocessing.datamanager.base import CTBatch from code_transformer.preprocessing....
[ "torch.where" ]
1.4
maximzubkov/code-transformer
52600ab17d05a238f35c39a78b22c5c706fbb13c
1.4
import random import signal import sys from abc import abstractmethod from itertools import islice from statistics import mean import torch from sacred import Experiment from torch import optim from torch.utils.data import DataLoader from tqdm import tqdm from code_transformer.configuration.transformer_lm_encoder imp...
[ "torch.optim.lr_scheduler.OneCycleLR", "torch.no_grad", "torch.optim.lr_scheduler.MultiStepLR", "torch.manual_seed", "torch.utils.data.DataLoader" ]
1.4
maximzubkov/code-transformer
52600ab17d05a238f35c39a78b22c5c706fbb13c
1.5
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from onpolicy.algorithms.utils.cnn import CNNBase from onpolicy.algorithms.utils.mlp import MLPBase, MLPLayer from onpolicy.algorithms.utils.rnn import RNNLayer from onpolicy.algorithms.utils.act import ACTLayer from onp...
[ "torch.nn.Linear", "torch.device", "torch.nn.init.constant_" ]
1.5.1
LUMO666/Highway
05e1ad318bd14d405bd78d612e5706f7db2b3266
1.5
# Copyright 2020 - 2021 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in wri...
[ "torch.cat" ]
1.5
eddyleelin/MONAI
8e56191d344692fdfa1b9a52285b2514131061e6
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.cuda.FloatTensor", "torch.load", "torch.allclose", "torch.IntTensor", "torch.is_tensor", "torch.FloatTensor", "torch.manual_seed", "torch.optim.Optimizer.__subclasses__", "torch.tensor", ...
1.4.0
DEKHTIARJonathan/horovod
333ce607c5ed0c5a38defd234f818aeb27a5394b
1.4
from timeit import timeit import numpy as np import torch from tianshou.data import Batch, ReplayBuffer, to_numpy from tianshou.policy import BasePolicy def compute_episodic_return_base(batch, gamma): returns = np.zeros_like(batch.rew) last = 0 for i in reversed(range(len(batch.rew))): returns[i...
[ "torch.tensor" ]
1.4.0
ClarenceYC/tianshou
39f8391cfb4f219a267c1040e2d463be91c645b0
1.4
from copy import deepcopy from typing import Any, Dict, Optional, Tuple, Union import numpy as np import torch from torch.distributions import Independent, Normal from tianshou.data import Batch, ReplayBuffer, to_torch_as from tianshou.exploration import BaseNoise from tianshou.policy import DDPGPolicy class SACPol...
[ "torch.Size", "torch.min", "torch.distributions.Normal", "torch.tanh" ]
1.4.0
ClarenceYC/tianshou
39f8391cfb4f219a267c1040e2d463be91c645b0
1.9
import copy import numpy as np import torch import torch.nn as nn import torch.nn.functional as F # Implementation of Twin Delayed Deep Deterministic Policy Gradients (TD3) # Paper: https://arxiv.org/abs/1802.09477 class Actor(nn.Module): def __init__(self, state_dim, action_dim, max_action): super(Actor, self)._...
[ "torch.nn.Linear", "torch.min", "torch.no_grad", "torch.std", "torch.nn.functional.mse_loss", "torch.randn_like", "torch.load", "torch.mean", "torch.randn" ]
1.9.0
yifan-you-37/GRAC-1
22b2cde651ae4416475d9594b93ad1c430090144
1.5
# Copyright 2020 - 2021 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in wri...
[ "torch.cat", "torch.tensor" ]
1.5
KohYoungResearchAmerica/MONAI
eca3f19182b9fcee0be7123728a9826cd382d152
1.8
#!/bin/env python """Train a Sketch-VAE.""" import argparse from enum import Enum import os import wget import time import numpy as np import torch as th from torch.utils.data import DataLoader import torchvision.datasets as dset import torchvision.transforms as transforms import ttools import ttools.interfaces from ...
[ "torch.nn.Linear", "torch.cat", "torch.nn.LSTM", "torch.nn.Sigmoid", "torch.nn.Tanh", "torch.nn.ConvTranspose2d", "torch.optim.lr_scheduler.ExponentialLR", "torch.clamp", "torch.manual_seed", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.cuda.is_available", "torch.utils.data.DataLoader", "tor...
1.8.1
AntonBiryukovUofC/diffvg
e081098f52b82bfd0b7e91114d289d65ef969a60
1.3
import torch as T from torch.nn import Module from mltoolkit.mlmo.layers import Ffnn class MuSigmaFfnn(Module): """ A single hidden layer feed-forward nn that outputs mu and sigma of a Gaussian distribution. The produced sigma is a vector with non-negative values. """ def __init__(self, input...
[ "torch.exp" ]
1.3.0
stungkit/Copycat-abstractive-opinion-summarizer
04fe5393a7bb6883516766b762f6a0c530e95375
1.8
# 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.distributed.is_available", "torch._C._log_api_usage_once", "torch.no_grad", "torch.jit.save", "torch.tensor", "torch.onnx.export" ]
1.8
adamreeve/pytorch-lightning
908e05880d4271ad32876311320d4465a008a710
1.10
# -*- coding: utf-8 -*- from abc import ABC, abstractmethod from sentence_transformers import SentenceTransformer, models from torch import nn import numpy as np from wasabi import msg from sklearn.feature_extraction.text import CountVectorizer from sklearn.preprocessing import OneHotEncoder from transformers import lo...
[ "torch.nn.Tanh" ]
1.10.0
onetask-ai/onetask-python
ea810a3092a029d5b30f6af9e9a5f17567e0b901
1.8
import torch from typing import Dict, Tuple, Any from torch.distributions.categorical import Categorical from malib.algorithm.common.loss_func import LossFunc from malib.backend.datapool.offline_dataset_server import Episode from malib.utils.typing import TrainingMetric def cal_entropy(logits): max_value, _ = ...
[ "torch.max", "torch.square", "torch.maximum", "torch.clip", "torch.distributions.categorical.Categorical", "torch.abs", "torch.log", "torch.exp", "torch.sum" ]
1.8.1
ReinholdM/play_football_with_human
9ac2f0a8783aede56f4ac1f6074db7daa41b6b6c
1.0
""" Class for the Sequence to sequence model for ATIS.""" import os import torch import torch.nn.functional as F from . import torch_utils from . import utils_bert from data_util.vocabulary import DEL_TOK, UNK_TOK from .encoder import Encoder from .embedder import Embedder from .token_predictor import construct_tok...
[ "torch.zeros", "torch.device", "torch.cat", "torch.optim.Adam", "torch.cuda.FloatTensor" ]
1.0.1
ManishBachhu/editsql
c046dfbee72d3b54ebc7a2326b1eb7797b23d10e
1.0
from collections import OrderedDict import torch import torch.nn as nn from torch.utils import model_zoo from torchvision import models from .fcn import convolutionalize def vgg16(is_caffe=True): """ Load the VGG-16 net for use as a fully convolutional backbone. - cast to fully convolutional by convert...
[ "torch.utils.model_zoo.load_url" ]
1.0.0
Global19/revolver
74fc12afff8a8747224d9e7098fe97542f81cea0
1.7
from typing import List, Union import torch class ConfigurationError(Exception): pass class FeedForward(torch.nn.Module): """ This `Module` is a feed-forward neural network, just a sequence of `Linear` layers with activation functions in between. # Parameters input_dim : `int`, required ...
[ "torch.nn.Linear", "torch.nn.Dropout", "torch.nn.ModuleList" ]
1.7.1
dwadden/longchecker
9efdc2f13130146dfea187c76037e69008ad62d5
1.8
import math import torch import torch.nn as nn from colossalai.global_variables import moe_env from colossalai.context import ParallelMode, seed from colossalai.utils import get_current_device class MoeExperts(nn.Module): def __init__(self, comm: str): super().__init__() assert comm...
[ "torch.nn.Dropout", "torch.cat", "torch.nn.init.trunc_normal_", "torch.baddbmm", "torch.nn.GELU", "torch.chunk" ]
1.8
mrriteshranjan/ColossalAI
0d057a1bae67b915a385be7edab7da83413cb645
1.9
import kornia.augmentation as K import yaml import torch from .Utils import resample, clamp_with_grad from torch import nn CONFIG_DIRECTORY = 'Config' AUGMENT_CONFIG = 'augment_config.yaml' DEFAULT_AUGMENTS = [['Af', 'Pe', 'Ji', 'Er']] with open(f"{CONFIG_DIRECTORY}/{AUGMENT_CONFIG}", "r") as f: afg = ...
[ "torch.nn.AdaptiveMaxPool2d", "torch.cat", "torch.rand", "torch.nn.Sequential", "torch.randint", "torch.randn_like", "torch.nn.AdaptiveAvgPool2d" ]
1.9.0
Xibanya/VQGAN-CLIP
24510ef372df3131dedf289397818217e1fd3df0
0.3
import torch, torchvision import os import argparse def main(): parser = argparse.ArgumentParser(description='PIONEER Zeta') parser.add_argument('--first', type=str, help='Subject on the left side of the operator') args=parser.parse_args() f1=torch.load(os.path.expanduser(args.first)) #First is the file to be...
[ "torch.max", "torch.min", "torch.mean", "torch.sum" ]
0.3.1
mpaloni/pioneer
c49efa2e071307b2534ca2abe7560f57683d2d9e