sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
462e77cb9589d8e61895e9f4e5e9307f9e583eac536b2b26710fb384642a3a26
Python
14,168
292
import torch from torch import nn from models.UNet import setup_unet from models.perception_loss import vgg16_feat, perceptual_loss from util.util import grayimg from .base_model import BaseModel from . import networks from parse_config import ConfigParser import parse_config class FslModel(BaseModel): """ This ...
9963f03f099ebf13b23f36d5f8aa673e13d2fd7edf44dc601eefbb713cb5971d
Python
14,198
366
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 26 11:31:09 2021 @author: baris """ import seaborn as sns, numpy as np import matplotlib.pyplot as plt from grid_short_traj import grid_maker, grid_population, draw_traj from rate_n_phase_code_gra import rate2dist, _direction, interp, inhom_poiss f...
eff8c8b242e831b3241e8b49b7e3f572485049cdf6b5eca9191dcc9b412d4e0f
Python
14,215
318
"""CPU-only autograd and observable-state contracts of geometry continuation.""" from types import MethodType import pytest import torch from aimnet.modules import aev_inference def _reference(left, right): return torch.bmm(left, right), right def _jets(loss, inputs, directions): first = torch.autograd.g...
c16ef04bd471dc4d6ea1cae57982891670949bd9117ad209750bc88622539454
Python
14,240
305
''' * Copyright (c) 2022, salesforce.com, inc. * All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause * By Junnan Li * Based on timm code base * https://github.com/rwightman/pytorch-image-models...
4ed36de9e5a727131f476cc7d77d890d9106d1664996d7f681bbd0ea68a0c759
Python
14,277
356
#!usr/bin/env python #coding:utf-8 """ @author: Haidong Zhang @contact: haidong_zhang14@yahoo.com @time: 2020/12/10 15:59 @project: MalariaDetection @description: """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import os i...
bb4a02933a433eb89f6176209f11aa47b7e17b527dcb91970583244a36f7fe78
Python
14,278
391
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to run monocular and binocular targeted photoreceptor experiments. @author: jtm """ import os import os.path as op import shutil import glob from time import sleep import pickle import pandas as pd import parallel from pyplr.pupil import PupilCore from pyplr....
63c7ebacd0b178a90fd8f156ed5f7f16cdc302bef09b49022a3489632b3bcdaa
Python
14,291
462
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 8 13:09:42 2021 @author: baris """ import seaborn as sns, numpy as np import matplotlib.pyplot as plt import glob import pandas as pd from scipy.stats import pearsonr, spearmanr import os from elephant import spike_train_generation as stg from neo...
62403f9a8af53ba586eb1765d194b2301173b1c9a77651281c7b9f7b4e8ed7c8
Python
14,298
332
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Apr 29 16:13:50 2022 @author: baris """ import pickle import numpy as np import seaborn as sns import pandas as pd from phase_to_rate.figure_functions import (_make_cmap, _precession_spikes, _adjust_box_widths, f5_load_dat...
16acf4c4d3c8fcf9a92b0e7f8f8c7131fb4992c5c58d2579c8eb20bb1d6653a4
Python
14,334
381
# Copyright (c) OpenMMLab. All rights reserved. import warnings import mmcv import torch import torch.nn.functional as F from mmcv.image import imwrite from mmcv.utils.misc import deprecated_api_warning from mmcv.visualization.image import imshow from mmpose.core.evaluation import get_group_preds from mmpose.core.vis...
6462c4e13a496d3d2d7b3aefc6e027a6ef1af76df75b7b53f15de9873fd404ca
Python
14,336
335
# Copyright (c) OpenMMLab. All rights reserved. # Modified from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/datasets/cityscapes.py # noqa # and https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/evaluation/evalInstanceLevelSemanticLabeling.py # noqa import glob im...
58cb179f59993718a275ef74f3cefa9e5227f3221d4936246ef2c92927211177
Python
14,354
310
import argparse import glob import json import os import shutil from pathlib import Path import numpy as np import torch import yaml from tqdm import tqdm from models.experimental import attempt_load from utils.datasets import create_dataloader from utils.general import ( coco80_to_coco91_class, check_dataset, ch...
2be9629b1afefca47fc56f76fda7c436ea2339c6fb9c14d936e08bbea0e5415f
Python
14,367
393
import csv import re import numpy as np import torch import torch.nn as nn import os, sys import json import glob import pandas as pd from scipy.stats import zscore, sem import random from torch.utils.data import Dataset, DataLoader import torch.optim as optim from sklearn.metrics import confusion_matrix, classificatio...
196c60abe5f78c2ea1cb4611a84a0b547dc6fe20d8a652355f5d116fb64c6de1
Python
14,392
455
"""Warp-based neighbor list ops with PyTorch custom op integration. Provides brute-force and cell-list neighbor pair computation using NVIDIA Warp kernels, with torch.library.custom_op registration, fake/meta implementations for torch.compile, and autograd support via the shared PyTorch backward in neighbor_utils. """...
abfe5b4c9b97da50bf7d30dce7fa2aa2d0bfa9df7ac1d511cd1b6262d5562e89
Python
14,425
343
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 12 17:36:38 2021 @author: baris """ import seaborn as sns, numpy as np import matplotlib.pyplot as plt from grid_short_traj import grid_maker, grid_population, draw_traj from scipy import interpolate from skimage.measure import profile_line from el...
bca37a7aa8cf990ea435d161fe7e2ddc899cd2e4f48c6ff120ebe7d9f8097c8b
Python
14,428
343
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 12 17:36:38 2021 @author: baris """ import seaborn as sns, numpy as np import matplotlib.pyplot as plt from grid_short_traj import grid_maker, grid_population, draw_traj from scipy import interpolate from skimage.measure import profile_line from el...
37c42b0906691d92dc457fb99c6b752de4e7d8ad93da7c4dddafddd5cc430ece
Python
14,463
441
import torch import torch.nn as nn from torch.utils.model_zoo import load_url as load_state_dict_from_url def get_model_urls(): model_urls = { "resnet18": "https://download.pytorch.org/models/resnet18-5c106cde.pth", "resnet34": "https://download.pytorch.org/models/resnet34-333f7ec4.pth", "...
26fc39f8362a6426b67344b19cf9886f38e384aa2097844e5365763ab5449d19
Python
14,510
380
import numpy as np import pandas as pd import math import os from glob import glob import json import matplotlib.pyplot as plt from scipy.integrate import simps def load_zz_results(trial_path): try: filepath = glob(trial_path + '/results*')[0] except (FileNotFoundError, NotADirectoryError, IndexError)...
a1845556f40bfb1ff95d3cd4ba639ab9c653dffeb4578bbdb0514816f46cca25
Python
14,525
409
from .classification import available_classifiers import matplotlib.pyplot as plt import sklearn.decomposition from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler from mlxtend.feature_selection import SequentialFeatureSelector as SFS from mlxtend.plotting import plot_se...
6008703b43e67a1f1f06b76cefc276890966b02817a7d9c9eac1566b1d9b63a6
Python
14,561
388
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from random import randint import numpy as np import pandas as pd from sklearn.svm import SVR from sklearn.feature_selection import RFE from sklearn.metrics import mean_squared_error from statsmodels.formula.api import ols # Compute excitation/inhibition ratio # ExcInh_I...
710b3ad4a372e776e24f5873346b0c6641b73bbb34811488ba5e04c742bc2d6c
Python
14,580
336
import sys if "../" not in sys.path: sys.path.append("../") import numpy as np import pandas as pd from os import path from scipy import stats from tqdm import tqdm import pickle import glob import random from eye_tracking.eye_tracking import get_direction_moved, get_stim_at_frame from helpers.parallel_process import...
adcebd9da7a896e77e9552f028b6abe677213a1fb9dc2682d0be53e55026f5f4
Python
14,586
391
import os import pandas as pd from torch.utils.data import Dataset from sklearn.preprocessing import StandardScaler from utils.timefeatures import time_features import warnings warnings.filterwarnings('ignore') class Dataset_ETT_hour(Dataset): def __init__(self, root_path, flag='train', size=None, ...
17a861f2598f77726ecd3371b1d410bd48981bb7d9d329b406f000fddaa7a8f1
Python
14,593
329
import argparse import glob import json import os import shutil from pathlib import Path import numpy as np import torch import yaml from tqdm import tqdm from models.experimental import attempt_load from utils.datasets import create_dataloader from utils.general import ( coco80_to_coco91_class, check_dataset, ch...
fac543e102821d147bd2359f19e1c0585fd13cd691f1d308df204d5bfe97f6b2
Python
14,596
375
from collections import Counter from itertools import combinations from multiprocessing import cpu_count, Pool import numpy as np from h5py import File from scipy.spatial.distance import pdist from consts import * from tfspline import spline_linear_model from util import path_check # TODO: Gammas class? class Gene...
58427bdd5ea46f92f89452282b57c4d549aa50025acd1188b09faa604d45bd50
Python
14,607
388
import numpy as np import matplotlib.pyplot as plt import matplotlib from .constants import SPEED_OF_SOUND, FS, MIN_AREA, MIN_WIDTH, MIN_TOLERANCE, LOC_MODEL_THRESHOLD, MAX_NUM, SPOT_POWER_THRESHOLD1, MAX_BIG_PATCH, USE_RELATIVE_SPOT_POWER, MIN_WIDTH_REQUIRED from .utils import write_audio_file from sep.Traditional_SP....
0f593ea73f333d8985febeb389a32aa250e2f244c2bdd40d69710f268596f95e
Python
14,611
430
#! /usr/bin/env libtbx.python # -*- coding: utf-8 -*- # ============================================================================= # Created at: # EMBL Hamburg # Author: # Grzegorz Chojnowski - gchojnowski@gmail.com # ============================================================================= ## @file restraint...
f6a8b0a1914a7c77cad78508f391fb6422c1e3602c2b73c2ba9f81bf13c68d5d
Python
14,652
463
# -*- coding: utf-8 -*- """ Created on Tue Aug 18 15:14:22 2020 @author: 78257 """ import os import numpy as np import cv2 from PIL import Image import scipy.io as scio import scipy.signal as signal import math display_height = 1080 display_weight = 1080 #2160 # def ResizeWithAspectRatio(image, width=None, heigh...
c621c8e648c91255d11f46a2953364db4b94d7623ce9141837424c42e07b59a3
Python
14,659
355
import numpy as np import random import joblib import multiprocessing as mp from typing import List, Tuple from collections import defaultdict from copy import deepcopy from .particle import Particle from .. import base as pea2_base def removeParticleFeatures( particles: list, mask: np....
f7b9f15619b99f5678c5bcd9f24affd26099b6e64e1536d06672a7eb82937b01
Python
14,674
387
# -*- coding: utf-8 -*- """Unet-baed HiFi-GAN Modules. This code is based on https://github.com/jik876/hifi-gan. """ import logging import numpy as np import torch from parallel_wavegan.layers import CausalConv1d, CausalConvTranspose1d from parallel_wavegan.layers import HiFiGANResidualBlock as ResidualBlock from...
123cdaf50b3a7da86d9f138256ed187b1148170a29ea740b51402d103eb7482f
Python
14,687
319
def FiPhoEpocAveraging_between_events(inputs): """ Fiber Photometry Epoch Averaging Example This example goes through fiber photometry analysis using techniques such as data smoothing, bleach detrending, and z-score analysis. <br> The epoch averaging was done using `epoc_filter`. ...
aa22acb301d9ed903eee27121ccb7031b2dd9e55843b0ed2f071c965e4368a3b
Python
14,699
499
from typing import Callable, TypeVar, Any, Union, Optional, Sequence, List, Tuple, Dict from typing_extensions import final, overload from abc import ABC, abstractmethod from collections.abc import Iterable import eagerpy as ep from ..models import Model from ..criteria import Criterion from ..criteria import Misclas...
c0d7a6d26359a98532859cbf60b183a88c85ffaa605e484a1b6e683446ce4e8f
Python
14,708
371
import collections import tempfile import pathlib import unittest import zipfile from .._checksum_validator import ( diff_checksums, md5sum_directory, md5sum, from_checksum_format, validate_checksums, ChecksumDiff, ValidationCode, ) from .test_parse import TEST_DATA from .testing_utilities import ( generat...
0ecbedf34e419acae9f9c6de3de75176bb8fc11d8eec2988a3189e879746f403
Python
14,714
366
import random import numpy as np from deap import algorithms from deap import tools from deap.benchmarks.tools import hypervolume from . import base as pea2_base from . import validation as pea2_valid from . import report as pea2_report def run(alg: pea2_base.BaseWrapper, type: str = 'eaSimple', verbose: ...
58f34250e7b57a7d7f8bf99ed4a7203be23b59cb1819003ddccc4c807d6d9ff2
Python
14,721
411
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import warnings from collections import OrderedDict, defaultdict import json_tricks as json import numpy as np from mmcv import Config, deprecated_api_warning from xtcocotools.cocoeval import COCOeval from ....core.post_processing i...
a254d97f92d7cb6dc53045837ae035c5c7dc92ef3077f320d76cf0d9d8873f7b
Python
14,737
379
# Copyright (c) OpenMMLab. All rights reserved. import bisect import collections import copy import math from collections import defaultdict import numpy as np from mmcv.utils import build_from_cfg, print_log from torch.utils.data.dataset import ConcatDataset as _ConcatDataset from .builder import DATASETS, PIPELINES...
cfba577f9382601079fe5dcec93e245965678c0afc04d2f7a612d097e9b1313a
Python
14,741
361
from random import choice, sample, random from numpy.random import beta, negative_binomial, binomial import numpy as np import sys import argparse def write_options(f, options): f.write("# prefix = %s\n" % options.prefix) f.write("# num_tests = %d\n" % options.num_tests) f.write("# num_inds = %d\n" % opt...
74b7da5cdf548973e5ed12045c3570a70f5a722ac408144bb0fa28b7cdc35575
Python
14,772
360
# Copyright (c) OpenMMLab. All rights reserved. from abc import ABCMeta, abstractmethod from collections import OrderedDict import mmcv import numpy as np import torch import torch.distributed as dist from mmcv.runner import BaseModule, auto_fp16 from mmdet.core.visualization import imshow_det_bboxes class BaseDete...
27081b4b451071b14d6fb011ea2859579518ae32ae54a194bf1266334da85b0e
Python
14,780
286
from typing import Optional, Type import jax import jax.numpy as jnp import numpy as np from functools import partial, cache import utils from flax import linen as nn import transformer_flax as transformer from transformer_flax import translate_config from einshape import jax_einshape as einshape import jax.tree_util a...
acce58add3f8a6cef578af83a59344ef7c93e927dc0917fc1956aac674639f40
Python
14,791
357
# Copyright (c) OpenMMLab. All rights reserved. import warnings import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmcv.runner import force_fp32 from mmdet.core import (build_assigner, build_bbox_coder, build_pr...
f766b3721d1eaf78bed8ec3521f99ea83149931b0a59770ca04360580c9ec012
Python
14,796
403
# Copyright (c) OpenMMLab. All rights reserved. import warnings import mmcv import numpy as np from mmcv.utils.misc import deprecated_api_warning from mmpose.core import imshow_bboxes, imshow_keypoints, imshow_keypoints_3d from .. import builder from ..builder import POSENETS from .base import BasePose try: from...
46ab15c057e7d9cd1172d88adb472b4b0916d817af77f7f76f2bf5c777d1675b
Python
14,805
392
import torch class SymEigB(torch.autograd.Function): """Solves standard eigenvalue problems for real symmetric matrices, and applies conditional or Lorentzian broadening to the eigenvalues during backpropagation to increase gradient stability. Notes ----- Results from backward passes through e...
7fa48d69c9534b438270844dc65185630203c41a24013626b58cb6da8b5864f1
Python
14,811
305
from GUI_and_data_processing.Data_processing import analyse_Ethovision_data import pandas as pd import numpy as np from tdt import StructType from copy import deepcopy import os def find_event_names_between_events(inputs): # Define a list of all possible event names. if inputs['Type'] == 'Other'...
2876e93d69fdae5030a0b4981f83a448d7ca500c1ce5fa886e82215d52477510
Python
14,818
439
import textwrap from argparse import ( ArgumentParser, SUPPRESS, RawDescriptionHelpFormatter, ) from .helpers import SeqType from .files import FileFormat from .modes import AmbiguityHandling, StopCodonMode, TrimmingMode from .version import __version__ _MAIN_DESCRIPTION_TEMPLATE = r"""\ _____ _ _ ...
c934191009c91ca7922479cb167640151ff4905f60444419b8661026437ba759
Python
14,835
427
# This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed # under the Apache License Version 2.0, see <https://www.apache.org/licenses/> import pyro import pyro.distributions as dist import pytest import torch from pyro.infer import MCMC, NUTS from pyro.infer.predictive import Predictive fr...
325915aab77ada270427c27d9bfe2035bd6eb7d7ed8f264da38c623da0299220
Python
14,878
335
#[Super SloMo] ##High Quality Estimation of Multiple Intermediate Frames for Video Interpolation import argparse import torch import torchvision import torchvision.transforms as transforms import torch.optim as optim import torch.nn as nn import torch.nn.functional as F import model import dataloader from math import...
a02e106e430947a47b13c1ea939024335b3f3652db48527569e1e8d18eff19c3
Python
14,879
399
import threading from collections import OrderedDict from random import Random from typing import Dict, Iterator, List, Optional, Union, Tuple import numpy as np from torch.utils.data import DataLoader, Dataset, Sampler from rdkit import Chem from .features import BatchMolGraph, MolGraph from .chemprop_rdkit import m...
bc371fefc0d109420ab5107680d7cb2d0522be2093abcf0054e879a7e419e126
Python
14,882
377
import logging import torch.utils.data as data import torch import numpy as np import h5py import os from .data_utility import init_transform, count_samples, build_pairs from fedml_api.Dist_FID.fid_score import get_activations logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) def ge...
10cfd683953f089f5fb7c9f0eb53f34965df4ce452d191568a136922ae8933dd
Python
14,916
374
# -*- coding: UTF-8 -* import numpy as np import tensorflow as tf import scipy.sparse as sp from sklearn.decomposition import PCA from utils import graph_to_adj #import tensorflow.compat.v1 as tf #tf.disable_v2_behavior() ############################################### # This section of code adapted from jiongqianlian...
5d7d257cbba4a63410f08283818f22804797692f5c6898fb0fedb1c22c0ac4f6
Python
14,947
371
import tensorflow as tf from . import agc # need to dynamically handle which Optimizer class to use dependent on tf version opt = tf.keras.optimizers.Optimizer if int(tf.version.VERSION.split(".")[1]) > 10: opt = tf.keras.optimizers.legacy.Optimizer # https://stackoverflow.com/a/66524901 # https://keras.io/guid...
d57d89089363771c213607d708a9fbba9d42bc3c04dbf13bfcad07f08217c314
Python
14,960
336
import numpy as np import nengo from nengo.dists import Uniform from nengo.spa.action_objects import Symbol, Source, Convolution from nengo.spa.module import Module from nengo.utils.compat import iteritems class Thalamus(Module): """A thalamus, implementing the effects for an associated basal ganglia. See ...
fe3e9be38f30a4f2771ebf64198310d153cdd2781166330f713872780776e9a9
Python
14,966
442
# This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed # under the Apache License Version 2.0, see <https://www.apache.org/licenses/> """Tests for how the factory functions construct per-model configs. The factories span a whole family, so their named arguments cover settings a given mo...
02d21b18536dfcded893877aeaa440bebb308e8f6826e741d0c326649da98216
Python
14,973
351
from optparse import OptionParser import random import numpy as np import pandas as pd random.seed(8) import os import sys from Bio import SeqIO from tensorflow.keras import backend as K import time from tqdm import tqdm import subprocess def IOU(box1,box2,size1,size2): pi1,len1,n1 = box1 pi...
8b7f20e1b71e29d1063167356b24fa6b63e503b6c0b1245907bf3c721f074605
Python
14,975
376
import os import pandas as pd import numpy as np import pickle import seaborn as sns import matplotlib.pyplot as plt import traceback from utils.import_data import load_suite2p_outputs from utils.calcium_traces import get_pos_x, get_pos_y, plot_cells_side, plot_cells_group from utils.ref_pos import addRefPos output_p...
c02a81afdebd942a0a2d239337e9bbea3a19fbaf0f021f52122d20c64fe88e5c
Python
14,979
316
import os import torch import torchvision from torch import nn from models.UNet import setup_unet from models.perception_loss import vgg16_feat, perceptual_loss from util.util import grayimg from .base_model import BaseModel from . import networks from parse_config import ConfigParser import parse_config class Fsl3d...
7547cc0004109efd23fbd2e6850f60656374c66fbb0be680d76fe0e63a3f497e
Python
15,046
377
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Dec 10 15:15:14 2020 @author: baris """ import seaborn as sns, numpy as np import matplotlib.pyplot as plt import os from rate_n_phase_code_gra import phase_code, overall_spike_ct import time import copy from neuron import h, gui # gui necessary for s...
214d72a9203a703e1929055d110ebf5c06d9df955d76137c8a3675d36575f75c
Python
15,059
408
# coding: utf-8 """Helper script for generating config file and parameters list. This script generates LightGBM/src/io/config_auto.cpp file with list of all parameters, aliases table and other routines along with parameters description in LightGBM/docs/Parameters.rst file from the information in LightGBM/include/Light...
89ba3c38f9f90a3cfc6c169552f55e03631428334c3f4e0a1cce6cc9782dbf2c
Python
15,070
367
# Copyright (c) OpenMMLab. All rights reserved. import math from collections import defaultdict import torch import torch.nn as nn import torch.nn.functional as F from ..builder import HEADS, build_loss def _sigmoid(x): y = torch.clamp(x.sigmoid_(), min=1e-4, max=1 - 1e-4) return y @HEADS.register_module(...
608d88f2e6d346396896a3cc66d2b5172cad213562538bf92b3a87d27ae463b3
Python
15,072
376
import re import numpy as np import itk from datetime import datetime from usqc.phantom import Phantom import usqc.phantom as ph from usqc.util import extract_slice, bounded_extract_image, box_to_region, overlay from pathlib import Path from usqc.data import get_files from glob import glob import matplotlib.pyplot as p...
c3f7b8e4407e734b60a8d2e7e72d5f365f65d3b5f48c1ddcf8b95f6b83aade1c
Python
15,073
444
#!/usr/bin/env python3 """ImHex language tool. Manages translations and validates lang keys against C/C++ source code. Run with --help to see available subcommands. Terminology: - langdir: a folder containing language JSON files (e.g. plugins/builtin/romfs/lang/) - lang: a language (en_US, fr_FR..) - sublang: a langua...
da9ac44625e4fd4cdf24575d3746b1a25591ef7bd381f1ca647fbedfb3c10229
Python
15,077
414
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import numpy as np import torch from mmpose.core import bbox_xywh2xyxy, bbox_xyxy2xywh from mmpose.datasets.builder import PIPELINES @PIPELINES.register_module() class CropValidClip: """Generate the clip from complete video with valid frames. Requi...
cde55feb0350a3cf2a48fb88841e5a88839b4fbffbc4f6cb4990cedc79b7c034
Python
15,096
434
# This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed # under the Apache License Version 2.0, see <https://www.apache.org/licenses/> from functools import partial import pytest import torch from pytest_harvest import ResultsBag from sbi.inference import FMPE, MNLE, NLE, NPE, NPE_PFN, ...
5bf020ad49444a311828d1d30619a3210f57a3d1b6c2ad755de609679348ee41
Python
15,112
428
from typing import Union import numpy as np import matplotlib.pyplot as plt import matplotlib import pandas as pd import plotly.graph_objects as go def subgraph_sankey( df: pd.DataFrame, final_node: str = 0, val_col="value", cmap_name="coolwarm", root_id: int = 0, ): """ Create a Sankey di...
14ceffb307b4e052e2ce674138e2a0081d6e40f32755bb3ba300b929297dc583
Python
15,147
473
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 12 17:40:05 2020 @author: bariskuru """ import seaborn as sns, numpy as np import matplotlib.pyplot as plt from grid_short_traj import grid_maker, grid_population, draw_traj from scipy import interpolate from skimage.measure import profile_line from...
0870135c9aa73f8613518a5af0667c998528193262e5f9c8ee305e3227d310ab
Python
15,152
371
# Copyright (c) OpenMMLab. All rights reserved. from os.path import dirname, exists, join from unittest.mock import Mock import pytest from mmdet.core import BitmapMasks, PolygonMasks from mmdet.datasets.builder import DATASETS from mmdet.datasets.utils import NumClassCheckHook def _get_config_directory(): """F...
1766d37460a095ed5d2831bec9a5d7b6486275694b8c17f36776f9b3c33c22d7
Python
15,155
332
# -*- coding: utf-8 -*- """ Created on Mon Jun 7 18:49:29 2021 @author: fhu14 """ #%% Imports, definitions import numpy as np Array = np.ndarray import torch Tensor = torch.Tensor import math from typing import List, Dict #%% Code behind ''' This adaptation for the penalties comes from solver.py which is a part of ...
d92b176f63785ea5d98423e51c43b4c3603574e0b477b4b55dcf7d6905319381
Python
15,162
377
#! /usr/bin/env python import ok import hashlib import logging import struct import threading custom_waveform_index_range = range(1, 4) custom_waveform_div_range = range(1, 32) custom_waveform_max_len = 0x7fff class Waveform: pass class SquareWaveform(Waveform): def __init__(self, mode=0, amp=0., pw=0., ...
686eed723ff3803234eff9e0d7d9af0a0be220e4b247b93a278069dfdf81f68c
Python
15,190
317
# -*- coding: utf-8 -*- """ Created on Wed Jun 9 13:08:28 2021 @author: fhu14 """ #%% Imports, definitions from typing import List, Dict, Tuple from DFTBLayer import DFTBList, graph_generation, model_loss_initialization,\ model_range_correction, feed_generation from DFTBrepulsive import compute_gammas from Input...
a1f1df55436ff1219395c7f1ae2f83619121304c8d7318489e7226eb120b97cd
Python
15,204
368
# -*- coding: utf-8 -*- """ Created on Wed Oct 12 13:38:23 2022 @author: Daniel """ from phase_to_rate.neural_coding import load_spikes, rate_n_phase, load_spikes_DMK import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import os import sys import matplotlib as mpl import pdb i...
d18dfc0c26a2a15a3a6d03ec02f35482300f6cbbcbd2c4d8e927b4d15519a71a
Python
15,222
387
# Copyright (c) OpenMMLab. All rights reserved. import argparse import copy import os import os.path as osp import mmcv import torch from mmcv import DictAction from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmcv.runner import (get_dist_info, init_dist, load_checkpoint, ...
b39f2b4e902a18e24fa8c715b248fb2a3e75bf394c09193f3dfddf8baa8ca9d8
Python
15,286
361
import argparse import glob import json import os import shutil from pathlib import Path import numpy as np import torch import yaml from tqdm import tqdm from models.experimental import attempt_load from utils.datasets import create_dataloader from utils.general_draw import ( coco80_to_coco91_class, check_datase...
1aedc08076f1482ed3350be9fc0ec22c1ce55eff9a96b2839035390541a11668
Python
15,296
352
"""Stress training through the built-in SizeGroupedDataset loader (#138).""" import copy import numpy as np import pytest pytestmark = pytest.mark.train torch = pytest.importorskip("torch") pytest.importorskip("ignite") OmegaConf = pytest.importorskip("omegaconf").OmegaConf def _model_config(outputs_extra: dict |...
fba27896005c4f958fcd16e2d6c7abbd4e1787bdb67e8566472f725a144bc9a9
Python
15,341
420
from typing import Optional import torch from torch import nn import torch.nn.functional as F from torch_geometric.nn import MessagePassing from torch_cluster import radius_graph import warnings import math from typing import Optional, List, Tuple from torch_geometric.utils import to_dense_adj from torch.distributions....
10f1aa9b567361200d3df6f42e0a4eb241bf7cc3df2f65f3bd6e33a891428f03
Python
15,357
366
#!/usr/bin/env python2 #encoding: UTF-8 import json import sys;sys.path.append('./') import zipfile import re import sys import os import codecs import importlib from StringIO import StringIO def print_help(): sys.stdout.write('Usage: python %s.py -g=<gtFile> -s=<submFile> [-o=<outputFolder> -p=<jsonParams>]' %sys...
3098242e8243c6e32768e2cb1c830b2c060ea1f93c25978a09f8c45360745db1
Python
15,358
444
import os import shutil import glob import math from tqdm import tqdm import collections import random from collections import OrderedDict import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from torch.nn.modules.batchnorm import _BatchNorm f...
443fae8cee619ba2700de616bbefb4851645af0fe74468c8abe06ffbe0af9449
Python
15,386
532
""" ----------------------------------------------------------- Created: Nadine Eichhorn (28.08.2022) Institute of Biomedical Engineering Karlsruhe Institute of Technology ------------------------------------------------------------- The code combines separately synthesized P and Qrst waves into an...
86ccb1548ea29a2e1768a17f0c112cb5e63b66833f504cd2b2b9904781af0b35
Python
15,400
275
import numpy as np import tensorflow as tf from absl import flags try: FLAGS = flags.FLAGS tf_rng_seq = tf.random.Generator.from_seed(FLAGS.seed + 1234) print("tf_rng_seq from FLAGS, seed = {}".format(FLAGS.seed + 1234), flush = True) except: tf_rng_seq = tf.random.Generator.from_seed(1234) print("tf_rng_seq...
02d05079d0689902ec9ffe6fc49fba75652a83727ecae5435d3db030fb735eb3
Python
15,446
417
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import warnings from collections import OrderedDict, defaultdict import mmcv import numpy as np from mmcv import Config, deprecated_api_warning from mmpose.core.evaluation import (keypoint_3d_auc, keypoint_3d_pck, ...
37f6462e3a4afc0ad1057069d6f73a920a6f58d8b5f4fa2f163f394868695fcc
Python
15,446
392
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org # Distributed under the MIT License. # (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT) import hashlib import h5py import os import torch as pt from torchmdnet.datasets.memdataset import MemmappedDataset fro...
eb66eb2cdf739652f8ffc0d71d3b52899dcf6fbdbd4d852a7dcd6be39ced98aa
Python
15,446
456
# Copyright (c) OpenMMLab. All rights reserved. import copy import pytest from mmcv import Config from numpy.testing import assert_almost_equal from mmpose.datasets import DATASETS from tests.utils.data_utils import convert_db_to_output def test_OneHand10K_dataset(): dataset = 'OneHand10KDataset' dataset_in...
960bf5ba25b7e648ba5abf5ae4d9f61b086076975c2359d74f57ada4b0a75dc3
Python
15,467
296
import numpy as np import tensorflow as tf from tensorflow.keras.optimizers import Adam from tensorflow.keras.layers import Add from tensorflow.keras.regularizers import l2 from tensorflow.keras import backend as K dicc_size={0:1000,1:3000,2:2000,3:2000,4:1000,5:1000} def YOLO_domain(optimizador=Adam,lr=0...
375c86fa4d673b8f9767b1d22afc1e08988dfe547470b16b7b64015a72a5b78f
Python
15,477
336
# Copyright (c) OpenMMLab. All rights reserved. import torch from ..builder import BBOX_ASSIGNERS from ..iou_calculators import build_iou_calculator from .assign_result import AssignResult from .base_assigner import BaseAssigner def scale_boxes(bboxes, scale): """Expand an array of boxes by a given scale. A...
20f89432192c773516b6f8570f8250dce53314fe645c4d2a99b909898d2d9b31
Python
15,524
505
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 20 10:50:07 2021 @author: baris """ import numpy as np import random from scipy import ndimage from scipy.stats import skewnorm from skimage.measure import profile_line from scipy import interpolate from neo.core import AnalogSignal import quantit...
d736739050437136681b0191cc48b36e8339b78c840d5ebd137285ab7bf32f4a
Python
15,537
436
import h5py import numpy as np from multiprocessing import pool import os import torch from skimage.transform import resize from skimage.metrics import mean_squared_error, normalized_root_mse from PIL import Image np.random.seed(123) def mr_normalization(img, bd_low=0.1, bd_up=99.9, mean_i=None, std_i=None): #...
0297d9e1e733484cfaf88a2fbbab58125b765c0d79a2bf29c864cb813dd336d1
Python
15,570
314
import argparse import logging import os import random import sys import numpy as np import torch import wandb sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../"))) from fedml_api.data_preprocessing.cifar10.data_loader import load_partition_data_cifar10 from fedml_api.data_preprocessing.cifar10...
ac4ae0d07ab5f461b46b948725ae03a259edf68025d85c4d0d7ca0afaf93a65a
Python
15,579
363
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule from mmcv.runner import BaseModule from mmdet.models.builder import HEADS, build_loss @HEADS.register_module() class GridHead(BaseModule): def __i...
319f1cb9c8f7ebaf2babc0a5e9ec4b24057f7d07e73bd3ef2dbc10185a9b7868
Python
15,580
423
# This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed # under the Apache License Version 2.0, see <https://www.apache.org/licenses/> import inspect from dataclasses import FrozenInstanceError import pytest import torch from torch import nn from sbi.neural_nets import likelihood_nn fro...
6ca9508806d7b74041cea4cfc5613f937593810dc35c58d6b7256a88e3548317
Python
15,583
338
import numpy as np import pandas as pd import pytest from sklearn.linear_model import LinearRegression, LogisticRegression from doubleml.double_ml_framework import DoubleMLCore, DoubleMLFramework, concat from doubleml.irm.datasets import make_irm_data from doubleml.irm.irm import DoubleMLIRM from ._utils import gener...
b2a3685b252d686a32e498bf86320e729654f06b6e542c09bc1699d26a812ab4
Python
15,596
387
import os import shutil from dataclasses import dataclass, field import cv2 import pathlib import numpy as np import umap import matplotlib.pyplot as plt from scipy.cluster.hierarchy import dendrogram, linkage, fcluster import pandas as pd from types import SimpleNamespace from havoc_clustering_v2.general_utility.ai.t...
9a9333a2be74f31ee873ed55cdfc37e7cc3cb585f76867daccb1ecd0c98ade4d
Python
15,599
469
""" This script defines several transforms that can be used for multiple images. Most of the transforms are based on the code of torchvision. These transforms are useful when input and label are both images. Some of the transforms only change the image but keep the label unchanged, e.g. Normalize. While others will ch...
3a617c5215bff865362826a60eeebcb8bcd1b2cce2c4dbae0ff908bdcb6f2c89
Python
15,600
423
# Copyright (c) OpenMMLab. All rights reserved. import warnings import mmcv import torch from mmcv.image import imwrite from mmcv.utils.misc import deprecated_api_warning from mmcv.visualization.image import imshow from mmpose.core.evaluation import (aggregate_scale, aggregate_stage_flip, ...
e0297464b26a01cd7be2a31cad61ab71009d65f2e462ec32c90595b032058a79
Python
15,610
313
import torch from torch import nn from models.UNet import setup_unet from models.perception_loss import vgg16_feat, perceptual_loss from util.util import grayimg from .base_model import BaseModel from . import networks from parse_config import ConfigParser import parse_config class Dadgan3chSinglemodModel(BaseModel)...
061c7ede86f874d30168d33cb3b86f2c967ba5e8740897b870b68965ac724d8f
Python
15,618
372
import os.path import random import sys import cv2 import h5py import numpy as np import scipy.ndimage as ndimage from PIL import Image import torchvision.transforms.functional as F from pytictoc import TicToc from data.base_dataset import BaseDataset, get_params, get_transform from util.util import window_image de...
f6adc41a4a2899e9bdaec7c3c5b6a797e9643bfd2f3215180f61fe7bc12e131d
Python
15,627
407
# Copyright (c) OpenMMLab. All rights reserved. import logging import time from abc import ABCMeta, abstractmethod from dataclasses import dataclass from threading import Thread from typing import Callable, Dict, List, Optional, Tuple, Union from mmcv.utils.misc import is_method_overridden from mmpose.utils import St...
49296021bdd643326494c72c7f53d209307a5702575bd0a135cd5a1cd29a8e05
Python
15,637
402
import random import numbers import torch import torchvision from torchvision.transforms import functional as F from scipy.ndimage import zoom import numpy as np from PIL import ImageFilter import math import torch from torch import Tensor class Compose(object): """Composes several transforms together. Args: ...
9441c29ee9881fc7bb35bfe62ef9ccc012d018c94b6e8106bd2091b705842d88
Python
15,694
312
import argparse import logging import os import random import socket import sys import datetime import numpy as np import psutil import setproctitle import torch import wandb import yaml # add the FedML root directory to the python path sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../"))) from...
f341fedb4eabfa00a921f64eeb5a4054bb1239e5ddab17c35a04e75877b330cc
Python
15,703
351
from rdkit import Chem from datetime import datetime from collections import defaultdict import numpy as np import pandas as pd import pickle # from pandas.core.common import SettingWithCopyWarning from pandas.errors import SettingWithCopyWarning import warnings warnings.simplefilter(action="ignore", category=Setting...
10f77e5c339f3c29482fe314af9e592314fefd5c1e875f536a29f3005bedba71
Python
15,709
245
import sys import os import argparse import logging import pytorch_lightning as pl from pytorch_lightning.callbacks import EarlyStopping from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint from pytorch_lightning.callbacks import StochasticWeightAveraging from pytorch_lightning.loggers import CSVLog...
13e4a0ec203e8cbb318d35bd49f194287eb7c62f35d301d85ede9e1455c14795
Python
15,714
474
# Copyright (c) OpenMMLab. All rights reserved. import math import warnings import mmcv import torch import torch.nn as nn from mmdet.core import bbox_overlaps from ..builder import LOSSES from .utils import weighted_loss @mmcv.jit(derivate=True, coderize=True) @weighted_loss def iou_loss(pred, target, linear=False...
dc401111d49badfb5dbb156e0fc04a562717180d186577192b70305d82ec2b94
Python
15,735
441
# Copyright (c) OpenMMLab. All rights reserved. import cv2 import mmcv import numpy as np import torch from mmpose.core.visualization.image import imshow_mesh_3d from mmpose.models.misc.discriminator import SMPLDiscriminator from .. import builder from ..builder import POSENETS from .base import BasePose def set_req...
e4f071ee059bedcfa94e53b2db8ac658d0abd7a4d251a88e3b5d55ef1142ac99
Python
15,738
379
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org # Distributed under the MIT License. # (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT) from collections import defaultdict import torch from torch.optim import AdamW from torch.optim.lr_scheduler import Red...
3c30ed822d11654516351f3abcf93be2eaf237bfe0be5843f11ef02b0989837d
Python
15,762
360
import torch import tensorflow as tf import os os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false' tf.config.set_visible_devices([], device_type='GPU') from pprint import pprint import jax.numpy as jnp import jax.tree_util as tree import numpy as np from functools import partial import haiku as hk import optax impor...