version stringclasses 21
values | code stringlengths 225 174k | apis sequence | full_version stringlengths 1 6 | repo_name stringlengths 10 107 | hexsha stringlengths 40 40 |
|---|---|---|---|---|---|
1.2 | import os
from torch.utils.data import DataLoader
from continuum.datasets import CIFAR10, InMemoryDataset
from continuum.datasets import MNIST
import torchvision
from continuum.scenarios import TransformationIncremental
import pytest
import numpy as np
from continuum.transforms.bg_swap import BackgroundSwap
DATA_PAT... | [
"torch.utils.data.DataLoader"
] | 1.2.0 | pclucas14/continuum | 09034db1371e9646ca660fd4d4df73e61bf77067 |
1.8 | """Timer class based on the timeit.Timer class, but torch aware."""
import enum
import timeit
import textwrap
from typing import Any, Callable, Dict, List, NoReturn, Optional, Type, Union
import numpy as np
import torch
from torch.utils.benchmark.utils import common, cpp_jit
from torch.utils.benchmark.utils._stubs imp... | [
"torch.cuda.synchronize",
"torch.utils.benchmark.utils.common.TaskSpec",
"torch.utils.benchmark.utils.valgrind_wrapper.timer_interface.wrapper_singleton",
"torch.utils.benchmark.utils.common.set_torch_threads",
"torch.cuda.is_available",
"torch.utils.benchmark.utils.common.Measurement",
"torch.utils.ben... | 1.8.1 | GOOGLE-M/SGC | 78ad8d02b80808302e38559e2d0f430f66a809bd |
1.1 |
from .single_stage import SingleStageDetector
from ..registry import DETECTORS
from mmdet.core import bbox2result
import torch.nn as nn
import torch
from .. import builder
import numpy as np
import cv2
from mmdet.core import bbox2roi, bbox2result, build_assigner, build_sampler
@DETECTORS.register_module
class CSP(Sin... | [
"torch.tensor"
] | 1.1 | mohammedshariqnawaz/Pedestron | 9785feb94f00e07ae24a662525b4678f12d0fdc8 |
1.0 | import torch
from torch import nn
from torch.distributions import MultivariateNormal
class Normal(nn.Module):
def __init__(self, num_vars=100):
super(Normal, self).__init__()
self.num_vars = num_vars
self.means = nn.Parameter(torch.zeros(num_vars))
self.std = nn.Parameter(torch.ey... | [
"torch.zeros",
"torch.distributions.MultivariateNormal",
"torch.eye"
] | 1.0.1 | insilicomedicine/TRIP | 5e7b9da298aa47a71c71e1144ff1d8e538dbccaa |
1.0 | import torch
import torch.nn as nn
from torch import autograd
import torch.optim as optim
from ...utils import TrainStats
class WGAN(nn.Module):
def __init__(self, gen, discr, prior, n_critic=5, gamma=1, gp=True,
device='cpu'):
super(WGAN, self).__init__()
self.gen = gen
... | [
"torch.zeros",
"torch.rand"
] | 1.0.1 | insilicomedicine/TRIP | 5e7b9da298aa47a71c71e1144ff1d8e538dbccaa |
1.8 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributions as td
class Flow(nn.Module):
"""
Building both normalizing flows and neural flows.
Example:
>>> import stribor as st
>>> torch.manual_seed(123)
>>> dim = 2
>>> flow = st.Flow(st.UnitN... | [
"torch.zeros_like",
"torch.nn.ModuleList"
] | 1.8.0 | mbilos/stribor | 76082c255653d6bd8d506519223183e5d8395578 |
1.8 | import torch
import torch.nn as nn
import torch.nn.functional as F
def diff(x, dim=-1):
"""
Inverse of x.cumsum(dim=dim).
Compute differences between subsequent elements of the tensor.
Only works on dims -1 and -2.
Args:
x (tensor): Input of arbitrary shape
Returns:
diff (tens... | [
"torch.zeros_like",
"torch.nn.functional.pad"
] | 1.8.0 | mbilos/stribor | 76082c255653d6bd8d506519223183e5d8395578 |
3 | import sys
import math
import os
import torch
import torchvision
import numpy as np
from pkg_resources import resource_stream
def interpolate1d(x, values, tangents):
'''
Returns:
Returns the interpolated or extrapolated values for each query point,
depending on whether or not the query lies w... | [
"torch.is_tensor",
"torch.square",
"torch.abs",
"torch.tensor",
"torch.as_tensor",
"torch.where"
] | 3 | jmendozais/SDSSDepth | 7a4d0c5affef3eda7056876ccb2365ac883c08eb |
1.8 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
import sys
import unittest
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
import torch.nn as nn
import torch.optim as optim
from opacus import PrivacyEngine
from opacus.distributed ... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.MSELoss",
"torch.distributed.destroy_process_group",
"torch.distributed.init_process_group",
"torch.norm",
"torch.multiprocessing.spawn",
"torch.nn.parallel.DistributedDataParallel",
"torch.cuda.device_count",
"torch.manual_seed",
"torch.nn.ReLU",
"t... | 1.8 | RQuispeC/opacus | 5c83d59fc169e93667946204f7a6859827a38ace |
1.4 | # Copyright (c) 2020 NVIDIA CORPORATION.
# Copyright (c) 2018-2020 Chris Choy (chrischoy@ai.stanford.edu).
#
# 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 wit... | [
"torch.nn.init.constant_",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"torch.no_grad",
"torch.nn.Module.__init__",
"torch.nn.functional.log_softmax",
"torch.nn.functional.cross_entropy",
"torch.cuda.empty_cache",
"torch.utils.data.DataLoader",
"torch.cuda.is_available",
"torch.zeros_like",
"t... | 1.4 | NNstorm/MinkowskiEngine | 443b37a58c379b2482b5d160d9e874b356b4bf2f |
1.4 | # Copyright (c) 2020 NVIDIA CORPORATION.
# Copyright (c) 2018-2020 Chris Choy (chrischoy@ai.stanford.edu).
#
# 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 wit... | [
"torch.rand",
"torch.IntTensor",
"torch.FloatTensor",
"torch.from_numpy",
"torch.all",
"torch.cuda.is_available"
] | 1.4 | NNstorm/MinkowskiEngine | 443b37a58c379b2482b5d160d9e874b356b4bf2f |
1.7 | # Copyright (c) Aishwarya Kamath & Nicolas Carion. Licensed under the Apache License 2.0. All Rights Reserved
"""
COCO dataset which returns image_id for evaluation.
Mostly copy-paste from https://github.com/ashkamath/mdetr/blob/main/datasets/gqa.py
"""
import json
from pathlib import Path
import torch
import torchvi... | [
"torch.utils.data.ConcatDataset",
"torch.as_tensor"
] | 1.7.0 | TopCoder2K/mdetr | aedfd63f550ae36d1477484c489a2aa438d10aa3 |
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.zeros",
"torch.unbind",
"torch.no_grad",
"torch.nn.BCEWithLogitsLoss",
"torch.log",
"torch.exp"
] | 1.6.0 | Karol-G/nnUNet | a30bdbd64254c94c515ee03617173eb217eea505 |
1.7 | import torch
from torch.optim import Optimizer
class OptimWrapper(Optimizer):
# Mixin class that defines convenient functions for writing Optimizer Wrappers
def __init__(self, optim):
self.optim = optim
def __getstate__(self):
return self.optim.__getstate__()
def __sets... | [
"torch.no_grad"
] | 1.7.1 | aknckaan/scrl | bff485e27d8785628e35d2cb73dce06f10065b1f |
1.0 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.Dropout",
"torch.stack",
"torch.from_numpy",
"torch.ones",
"torch.nn.functional.log_softmax",
"torch.full",
"torch.nn.KLDivLoss",
"torch.nn.functional.softmax",
"torch.nn.CrossEntropyLoss"
] | 1.0 | stevezheng23/fewshot_nlp_pt | aaca4658aaa48a5a45dfd7d5ee7282d7f7c74be2 |
1.0 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | [
"torch.nn.Linear",
"torch.zeros",
"torch.nn.Dropout",
"torch.nn.MSELoss",
"torch.einsum",
"torch.arange",
"torch.from_numpy",
"torch.ones",
"torch.eye",
"torch.nn.BCEWithLogitsLoss",
"torch.nn.CrossEntropyLoss"
] | 1.0 | stevezheng23/fewshot_nlp_pt | aaca4658aaa48a5a45dfd7d5ee7282d7f7c74be2 |
1.5 | import torch
import numpy as np
def get_sigmas(config):
if config.model.sigma_dist == 'geometric':
sigmas = torch.tensor(
np.exp(np.linspace(np.log(config.model.sigma_begin), np.log(config.model.sigma_end),
config.model.num_classes))).float().to(config.device)
... | [
"torch.cos",
"torch.nn.MSELoss",
"torch.sin",
"torch.no_grad",
"torch.linspace",
"torch.sign",
"torch.ones",
"torch.randn_like",
"torch.zeros_like",
"torch.transpose",
"torch.randn"
] | 1.5.0 | Sriram-Ravula/ncsnv2 | f610b59441a34063fae1c02aa06837b7eec95c03 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 28