version stringclasses 25
values | code stringlengths 75 178k | apis sequence | full_version stringlengths 1 6 | repo_name stringlengths 9 78 | hexsha stringlengths 40 40 |
|---|---|---|---|---|---|
1.6 | # -*- coding: utf-8 -*-
"""
@Time : 2021/1/14 下午5:34
@FileName: bert.py
@author: 王炳宁
@contact: wangbingning@sogou-inc.com
"""
import sys
import time
import apex
import torch
import torch.distributed as dist
from apex import amp
sys.path.append('..')
from modules.BERT import Bert
from train.parser import get_ar... | [
"torch.distributed.get_world_size",
"torch.eq",
"torch.distributed.init_process_group",
"torch.FloatTensor",
"torch.no_grad",
"torch.manual_seed",
"torch.cuda.set_device",
"torch.LongTensor",
"torch.tensor",
"torch.distributed.reduce",
"torch.distributed.get_rank",
"torch.distributed.barrier"
... | 1.6.0 | benywon/ComQA | 6731d63d16b731d6c3654b2dc7d2503cf333127f |
1.1 | import torch.nn as nn
from .gen_resblock import GenBlock
class Generator(nn.Module):
def __init__(self, args, activation=nn.ReLU(), n_classes=0):
super(Generator, self).__init__()
self.bottom_width = args.bottom_width
self.activation = activation
self.n_classes = n_classes
... | [
"torch.nn.Linear",
"torch.nn.Softmax",
"torch.nn.AvgPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.Tanh",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.utils.spectral_norm"
] | 1.1.0 | sudarshanregmi/ICRGAN-and-SSGAN | c9e7b01d89cba19505e566892a678932717b8039 |
1.8 | from typing import Iterable, Optional, Sequence
import numpy as np
import torch
from torch.distributions import Categorical, Normal
from torch.distributions import kl_divergence as kl
from torch.nn import functional as F
from scvi import _CONSTANTS
from scvi._compat import Literal
from scvi.module.base import LossRec... | [
"torch.distributions.Categorical",
"torch.sqrt",
"torch.distributions.Normal",
"torch.ones",
"torch.tensor",
"torch.ones_like",
"torch.zeros_like",
"torch.log",
"torch.mean"
] | 1.8.0 | jules-samaran/scvi-tools | 7dcbb819cdc6a7991469fdca6b292276c59a946d |
2.0 | #!/usr/bin/env python3
import argparse
import datetime
import os
import pickle
import pprint
import numpy as np
import torch
from torch.utils.tensorboard import SummaryWriter
from examples.atari.atari_network import QRDQN
from examples.atari.atari_wrapper import make_atari_env
from examples.offline.utils import load... | [
"torch.manual_seed",
"torch.cuda.is_available",
"torch.load",
"torch.utils.tensorboard.SummaryWriter"
] | 2.0.0 | BFAnas/tianshou | 6e86a0bed7d1117c5ad6a421b483b45a6adfe336 |
1.4 | import torch
import torch.nn as nn
import torch.nn.functional as F
from convs.dyres_conv import *
from convs.condconv import *
__all__ = ['DyResA_ResNet18']
class DyRes_BasicBlock(nn.Module):
expansion = 1
def __init__(self, in_channels, channels, stride=1, num_experts=3):
super().__init__()
... | [
"torch.nn.Linear",
"torch.nn.functional.avg_pool2d",
"torch.nn.Sequential",
"torch.nn.BatchNorm2d",
"torch.nn.Conv2d",
"torch.nn.functional.relu",
"torch.randn"
] | 1.4.0 | Nyquixt/DyConv | 255193068424aaa83352bee258d34cb8b32b6ee6 |
1.4 | import torch
import torch.nn as nn
import torch.nn.functional as F
__all__ = ['CondConv_Inf']
class route_func(nn.Module):
def __init__(self, in_channels, num_experts):
super().__init__()
self.avgpool = nn.AdaptiveAvgPool2d(1)
self.fc = nn.Linear(in_channels, num_experts)
self.sig... | [
"torch.nn.Linear",
"torch.nn.Sigmoid",
"torch.nn.AdaptiveAvgPool2d",
"torch.Tensor",
"torch.nn.functional.conv2d",
"torch.randn"
] | 1.4.0 | Nyquixt/DyConv | 255193068424aaa83352bee258d34cb8b32b6ee6 |
1.9 | import torch
import torch.nn as nn
class CosineSimilarity:
"""
Cosine similarity between the two vector.
Given two vector v1 and v2, the cosine similarity between the two vector
is the cosine of theta, where the theta is the angle between the two vector on therir inner product space.
The cosine ... | [
"torch.nn.Linear",
"torch.nn.init.xavier_normal_"
] | 1.9.1 | helloybz/CLANE | 60e6f0503642ac63d3bcde136885e47954067c17 |
1.6 | import os
from typing import Text
import torch
import unittest
import torch.nn as nn
import torch.optim as optim
from allennlp.models import Model
from allennlp.data.vocabulary import Vocabulary
from zsl_kg.class_encoders.auto_gnn import AutoGNN
from zsl_kg.example_encoders.text_encoder import TextEncoder
from zsl_kg... | [
"torch.nn.Linear",
"torch.nn.ReLU",
"torch.tensor",
"torch.load",
"torch.nn.CrossEntropyLoss"
] | 1.6.0 | BatsResearch/zsl-kg | 9bc4d4537a0f90ee3bbcefdf90ceae6dbcf48572 |
1.6 | import unittest
from zsl_kg.common.graph import NeighSampler
import torch
from allennlp.common.params import Params
from zsl_kg.knowledge_graph.conceptnet import ConceptNetKG
from zsl_kg.gnn.attention_agg import AttnAggregator
class TestAttnAggregator(unittest.TestCase):
def setUp(self) -> None:
params =... | [
"torch.tensor",
"torch.randn"
] | 1.6.0 | BatsResearch/zsl-kg | 9bc4d4537a0f90ee3bbcefdf90ceae6dbcf48572 |
1.3 | #!/h/haoran/anaconda3/bin/python
import sys
import os
sys.path.append(os.getcwd())
import pandas as pd
import numpy as np
import argparse
import Constants
import torch
import torch.nn as nn
from torch.utils import data
import pickle
from pytorch_pretrained_bert import BertTokenizer, BertModel
from run_classifier_datase... | [
"torch.nn.Linear",
"torch.nn.ModuleList",
"torch.cuda.is_available",
"torch.nn.CrossEntropyLoss",
"torch.nn.DataParallel",
"torch.nn.Softmax",
"torch.manual_seed",
"torch.utils.data.DataLoader",
"torch.nn.BCELoss",
"torch.tensor",
"torch.cuda.manual_seed_all",
"torch.cuda.device_count",
"tor... | 1.3.0 | MLforHealth/HurtfulWords | b59181585aa70152f0fbe79fa2611ded928bf9f1 |
1.4 | # Copyright (c) 2020, 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.hamming_window",
"torch.FloatTensor",
"torch.Tensor"
] | 1.4.0 | jungwook518/KoSpeech | 77b8daf2f821c8fa755e937096fdbc3536cafd81 |
1.4 | import torch
import numpy as np
from hipo_rank import Embeddings, SentenceEmbeddings, SectionEmbedding, \
PairIndices, SentenceSimilarities, SectionSimilarities, Similarities
from typing import List, Tuple
from numpy import ndarray
class CosSimilarity:
def __init__(self, threshold = 0):
self.threshol... | [
"torch.cosine_similarity",
"torch.from_numpy"
] | 1.4 | mukul-mehta/HipoRank | b44490c4f1f3e0ff8015e3eb0f2b1955947dfe80 |
1.9 | import torch
import torch.nn as nn
from vformer.functional import PatchMerging
from vformer.utils import ENCODER_REGISTRY
encoder_modules = ENCODER_REGISTRY.get_list()
def test_VanillaEncoder():
test_tensor = torch.randn(2, 65, 1024)
encoder = ENCODER_REGISTRY.get("VanillaEncoder")(
embedding_dim=1... | [
"torch.randn"
] | 1.9.0 | aditya-agrawal-30502/vformer | e1f4950f980238442ff1dc39a8f0791e4fbc9dac |
1.1 | import glob
import os
import torch
import tqdm
import time
from torch.nn.utils import clip_grad_norm_
from pcdet.utils import common_utils, commu_utils
def train_one_epoch(cur_epoch,model, optimizer, train_loader, model_func, lr_scheduler, accumulated_iter, optim_cfg,
rank, tbar, total_it_each_ep... | [
"torch.save"
] | 1.1 | Bilal-A-Qureshi/OpenPCDet | 633c6026e56fc3fb2112f2a9f7ce08a21619e78f |
1.9 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 5, 2)
self.conv2 = nn.Conv2d(32, 64, 7, 3)
self.dropout1 = nn.Dropout2d(0.25)
self.dropout2 = nn.Dropout2d(0... | [
"torch.nn.Linear",
"torch.flatten",
"torch.nn.functional.log_softmax",
"torch.nn.Conv2d",
"torch.nn.functional.relu",
"torch.nn.functional.max_pool2d",
"torch.nn.Dropout2d"
] | 1.9.0 | evanaze/captcha | 62d226742be7f4091e54a7ea960703812bd44fd5 |
1.6 | import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helpers
def pair(t):
return t if isinstance(t, tuple) else (t, t)
# classes
class PreNorm(nn.Module):
def __init__(self, dim, fn):
super().__ini... | [
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"torch.nn.Identity",
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.Softmax",
"torch.einsum",
"torch.finfo",
"torch.nn.GELU",
"torch.randn"
] | 1.6 | rocke2020/vit-pytorch | a1f828da0c952fa56a90a71f7c88c8e0025c1d42 |
1.4 | import torch
import os
import numpy as np
import cv2
from PIL import Image
from collections import defaultdict
from tqdm import tqdm
import mcubes
import open3d as o3d
from plyfile import PlyData, PlyElement
from argparse import ArgumentParser
from models.rendering import *
from models.nerf import *
from utils import... | [
"torch.cat",
"torch.norm",
"torch.FloatTensor",
"torch.zeros_like",
"torch.no_grad",
"torch.ones_like"
] | 1.4.0 | U-sepSick/NeRF | c5910f84321eb5f72e3332507b0384f1b23f51f7 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 19