version stringclasses 24
values | code stringlengths 396 135k | apis sequence | full_version stringlengths 1 6 | repo_name stringlengths 6 64 | hexsha stringlengths 40 40 |
|---|---|---|---|---|---|
1.8 | import numpy as np
import torch
from discrete_network.network import KNNet, KNNetParameters, KNNetState
from discrete_network.method.force_method import ForceParameters, ForceLearn
from discrete_network.device import device
import matplotlib.pyplot as plt
print(f"Device = {device.type}")
# params_spiking = KNNetParam... | [
"torch.rand",
"torch.sqrt",
"torch.zeros",
"torch.linalg.norm",
"torch.as_tensor",
"torch.log"
] | 1.8.2 | aw02m/Spiking_neural_networks | 4c23c50b52b15a9e5709cb672fd18cd22218b9f2 |
1.7 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
created by Halo 2020/10/28 11:28
https://tangshusen.me/Dive-into-DL-PyTorch/#/chapter03_DL-basics/3.12_weight-decay
"""
import torch
import torch.nn as nn
import numpy as np
import mytorch.d2lzh_pytorch as d2l
n_train, n_test, num_inputs = 20, 100, 200
true_w, true_b ... | [
"torch.zeros",
"torch.nn.Linear",
"torch.optim.SGD",
"torch.ones",
"torch.randn",
"torch.nn.init.normal_",
"torch.utils.data.DataLoader",
"torch.matmul",
"torch.utils.data.TensorDataset"
] | 1.7.0 | Halo1236/Dive-into-DL-PyTorch | 586b4e9ca77b2121ce5f5bec8b0a893b33f1b574 |
1.4 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from torch.nn import functional as F
from detectron2.layers import paste_masks_in_image
from detectron2.structures import Instances
def detector_postprocess(results, output_height, output_width, mask_threshold=0.5):
"""
Resize the output ... | [
"torch.nn.functional.interpolate"
] | 1.4.0 | aleSuglia/py-bottom-up-attention | a97142ad3526c11272c471ee7d610494f1247b7b |
1.0 | """Training utilities."""
import os
from typing import Any, Dict, Union
import pytorch_lightning as pl
import torch
from loguru import logger
from pytorch_lightning.callbacks.base import Callback
from pytorch_lightning.callbacks.early_stopping import EarlyStopping
from pytorch_lightning.callbacks.model_checkpoint impo... | [
"torch.cuda.is_available"
] | 1.0 | yvesnana/rxnaamapper | 48fb6a6f45f5ec087f99cedbac34eda2a65e14a3 |
1.9 | # *****************************************************************************
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions... | [
"torch.sigmoid",
"torch.cat",
"torch.nn.ConvTranspose1d",
"torch.nn.ModuleList",
"torch.nn.Conv1d",
"torch.IntTensor",
"torch.autograd.Variable",
"torch.nn.utils.remove_weight_norm",
"torch.FloatTensor",
"torch.det",
"torch.nn.functional.conv1d",
"torch.cuda.is_available",
"torch.logdet",
... | 1.9.0 | brooklynbagel/Voice-Cloning-App | 6e0034dc0b4e21f669d28753b5f30b32cca382ad |
1.8 | import warnings
from typing import Any, Dict, Optional, Type, Union
import numpy as np
import torch as th
from mod_gym.gym import spaces
from torch.nn import functional as F
from mod_stable_baselines3.stable_baselines3.common.on_policy_algorithm import OnPolicyAlgorithm
from mod_stable_baselines3.stable_baselines3.co... | [
"torch.min",
"torch.no_grad",
"torch.clamp",
"torch.nn.functional.mse_loss",
"torch.abs",
"torch.exp",
"torch.mean"
] | 1.8.1 | Practical-Formal-Methods/mod_stable_baselines3 | 08bdb0a529c8ab446ac7973f2a02f832c0c3f454 |
1.8 | # Copyright 2021 cstsunfu. 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 law or agr... | [
"torch.ones_like",
"torch.nn.init.xavier_uniform_",
"torch.randn",
"torch.einsum"
] | 1.8.2 | cstsunfu/dlkit | 69e0efd372fa5c0ae5313124d0ba1ef55b535196 |
1.8 | '''
Accelerate demo with fp16 and multi-gpu support.
Single CPU:
python accelerate_demo.py --cpu
16-bit Floating Point:
python accelerate_demo.py --fp16
Model from timm:
python accelerate_demo.py --timm
Singe-GPU:
python accelerate_demo.py
Multi-GPU or Multi-CPU:
accelerate config
accelerat... | [
"torch.nn.Linear",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"torch.no_grad",
"torch.utils.data.DataLoader",
"torch.nn.CrossEntropyLoss"
] | 1.8.0 | Cahlil-Togonon/Deep-Learning-Experiments | 501ae610b0a8fb7fb75a53dcfdab71be49274b58 |
1.3 | import platform
import pytest
import torch
from torch.utils.data.dataloader import DataLoader
from torch.utils.data.dataset import Subset
import tests.base.utils as tutils
from pytorch_lightning import Trainer
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from tests.base import EvalMode... | [
"torch.nn.ReLU",
"torch.utils.data.dataloader.DataLoader",
"torch.cuda.device_count"
] | 1.3 | binshengliu/pytorch-lightning | 8f6b7a2b4fea9b7bd0b873f5973e6364b3981412 |
0.4 | '''
Script to train the ranker
Should add some sort of image pool someday...?
'''
import time
from options.train_options import TrainOptions
from data import CreateDataLoader
from models import create_model
from util.visualizer import Visualizer
from models import networks
import pdb
import torch
from collections imp... | [
"torch.load"
] | 0.4.0 | dangeng/infiniteGANorama | 92c9cbe0638cf9fcdc05020759772e36aebf788c |
1.5 | #!/usr/bin/env python
"""
Simple implementation for mixup. The loss and onehot functions origin from: https://github.com/moskomule/mixup.pytorch
Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, David Lopez-Paz: mixup: Beyond Empirical Risk Minimization
https://arxiv.org/abs/1710.09412
"""
__all__ = [ 'mixup_cross_ent... | [
"torch.nn.functional.softmax",
"torch.sum"
] | 1.5.1 | bozliu/E2E-Keyword-Spotting | 64fc6fe414370a12a22fdf8ca5c8379d2c60b64e |
0.4 | """
A :class:`~allennlp.training.trainer.Trainer` is responsible for training a
:class:`~allennlp.models.model.Model`.
Typically you might create a configuration file specifying the model and
training parameters and then use :mod:`~allennlp.commands.train`
rather than instantiating a ``Trainer`` yourself.
"""
# pylint... | [
"torch.nn.parallel.replicate",
"torch.no_grad",
"torch.save",
"torch.nn.parallel.scatter_gather.scatter_kwargs",
"torch.tensor",
"torch.nn.parallel.parallel_apply"
] | 0.4.0 | albert-dot-ai/allennlp | 580dc8b0e2c6491d4d75b54c3b15b34b462e0c67 |
1.9 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
from typing import List, Tuple, Optional
import fastmri
import torch
import torch.nn as nn
import torch.nn.functional as F
from ... | [
"torch.zeros",
"torch.min",
"torch.argmin",
"torch.ones",
"torch.ones_like",
"torch.nn.functional.pad",
"torch.where"
] | 1.9.0 | vigsivan/fastMRI | 0f6c4c0176ff74bf2761d20ec62facb01c9038f8 |
1.13 | import csv
import decimal
import os
import threading
import time
from typing import List
import torch
import torch.distributed as dist
import torch.distributed.rpc as rpc
import torch.multiprocessing as mp
from torch.distributed import rpc
from .trpc_server import TRPCCOMMServicer
from ..base_com_manager import BaseC... | [
"torch.distributed.rpc.TensorPipeRpcBackendOptions",
"torch.multiprocessing.spawn",
"torch.distributed.rpc.ProcessGroupRpcBackendOptions",
"torch.ones",
"torch.distributed.rpc.shutdown"
] | 1.13.1 | eliaskousk/FedML | e30d5dd3cc84c8a369c828a6f6ef097b3cf67b1a |
1.3 | # General structure from https://github.com/pytorch/examples/blob/master/mnist/main.py
from __future__ import print_function
import argparse
import os
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.optim... | [
"torch.device",
"torch.flatten",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"torch.no_grad",
"torch.nn.init.kaiming_normal_",
"torch.nn.functional.log_softmax",
"torch.manual_seed",
"torch.nn.Dropout2d",
"torch.nn.functional.linear",
"torch.cuda.is_available",
"torch.nn.functional.relu",
"t... | 1.3.0 | weizhonz/hid | 3ee3aeeaf12baeadf3d85c1bb86296073bba3fbe |
1.6 | import dataclasses
import itertools
from typing import List, Optional, Tuple
import nltk
import torch
from .downloader import load_trained_model
from ..parse_base import BaseParser, BaseInputExample
from ..ptb_unescape import ptb_unescape, guess_space_after
TOKENIZER_LOOKUP = {
"en": "english",
"de": "germa... | [
"torch.cuda.is_available"
] | 1.6.0 | thomaslu2000/Incremental-Parsing-Representations | 1b0ec638e85f0e521a12b53d8b309191c40fe0d3 |
1.5 | # Copyright Contributors to the Pyro project.
# Copyright (c) 2020, YosefLab.
# SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
"""
The data preprocessing code in this script is adapted from:
https://github.com/YosefLab/scvi-tutorials/blob/50dd3269abfe0c375ec47114f2c20725a016736f/seed_labeling.ipynb
"""
import m... | [
"torch.zeros",
"torch.cat",
"torch.nn.functional.one_hot",
"torch.randperm",
"torch.from_numpy",
"torch.distributions.Poisson",
"torch.where"
] | 1.5.0 | akihironitta/pyro | 0ab6e474330942ff4ec2a87a6cc0c671943fc5cd |
1.9 | import os
import glob
import random
import cv2
import numpy as np
import torch
import matplotlib.pyplot as plt
import open3d
from skimage import io, img_as_float32
from scipy import ndimage
from torch_geometric.data import Data, DataListLoader
from torch_geometric.loader import DataLoader as GraphLevelDataLoader
from t... | [
"torch.zeros",
"torch.cat",
"torch.from_numpy",
"torch.tensor",
"torch.reshape"
] | 1.9.1 | johnpeterflynn/surface-texture-inpainting-net | b2de05eaa47c9bcca53b9aee12b6012ac2c05156 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 24