sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
67ef7148191b2a31df4c5b2d5099f3e038b4fc642dcd6cde0e1db414b74654e9
Python
5,733
178
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv.cnn import ConvModule from mmcv.runner import BaseModule, ModuleList from mmdet.models.backbones.resnet import Bottleneck from mmdet.models.builder import HEADS from .bbox_head import BBoxHead class BasicResBlock(BaseModule): """Basi...
bb6d310c39380754ddbaadd88d2ea0f171f2dbb739a9b76ec9af813b7af88198
Python
5,737
111
import pandas as pd import numpy as np from matplotlib import pyplot as plt pd.set_option('display.max_columns', None) pd.set_option('display.max_rows', None) pd.set_option('display.expand_frame_repr', False) csv_in = r'V:\foodsec\Projects\SNYF\stable_input_data\SO\Gu\Tuning_data\SOGu_STATS' # csv_in = r'V:\foodsec\P...
a6c36194c25ff9123f042cbbb056d666f128acd6f10985e2746b53cee62752f3
Python
5,742
160
# 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 os import os.path as osp from typing import Callable, List, Optional import numpy as np import torch from torch_...
11db8a9d16ed054168418624b77431f2ba5c1c39191689b48b2e392bb1f42b7d
Python
5,743
241
"""Tranform classes to process data. Data generator objects can apply these transforms to data upon loading. """ import numpy as np __all__ = [ 'Compose', 'Transform', 'BlockShuffle', 'MakeOneHot', 'MotionEnergy', 'Unitize', 'ZScore' ] class Compose(object): """Composes several tra...
49ec69a1b9893c065598c81797f31ebd8e56ec9d26b05daa6c58948a45215db2
Python
5,743
155
# -*- coding: utf-8 -*- """ Scheme Extractor ====== This module contains SchemeExtractor - the main extractor used to process chemical reaction schemes. for RGroup resolution author: Damian Wilary email: dmw51@cam.ac.uk """ from pathlib import Path import matplotlib.pyplot as plt from utils.vectorised import estima...
b23d97eef38dc119524b8707c7c3175e1b6b1095113b8204f55ef57f073d572e
Python
5,745
196
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] checkpoint_config = dict(interval=20) evaluation = dict(interval=20, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=0.001, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config =...
2d94d50ea93e5b90da21464331acb0b8f4b92ce941f5054bcb6805021ed4773a
Python
5,746
196
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] checkpoint_config = dict(interval=20) evaluation = dict(interval=20, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=0.001, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config =...
367ad9dd2c1934eb2f77a3bf834894496ad5e44a06542b0f7bde389c6826e00a
Python
5,748
151
import numpy as np import torch import torch.nn.functional as F from collections import OrderedDict from torch import nn from torch import Tensor from einops import rearrange from einops import reduce from torch.utils.data import Dataset import torch import random from rdkit import Chem from rdkit.Chem import AllC...
d38ffb7a3d39cff271c5ae06c512b46927306ca1279309021f5927bab2baccb4
Python
5,750
195
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/aic.py' ] checkpoint_config = dict(interval=50) evaluation = dict(interval=50, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=0.0015, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config =...
831a066d793d583cba49e27fb7deb83c05e118136f2e25ee785b67e393559ca8
Python
5,754
195
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/crowdpose.py' ] checkpoint_config = dict(interval=20) evaluation = dict(interval=20, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=0.001, ) optimizer_config = dict(grad_clip=None) # learning policy lr_con...
b7a60771f905c2c3e99de1f2e8c3196be93de3b9eb9bd2905411d854337d2e6a
Python
5,756
141
import cv2 import os import numpy as np import xml.dom.minidom from xml.dom.minidom import Document import sys stdi, stdo, stde = sys.stdin, sys.stdout, sys.stderr def custombasename(fullname): return os.path.basename(os.path.splitext(fullname)[0]) def GetFileFromThisRootDir(dir, ext=None...
c1b8d74f70a87700dc763cfc2c7009627f989121a11890f58ad82e5ec7eb57fb
Python
5,756
205
from PyQt5 import QtOpenGL, QtWidgets, QtCore import sys import signal import moderngl import numpy as np import os.path from argparse import ArgumentParser from flystim.square import SquareProgram class SpotProgram: def __init__(self, color=1.0): self.color = color def initialize(self, ctx): ...
9a3a7531289e38cba15c9f676ee0c2b3a12d47235bbe1d1673b10181c47b6d87
Python
5,758
142
# training surv-based network with resnet model # Created: 5/21/2021 # Status: OK # Consider merge into 1 main file # CUBLAS_WORKSPACE_CONFIG=:4096:8 python res_main.py # import torch.nn as nn import sys import torch import numpy as np import pandas as pd sys.path.insert(1, '../plot/') from networks import CNN_Surv_Wr...
ece4ab617cc88099993f7f24b829a852bf0da5895213e1dbf9fed75af026656b
Python
5,760
195
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/crowdpose.py' ] checkpoint_config = dict(interval=20) evaluation = dict(interval=20, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=0.001, ) optimizer_config = dict(grad_clip=None) # learning policy lr_con...
157b74a38a3d9fb5720e29a3e92938af8bdb7c78d80363526540543ec8f731c7
Python
5,764
191
# -*- coding: utf-8 -*- from __future__ import print_function import os import os.path import torch.utils.data as data import torchvision.transforms as transforms import h5py import numpy as np class DatasetHDF5(data.Dataset): def __init__(self, hdf5fn, t, transform=None, target_transform=None): """ ...
91d65570ec284a433b8fb4cb240cc44833385f01a56a6577ac2b27efb30f7c01
Python
5,767
115
import logging import traceback import time from fedml_api.distributed.fedseg.message_define import MyMessage from fedml_api.distributed.fedseg.utils import transform_tensor_to_list from fedml_core.distributed.communication.message import Message from fedml_core.distributed.server.server_manager import ServerManager ...
a77c3d957bf9bb6d5a9761ebb65eb1fe2e8fa71e3eb95960ea3b52525e3be399
Python
5,767
166
# Acquired from https://github.com/pytorch/vision/tree/master/references/detection import math import pathlib import sys import time import numpy as np import torch import torchvision.models.detection.mask_rcnn from . import process, utils from .coco_eval import CocoEvaluator from .coco_utils import get_coco_api_from...
8b025eb3c4552f843c50eb16d9647b5409b21a1e080d5a3274b24fb1f5319477
Python
5,776
125
"""Static dense input preparation and CUDA replay of the shared calculator computation.""" from __future__ import annotations import weakref import torch from torch import nn from ._capture import warm_up def check_dense_model(model): if not hasattr(model, "forward_prepared"): raise NotImplementedErro...
41fd2540c4a6e17431db1d2e9fd630773077a617f2ae3fb5769cf508a8089859
Python
5,779
127
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmdet.core.bbox.coder import (DeltaXYWHBBoxCoder, DistancePointBBoxCoder, TBLRBBoxCoder, YOLOBBoxCoder) def test_yolo_bbox_coder(): coder = YOLOBBoxCoder() bboxes = torch.Tensor([[-42., -29., 74...
ca7de7d62c3ddd0697dea91cc57328cd7eaa7df3023e3aa8310d60d353701f88
Python
5,790
154
# Copyright (c) OpenMMLab. All rights reserved. import copy import warnings import numpy as np import torch from mmcv import ConfigDict from mmcv.ops import nms from ..bbox import bbox_mapping_back def merge_aug_proposals(aug_proposals, img_metas, cfg): """Merge augmented proposals (multiscale, flip, etc.) ...
907eabbc1dc6f6fc101c73669871926a3cc0aaf8f02e5e109568fb4924e1792c
Python
5,791
159
"""Temporal MLP model implemented in PyTorch.""" import numpy as np from sklearn.metrics import accuracy_score import torch from torch import nn from daart.models.base import BaseModel, get_activation_func_from_str # to ignore imports for sphix-autoapidoc __all__ = ['TemporalMLP'] class TemporalMLP(BaseModel): ...
2879079a0840a598ae39d74a9134bdf0a4773f66200ba678d3d7e0d5f50f235b
Python
5,796
156
# 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 __future__ import annotations from typing import Callable, Union import pytest import torch from torch.distributions import ( Categorical, ...
ae9254dd954a3c099a69eb79cb623ba86a6dbc38c56f20909c9934dd55f8e7e3
Python
5,803
193
import gzip import textwrap from pathlib import Path from typing import List from genomad import utils from numba import njit class Sequence: def __init__(self, header: str, seq: str, compress: bool = False) -> None: self._compress = compress self._header = header if self._compress: ...
5d1f5956032cc3c9419733da4d78b5151e0d68f5f06ce6971598ec96b2b07bb8
Python
5,822
147
# -*- coding: utf-8 -*- """ Created on Mon May 30 17:01:07 2022 @author: fhu14 """ """ Module that handles the required precomputations for the different datasets that have been generated """ #%% Imports, definitions from InputParser import parse_input_dictionaries, collapse_to_master_settings, inflate_to_dict impo...
9e68ad81704c7d029d97eb2fdda8dfde44cf67572a4450d663d81a5e80988a18
Python
5,822
158
"""test_recurrent_layers.py This file is part of the test suite for keras2c Implements tests for recurrent layers """ #!/usr/bin/env python3 import unittest import tensorflow.keras as keras from keras2c import keras2c_main import subprocess import time import os from test_core_layers import build_and_run import tenso...
7237e3ba052e7b3b6db846c02e2f776d7e82ac08e68c7ea7b819ed30a71f863e
Python
5,823
198
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/aic.py' ] checkpoint_config = dict(interval=50) evaluation = dict(interval=50, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=0.0015, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config =...
d9b1d9078801e239dab257169b940ffcdd4c4611af364c77596ae6b8721ca952
Python
5,825
165
# 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 h5py import numpy as np import os import torch as pt from torch_geometric.data import Data from torchmdnet.datas...
1ecbab4f1b4ea471a84961cf37d10c0a8f3e75cb10d43543376d9eddfb072757
Python
5,827
216
import numpy as np import scipy as sp def reshape_dims(M,dims=None): num_dim = np.ndim(M) if num_dim ==3: M1r= M.reshape((np.prod(dims[:2]),dims[2]),order='F') elif num_dim ==2: M1r = M.reshape(dims,order='F') return M1r def remove_trend(Y_rm,detrend_option='linear'): ...
2bb4abf9d6768aed862e75e3ebf353ea5eaf8618c579aa69d0be6a45db1d4af2
Python
5,839
133
from jax.config import config config.update("jax_enable_x64", True) import jax.numpy as jnp import jax import numpy as np import matplotlib.pyplot as plt from weno_solver import generate_weno_scalar_sol, generate_weno_euler_sol import utils def test_weno_burgers(b): xs = jnp.linspace(0.0, 1.0, 100, endpoint=False) ...
76944c73211ecae36b0d08f37e91713685dc1c031525febe0e1345025e1e575a
Python
5,856
191
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 10 17:13:01 2020 @author: baris """ import torch from torch.autograd import Variable import torch.nn as nn from torch import optim import seaborn as sns, numpy as np import matplotlib.pyplot as plt import os from rate_n_phase_codes import phase_co...
ce2def6905943cc5f7d0da2a48bfeefa83ed3403e6b2307b27eacc2601e3b3a2
Python
5,857
152
from os.path import join from tqdm import tqdm import torch from torch.utils.data import Subset from torch_geometric.loader import DataLoader from pytorch_lightning import LightningDataModule from pytorch_lightning.utilities import rank_zero_warn from torchmdnet import datasets from torchmdnet.utils import make_splits,...
dbc056e41f3dd61a4cf4a8c36d52313c63e3dbc872057fe3a49f6463fb524865
Python
5,859
107
import sklearn.metrics as metrics import numpy as np def mean_error_nan(y_true, y_pred): y_true = np.array(y_true) y_pred = np.array(y_pred) nas = np.logical_or(np.isnan(y_true), np.isnan(y_pred)) #2021-4-30 nan treatement added return np.mean(np.array(y_pred[~nas]) - np.array(y_true[~nas])) ...
b0453a48725da5934667a4b05b1347639d805681cf6de702636d55c7b1e8e3c7
Python
5,863
177
import glob import numpy as np import scipy import torch from scipy.signal import resample_poly from sklearn.preprocessing import RobustScaler from anysleep_no_hydra import AnySleep def load_mat_dir(mat_dir: str, channels_to_include, resample_rate): mat_glob = glob.glob(f"{mat_dir}/*.mat") total_dict = {} ...
05317bcabdf56d03c150b342b61cc58857188368e4edca7e1f3e40087d5c7df2
Python
5,865
173
# -*- coding: utf-8 -*- from matplotlib import pyplot as plt from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA from sklearn.decomposition import PCA import numpy as np import pandas as pd import pickle from PolyBox import PolyBox import warnings warnings.filterwarnings("ignore") flag_3D = Tr...
d625f20b3e259261616b3c7b0da599cac938ff3e05b6e014053e66aafc084515
Python
5,870
190
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.nn.parameter import Parameter import math import utils import argparse import data_loader from ipdb import set_trace from sklearn import metrics SEQ_LEN = 48 def binary_cros...
9c51115c5c63834cab4d6c42e95cd4a3f8e3e35e7d8517d63d9117260ed2a120
Python
5,873
135
# -*- coding: utf-8 -*- """ Created on Tue Aug 31 14:29:32 2021 @author: Anandita """ import numpy as np ''' This file contains: Different tuning curves for neurons whose response can be described by a 1d ' latent variable. Neural responses which can be described by a product of 1d respon...
84346b65163f3615cf67a6d3d654533498beeb7faf6b64cce4037269a07979c4
Python
5,874
107
#!usr/bin/env python #coding:utf-8 """ @author: Haidong Zhang @contact: haidong_zhang14@yahoo.com @time: 2021/1/9 15:28 @project: MalariaDetection @description: """ from keras.layers import * #For adding convolutional layer from keras.layers import Dense, ZeroPadding2D, BatchNormalization, Activation ...
dd57f1c97583c131e709d8989b2fcdd720c99f58adf74fa45c4ecadcdf2c82cd
Python
5,874
163
import copy import torch from torch_geometric.data import Data from torch_geometric.utils import to_dense_adj, dense_to_sparse from torch_sparse import coalesce from torchmdnet.datasets.geom_utils import utils class AddHigherOrderEdges(object): def __init__(self, order, num_types=len(utils.BOND_TYPES)): ...
1c62fab48cad05191003fbcc93dfd30cf66ce48adb4cc1146c7a9749228d9ef8
Python
5,885
159
"Modified from https://github.com/pytorch/vision/blob/master/torchvision/models/vgg.py" import torch import torch.nn as nn __all__ = [ 'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn', 'vgg19_bn', 'vgg19', ] class VGG(nn.Module): def __init__( self, features: nn.Mod...
2e82e06be83cebae8d6dd3bc0ebbe02a90696ff5ea1498574b5f4858e12f23bb
Python
5,885
135
import os, torch, warnings, numpy as np, pandas as pd import torch.nn as nn, torch.nn.functional as F from torch.utils.data import Dataset, DataLoader from transformers import AutoTokenizer, AutoModel, logging from sklearn.metrics import roc_auc_score, average_precision_score from sklearn.model_selection import train_t...
c49d17e5f7c7281370e9c2bade155cc1e80a6ae16fdd17917973d565ecbc1cbb
Python
5,886
153
## Acquired from https://github.com/pytorch/vision/tree/master/references/detection import math import sys import time import torch import numpy as np import torchvision.models.detection.mask_rcnn from .coco_utils import get_coco_api_from_dataset from . import utils from .coco_eval import CocoEvaluator from . import p...
4bfeb7f3fb1c28df868c22e1a8c545f45abdad2a00f20bdf389da8942f235a80
Python
5,888
155
import os import os.path as osp import json import numpy as np import pandas as pd from tqdm import tqdm import torch from torch_geometric.data import Data, DataLoader from ..graphconv import GraphConvNetwork, predict from ..config import utils_section, params_section from ..data import load_data_from_smiles # u...
1818acddb0ecb6fea48ddf4fa8961a46c6312cbe34c8458244c72409b7328df9
Python
5,890
143
import numpy as np from .plane_alignment_functions import plane_alignment from .depth_estimation import calculate_brain_center_depths def calculate_brain_center_coordinate(section, atlas_shape, axis): """ Calculates the coordinate closest to the middle of the section as defined by the two dimensio...
b9ea78f3acf2f736a48db00b8721b6429a25d34391e353dabcbdcb0dfd0e7b4b
Python
5,890
162
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import pytest import torch from mmdet.core.bbox import distance2bbox from mmdet.core.mask.structures import BitmapMasks, PolygonMasks from mmdet.core.utils import (center_of_mass, filter_scores_and_topk, flip_tensor, mask2...
64ac60bb99c7d596137dd668c2c0f7b852f81a78fdf312b2dc99a2b3c15a5c58
Python
5,894
206
"""io_parsing.py This file is part of keras2c Copyright 2020 Rory Conlin Licensed under LGPLv3 https://github.com/f0uriest/keras2c Helper functions to get input and output names for each layer etc. """ from .backend import keras __author__ = "Rory Conlin" __copyright__ = "Copyright 2020, Rory Conlin" __license__ = "M...
a91eae177c600801c8ddba692cee6091d223e8e68d246ced91c1de0f9a18edfc
Python
5,894
140
# Author: Akshara Balachandra / Michael Romano # Date: 02-19-23 # Description: Revisions #2 import os from typing import Dict, Tuple import multiprocessing as mp import pandas as pd import json from process_parcellations.cat12reader import Cat12Reader from process_parcellations.make_imaging_sheet import uniq_rids wi...
4c25c0d5c31efe9c7e51465dd2ec7c1c8541432292d48b47f71baed13c77937a
Python
5,900
136
import argparse import math import os import pandas as pd import numpy as np import torch from torch.utils.data import DataLoader from nets.classification import CleftNet, CleftSegNet from loaders.cleft_dataset import CleftDataset, CleftSegDataset from transforms.volumetric import CleftEvalTransforms, CleftSegEvalT...
cad44e7ab553108c48fc3321504bed4c3f0912a4d6804b80977086cbae4054f1
Python
5,906
200
# coding: utf-8 # In[2]: # IMPORT STATEMENTS import cv2 import re import numpy as np from scipy import stats import matplotlib matplotlib.use('agg') from matplotlib import pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable, axes_size from mpl_toolkits.axes_grid1 import SubplotDivider, Size from mp...
77e2eaa055655d62da5bbbf4f245ea8e09040c79a40c1b93d2cb42eee1e067a2
Python
5,907
115
import os import pwinput import girder_client # Names of the environment variables read by GirderSink to authenticate. The # actual secret values are never passed around as nipype traits (which would # get pickled to disk in node caches / crash files): they are only ever read # from the current process' environment...
87d4750f4da167bca84aba3348646d177ee2948a72a7c8cf8a9d54c88d96daf9
Python
5,908
143
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from mmcv.parallel import MODULE_WRAPPERS as MMCV_MODULE_WRAPPERS from mmcv.parallel import MMDistributedDataParallel from mmcv.parallel.scatter_gather import scatter_kwargs from mmcv.utils import Registry from torch.cuda._utils import _...
8c2d78065dd627af42116d4d51a8cdc54a90dbcab4ec1420baab98033de7d77b
Python
5,909
167
# Copyright (c) OpenMMLab. All rights reserved. from typing import Dict, List, Optional, Union import cv2 import numpy as np from mmcv import color_val from ..node import Node from ..registry import NODES try: import psutil psutil_proc = psutil.Process() except (ImportError, ModuleNotFoundError): psutil_...
ef23e12bedaed3bac715c1c7171a386329e8cfdb1c76323a82bdea1e7e96b404
Python
5,920
176
import glob from pathlib import Path import mne import numpy as np import torch from scipy.signal import resample_poly from sklearn.preprocessing import RobustScaler from anysleep_no_hydra import AnySleep def load_edf(input_file: str, channels_to_include, resample_rate): """ Load and preprocess an EDF file ...
aa2b73e9f0520b8f41884d2c68d317c0787910cf7b7c1be7670ccb2e6447cb40
Python
5,922
143
# coding=utf-8 # Copyright 2018 The OpenAI Team Authors and 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 copy of the License...
b6cc80c04dcc290f1ed31996d70dd0294f2d78b97bef192b0a1a5e774c156846
Python
5,941
165
# Copyright (c) OpenMMLab. All rights reserved. import argparse import warnings import numpy as np import torch from mmpose.apis import init_pose_model try: import onnx import onnxruntime as rt except ImportError as e: raise ImportError(f'Please install onnx and onnxruntime first. {e}') try: from mm...
2a77c0dd9c8c4b674b69e38ece4e16f663babcdd8f8dda3998c61d6ba1065403
Python
5,948
200
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config import os import sys from collections import OrderedDict # -- Path setup -...
a1971f051ea9287dfe665dfba6d2e527e5bd3a1f3da58e911e60e3b183ee8ee1
Python
5,949
152
import torch import torch.nn as nn import copy import numpy as np from scipy.io import mmread from scipy.io import mmwrite from sys import getsizeof # user specificed dataset name vector used to train autoencoder and impute datasets = ['jurkat', 'monocyte','mbrain','pbmc','lymphoma','293t','bmmc','human_mix',...
c3c01739c27b1202f74149654d870c7a4a44ab336a511e10add935b4a96fa17c
Python
5,952
144
import argparse import logging import os import sys import numpy as np import setproctitle import torch import torch.nn as nn sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../"))) from fedml_api.data_preprocessing.cifar100.data_loader import load_partition_data_distributed_cifar100 from fedml_a...
26174c27abf8d9cb475a822148568629a4c6bedae5aed15c59b635d0309ae105
Python
5,959
123
import nengo import nengo.spa as spa import numpy as np from nengo.spa.module import Module from nengo.spa.compare import Compare class CompareAccumulator(Compare): """A module for computing the dot product of two inputs, now including: a) cleanup memories before comparison b) accumulator to judge outcome...
bfe0c4f207213e11567f0e4c48ab6d4846bab1ab91875a7f76b51097f24ddff8
Python
5,959
132
# -*- coding: utf-8 -*- """ Created on Mon Jun 7 18:58:12 2021 @author: fhu14 """ #%% Imports, definitions from MasterConstants import Model, RawData from typing import List, Dict import numpy as np Array = np.ndarray import torch Tensor = torch.Tensor from Spline import get_dftb_vals #%% Code behind class Input_la...
11f29b79ed61bf668b40294847d15d1aea883f8290197a5eeaacc44136fc6823
Python
5,970
144
import csv import numpy as np from sklearn.cluster import KMeans class DataLoader(object): def __init__(self, data_name, data_path, client_list, sample_num_in_total, beta): # SUSY, Room Occupancy; self.data_name = data_name self.data_path = data_path self.client_list = client_list...
3a468bbd14592e594f4807818bb8496944aa8e5c242f554b3f9d5ba8e8a14419
Python
5,973
196
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='AdamW', lr=5e-4, betas=(0.9, 0.999), weight_decay=0.01, paramwise_cfg=dict( custom_keys={'relative_positi...
6d792d375e022fd713b62ea87fa9c7a9ecd52b7b4ba7e635d60cc18ccca7147d
Python
5,973
196
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='AdamW', lr=5e-4, betas=(0.9, 0.999), weight_decay=0.01, paramwise_cfg=dict( custom_keys={'relative_positi...
29d722c36a660e691982c1bac27518529862ac917cfbe05f84935c12deac3f9f
Python
5,974
196
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='AdamW', lr=5e-4, betas=(0.9, 0.999), weight_decay=0.01, paramwise_cfg=dict( custom_keys={'relative_positi...
74256d5f803dfcdd4dfe34fea45430179bdb1ed26374f9c32f6aea96a84a0b02
Python
5,974
196
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='AdamW', lr=5e-4, betas=(0.9, 0.999), weight_decay=0.01, paramwise_cfg=dict( custom_keys={'relative_positi...
2aa41e9ec10de7abb43aeb1adcaaa905cfe0a5394e1259c5ca9693427f49dba6
Python
5,981
178
import glob from pathlib import Path import mne import numpy as np import torch from scipy.signal import resample_poly from sklearn.preprocessing import RobustScaler from anysleep_no_hydra import AnySleep def load_edf(input_file: str, channels_to_include, resample_rate): """ Load and preprocess an EDF file ...
9e6b8b41e80fd9512fac04224b11b2995ffa43f5af413adcbc87b2b998122600
Python
5,982
228
import numpy as np from scipy import stats as spstats def syn_current(duration=120, dt=0.01, t_on=10, curr_level=5e-4, seed=None): duration = duration t_off = duration - t_on t = np.arange(0, duration + dt, dt) # external current A_soma = np.pi * ((70.0 * 1e-4) ** 2) # cm2 I_inj = np.zeros_l...
554be0e59cbba3fce9d41fcf7f9f052fb2c765eaa7d4a2a0eda783186dfa1279
Python
5,986
124
import sys import os # runtype is overwritten when called by manager_50_ope or manager_30 runType = 'fast_tuning' # ['tuning', 'fast_tuning', 'opeForecast'] # Minutes to wait for asking condor_q time_step_check = 60 # metric for best model selection metric = 'RMSE_val' # ml models to rerun after fust tuning (obsrvati...
fa0ca4e2fb8a9ee6aa6acc8a1f3f7017f94c9b75b9afe687e170ebcc0933ad3e
Python
5,989
143
# Copyright (c) OpenMMLab. All rights reserved. from typing import List, Union from unittest import TestCase import numpy as np from mmcv import is_list_of from mmpose.core.post_processing.smoother import Smoother class TestSmoother(TestCase): def build_smoother(self): smoother = Smoother( ...
39862b276ae6be21a181772dfd2ec2623244adb7beb637ab97c3f6c2827242b1
Python
5,994
146
import argparse import os from pathlib import Path # from typing import Dict, List from typing import List import matplotlib.pyplot as plt import numpy as np import seaborn as sns import torch import xgboost as xgb from selbstaufsicht.models.xgb import xgb_utils def save_contact_maps(preds: np.ndarray, msa_mapping...
a2d7a468f7cc4d5a2fefd05f67bc83ffe7582a52b7ad18886fe77b22bdc5692a
Python
5,995
159
# Copyright (c) OpenMMLab. All rights reserved. from functools import partial import mmcv import numpy as np import torch from mmcv.runner import load_checkpoint def generate_inputs_and_wrap_model(config_path, checkpoint_path, input_config, ...
bb36c03dd658f02cc424f593db26075fc3750a9bc13a38270810b95176802548
Python
5,995
134
# Copyright (c) OpenMMLab. All rights reserved. import torch from ..builder import BBOX_ASSIGNERS from .assign_result import AssignResult from .base_assigner import BaseAssigner @BBOX_ASSIGNERS.register_module() class PointAssigner(BaseAssigner): """Assign a corresponding gt bbox or background to each point. ...
6b34e363edc14925f09188864100e813e6fde4597e5446fd01b3a510ba297640
Python
6,005
140
import os import sys import time import signal import logging import numpy as np from sklearn.metrics import confusion_matrix import metstab_shap.grid as grid from metstab_shap.config import utils_section, csv_section, metrics_section, force_classification_metrics_section from metstab_shap.config import parse_model_co...
c0e648ed4c985af5df8a69a94c27b58dccf0139e06582848a71979d70fa807a3
Python
6,005
155
import os import re import time from multiprocessing import cpu_count import numpy as np from h5py import File from consts import CUTOFFS, HARTREE from dataset import Dataset from dftb_calc import dftb_calc from dftb_parse import dftb_parse from model import RepulsiveModel from options import Options from skf import ...
faa7eaeb17220d292d9302106843370c124ca9f9187296f7ddd0d4d7e8a8973f
Python
6,009
254
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 27 17:13:07 2020 @author: baris """ gra_spikes = gra_spikes_diff[0] f=10 n_phase_bins=360 dur_ms=500 dur_s = dur_ms/1000 T = 1/f time_bin_size = T times = np.arange(0, dur_s+time_bin_size, time_bin_size) n_time_bins = int(dur_s/T) def mean_phase(s...
0ffd24a521f85dd66639e273cdcde97020caf2482dfb2f8104881fd4ac296e4b
Python
6,017
161
"""Test cluster-based sample splitting for scalar PLR models.""" import numpy as np import pytest from sklearn.ensemble import RandomForestRegressor from sklearn.linear_model import LinearRegression from doubleml import DoubleMLData from doubleml.plm.datasets import make_plr_CCDDHNR2018 from doubleml.plm.plr_scalar i...
f1bd3451bb4e6d575b9f42aaa95faaf50a995325e85db8b443fc3ced1e598a49
Python
6,018
137
from torch.utils.data import Dataset, DataLoader import pandas as pd import numpy as np import SimpleITK as sitk from PIL import Image import nrrd import os import sys import torch from torch import nn from torch.nn.utils.rnn import pad_sequence import pytorch_lightning as pl class CleftDataset(Dataset): def __i...
03509b1e900caa458584ec9d71a49304e1dde70e2f8f56b3f44eb4afdc499764
Python
6,019
157
# Copyright (c) 2020-present Joindbre.com # Authors: Patricia Maraver. # # This program is free software: you can redistribute it and/or modify # it under the GNU Affero General Public License version 3 # as published by the Free Software Foundation. # You should have received a copy of the Server Side Public Lic...
1866ab1407ba8c0756d06f8da40063160817b3fa9f017859c6abec0ea36edbc8
Python
6,020
190
import numpy as np import pytest import random from Bio.Align import MultipleSeqAlignment from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from clipkit.modes import StopCodonMode from clipkit.msa import MSA from clipkit.settings import DEFAULT_NT_GAP_CHARS def make_msa(*sequences: str) -> MSA: alignme...
f87f4f85f5bd9be6dcdc4bd99d1488b52617e86a7ff47a3b2ef80eb9b15d3c76
Python
6,022
157
import logging import torch.utils.data as data import numpy as np import h5py import os from .data_utility import init_transform, count_samples, build_pairs logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) def get_transforms(): transforms_train = ["Resize", "RandomCrop", "Rando...
2e6307f2d9a024e3987030cf987a7e2167f45ff9f3bf0048076a5af7702e46de
Python
6,026
201
# 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 typing import Optional from warnings import warn import nflows.nn.nde.made as made import numpy as np import torch import torch.nn.functional as F f...
433d6a1e5ac641de7c1fd696453ebd95d2417be9319551e6b80e735e5b48ebf6
Python
6,028
173
from enum import Enum import re import pathlib from collections import namedtuple from datetime import datetime import openslide from PIL import Image, ImageFile Image.MAX_IMAGE_PIXELS = 100000000000 ImageFile.LOAD_TRUNCATED_IMAGES = True class ImageType(Enum): # our supported image types SVS = '.svs' JP...
50e6885fbfd329ced6e3f2a2a2320f77f2935fad323d74fef76f56fda42b4219
Python
6,040
157
import logging import torch.utils.data as data import numpy as np import h5py import os from .data_utility import init_transform, count_samples, build_pairs logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) def get_transforms(): transforms_train = ["Resize", "RandomCrop", "Rando...
bdabee1ffd6cfa4196cbc7f3d40c114bbd8ac7664e91fbbc194e066aa2795107
Python
6,040
167
# ------------------------------------------------------------------------------ # Copyright and License Information # https://github.com/microsoft/voxelpose-pytorch/blob/main/lib/models # Original Licence: MIT License # ------------------------------------------------------------------------------ import torch import...
0941a74cb2dcd13dca51eca447edb5e5c714fffb0ec419d8250713a13668bda3
Python
6,044
168
# Copyright (c) OpenMMLab. All rights reserved. import pytest from mmpose.apis import (get_track_id, inference_bottom_up_pose_model, inference_top_down_pose_model, init_pose_model, vis_pose_tracking_result) from mmpose.datasets.dataset_info import DatasetInfo def tes...
664c7c09a5a60fae3d773ebda706a632701c8c363a8c403ce7d5c1659cafad0b
Python
6,047
168
#!/usr/bin/env python3 if 1: # This is needed for the SE calculation import rpy2 from rpy2.robjects.packages import importr from rpy2.robjects import FloatVector from rpy2.robjects import r importr('coda') import statistics import math import numpy # from scipy.stats import beta import sys imp...
08c54f9887f37af05b010f560b3c83f34373f105c429b440d2d010153706493e
Python
6,049
184
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 12 12:31:03 2022 @author: baris """ import matplotlib.pyplot as plt import numpy as np import grid_model import matplotlib.gridspec as gridspec from neo.core import AnalogSignal import quantities as pq from elephant import spike_train_generation a...
628d60dbbdce617c0b185d3e76ffbfe3c65ee07a54db29626511cf3962e19682
Python
6,049
129
import logging import torch from torch import nn, optim from fedml_api.distributed.fedgkt import utils class GKTClientTrainer(object): def __init__(self, client_index, local_training_data, local_test_data, local_sample_number, device, client_model, args): self.client_index = client_inde...
16aa10521d476589b345d6334d70faf7ca3a0e98e87d4ff106b7724362b0342a
Python
6,056
184
# Copyright (c) OpenMMLab. All rights reserved. import os import warnings from argparse import ArgumentParser import cv2 import mmcv from mmpose.apis import (get_track_id, inference_bottom_up_pose_model, init_pose_model, vis_pose_tracking_result) from mmpose.core import Smoother from mmpose.d...
96e4ab101ee1b152e2800a1996e4db0b25cac49ca95254d105c6acf839ef08bb
Python
6,061
245
#program for cnn import os import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from matplotlib.image import imread import cv2 %matplotlib inline import warnings warnings.filterwarnings('ignore') from tensorflow.keras.preprocessing.image import ImageDataGenerator, load_img, img...
61360765ed19db0477592748d59559bcc553b85337fa930afda927b543eb5215
Python
6,064
149
import logging import os import h5py import numpy as np import torch import torch.utils.data as data from . import utils logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) client_ids_train = None client_ids_test = None DEFAULT_TRAIN_CLIENTS_NUM = 500 DEFAULT_TEST_CLIENTS_NUM = 100 DEFA...
76683563e4279cef43598a99867038de66393690a57b6f376c3ecce484f241e3
Python
6,066
155
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from ..builder import LOSSES @LOSSES.register_module() class JointsMSELoss(nn.Module): """MSE loss for heatmaps. Args: use_target_weight (bool): Option to use weighted MSE loss. Different joint types may h...
62f4bc50b5f7b5934a680b5910755d61800d97d74f46f35bf99296c0d1e74098
Python
6,073
157
import os import logging from pathlib import Path from functools import reduce, partial from operator import getitem from datetime import datetime from tmp.logger import setup_logging from tmp.utils import read_json, write_json class ConfigParser: def __init__(self, config, resume=None, modification=None, run_id=...
b51c63940547104b9f3d73c3aed9f5f43ad769d4ddf9af7046bc34e423e8fd9b
Python
6,074
149
"""Capture-time reference ordering and reuse of the validated graph output.""" import numpy as np import pytest import torch from conftest import CAFFEINE_FILE, load_mol from aimnet.calculators import AIMNet2Calculator from aimnet.calculators.cuda_graph import dense pytestmark = [pytest.mark.gpu, pytest.mark.weights...
a1ac8e49ac80960c98a511c7c19c21c2157fdb59f140ea890d8d03485f1d7cb4
Python
6,079
131
import time from glob import glob import numpy as np import os from run_type import RunType from predict import predict_accuracy from sklearn.model_selection import train_test_split from tensorflow.keras import backend as K from tensorflow.keras import callbacks from tensorflow.keras.losses import binary_cross...
b9e59e09962fc2d63211bb4435d34b964fae477abb02a5cbbe0783d17858ddbc
Python
6,080
140
import pandas as pd import numpy as np import sys from Bio import SeqIO from multiprocess import Process, Manager import os import subprocess from tqdm import tqdm from Web_genome import download2 def renames_gff(df, original_domains): """ Esta función convierte los nombres de los dominios del gf...
5fb7f5117e758f6a646f88da9aba5b376cb771d55c3f93077ac384b3409828b3
Python
6,087
191
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from torch.nn.modules.batchnorm import _BatchNorm from mmpose.models.necks import FPN def test_fpn(): """Tests fpn.""" s = 64 in_channels = [8, 16, 32, 64] feat_sizes = [s // 2**i for i in range(4)] # [64, 32, 16, 8] out_...
8883c8fc117da61478e4dac3a79b2a11cf1356d1f4ddbb10f9eb31ac62f0e317
Python
6,087
222
import pathlib import mne from mne.io import Raw from mne.io.edf.edf import RawEDF from mne.io.base import BaseRaw try: import autoreject except ModuleNotFoundError: import h5io import sys sys.modules["mne.externals.h5io"] = h5io import autoreject import numpy as np import pandas as pd from toolz ...
1955c9f91913097e4e19b3e1d5de14a4459de0cb3e6677760591306e78f26699
Python
6,089
129
""" Shivai worflow for swomed with a dcm2nii first step and synthseg """ from nipype import Node, Workflow, IdentityInterface, DataGrabber from nipype.interfaces.dcm2nii import Dcm2niix from shivai.interfaces.shiva import (Shivai_Contained, SynthsegContained) from shivai.utils.container_config import configure_contai...
cbfec266141cf9aa94be2e107c36c130bc00e8e84a9ade13e58dd3ac95f80985
Python
6,094
160
import seaborn as sns, numpy as np import matplotlib.pyplot as plt import glob import pandas as pd data = np.load("rate_n_phase_codes_perceptron_2000ms_net-seeds_410-419.npz", allow_pickle=True) n_seeds = 10 th_grid = data['grid_th_cross'].T.reshape(6*n_seeds) th_gra = data['gra_th_cross'].T.reshape(6*n_seeds) speed...
76fb769a4d9c85b02b9602f30c75580f504806c7870ae6ff3ed78f191ada5723
Python
6,110
203
# -*- coding: utf-8 -*- # File Name : PolyBox.py # Created By : Yannis Bendi-Ouis from StimulationsCodes import * from PolyStimulations import * from openvibe import * import sys, traceback, collections from io import StringIO import re def get_label_from_stim(stim): stims_1 = list(OpenViBE_stimulation.items()) st...