sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9862302819a579f2e826bff4c94f2c6c6ba6d8298a8217b011fab0fa6127654f
Python
8,604
206
import numpy as np import paddle import paddle.nn as nn import paddle.nn.functional as F import pgl from pgl.nn import GraphPool from pahelix.networks.gnn_block import GIN from pahelix.networks.compound_encoder import AtomEmbedding, AtomFloatEmbedding, BondEmbedding, \ BondFloatRBF, BondAngleFloatRBF from pah...
0ea636ffcd748718bcdf6c279eb1f47c6710b96657b3a69e955404bcd23b872a
Python
8,606
241
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Tickformatstop(_BaseTraceHierarchyType): _parent_path_str = "scatterternary.m...
b690fe22b470638c18d5f8ecffdc9ac222522a0d53e20eee9d745f671cf828aa
Python
8,606
241
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Tickformatstop(_BaseTraceHierarchyType): _parent_path_str = "scatterpolargl.m...
6df4468eb25d69148a147a5ce64b6c2d4af3068efa3fac353cab1f20a2e51142
Python
8,607
237
from os.path import abspath, join, dirname import SimpleITK as sitk import numpy as np from Image import Image import gc import os class ImageRegistration(): """Docstring for ImageRegistration. Class for imageRegistration object, has the funtions and atributes the registration of MRI and CT images ...
b82d9cb6acba6908b0d886335a8d822c0b0a4a8c592692c53d628cc38ac30037
Python
8,608
235
"""Helper functions.""" import os import random import sys from typing import Dict from typing import List from typing import Tuple from typing import Union import gymnasium as gym import numpy import numpy as np import tensorflow as tf from gymnasium import spaces from gymnasium.spaces import Box from gymnasium.space...
fc58b4260ec044ce9c07cea181e475f6612434261c3834cb79c111e4bfeb614e
Python
8,612
300
import sys import argparse import logging import time callset = {1: "cuteSV", 2: "Sniflles", 3: "PBSV", 4: "SVIM"} USAGE="""\ Evaluate SV callset on NA19240 dataset """ def parseArgs(argv): parser = argparse.ArgumentParser(prog="NA19240_eval", description=USAGE, formatter_class=argparse.RawDescriptionHelpFormatter...
c60cce271be65c27e9e928f532049dbce4b20dc7ce1ea9840d7929a9baca6f82
Python
8,613
261
"""Workflows for processing volumetric anatomical data.""" from nipype import logging from nipype.interfaces import utility as niu from nipype.pipeline import engine as pe from niworkflows.engine.workflows import LiterateWorkflow as Workflow from templateflow.api import get as get_template from xcp_d import config fr...
f165ddc1da09ea94b705c7c6063c7e210acd43fb109517fbeb2e06455d0e5b5f
Python
8,614
267
# -*- coding: utf-8 -*- # # ImFun documentation build configuration file, created by # sphinx-quickstart on Mon Jul 23 13:17:03 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All c...
41db2dab06ddcac57c3467f49ef20c9ac506a9c4695f3d85320b23cfa763c09a
Python
8,615
221
"""Utility class to manage a list of filenames. Use the `add` method to add new filenames. You specify a short "alias" for them, which you can use to retrieve the full filename later: >>> fname = FileNames() >>> fname.add('my_file', '/path/to/file1') >>> fname.my_file '/path/to/file1' Filenames can also be templates th...
576f1dd37afca0c371f133bba6f52a450a87b25b329c01afb8f1785fcce14b7d
Python
8,617
199
import unittest import pickle import os import numpy as np from rdkit import Chem from rdkit.Chem import ( Atom, Bond, RingInfo) from bioconfpred.conf_ensemble import ConfEnsembleLibrary from sklearn.preprocessing import OneHotEncoder from tqdm import tqdm class MoleculeEncoders(object) : ...
02417e94cf483d62e38606b8488f15f7c0a75e3233fcee6438266d4403cff1a6
Python
8,618
225
"""Keypoint-based object detectors: CenterNet (DLA-34) and CornerNet (stacked hourglass). CenterNet -- Zhou et al., 2019, "Objects as Points", arXiv:1904.07850. Source: github.com/xingyizhou/CenterNet. DISTINCTIVE: detect objects as the CENTER POINT of their box. A DLA-34 backbone (deep layer aggregation -- iterat...
173b11c81775e019619f30ad25464581cb6472deb7de7db39c38985bdd7a5da5
Python
8,618
176
import numpy as np import pandas as pd import geopandas as gpd from datetime import datetime from operator import itemgetter from ...utils import constants from ...utils.constants import UID, DATETIME, LATITUDE, LONGITUDE, GEOLIFE_SAMPLE from ...core.trajectorydataframe import TrajDataFrame from ...core.flowdataframe i...
bc118ccf0e9f898899c9c64a565bf7209a95dbed2ac674b9ae0ec06791ce46e7
Python
8,620
208
from contextlib import AbstractContextManager from typing import List from uuid import UUID, uuid4 import sqlalchemy from dependency_injector.providers import Callable from fastapi import HTTPException from sqlalchemy import and_, func from carbonserver.api.domain.organizations import Organizations from carbonserver....
5eca2582def8ff87516f29040d720c7dce0195808ff66d1123dcc615faabe07a
Python
8,622
235
# Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved. # # Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 # International License (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://creativecommo...
c84d7d357a6f88fbb7c3b35cc030d968621545d98cec5624aef32d07cfca9958
Python
8,623
247
from pathlib import Path import importlib.util import sys import warnings import pytest import tempfile from face_rhythm import helpers, util, h5_handling, pipelines _torchcodec_skip_reason = None if sys.platform.startswith('win'): _torchcodec_skip_reason = 'torchcodec has no Windows wheels' elif importlib.util...
06fd2b1fc9732d490a96aa34431eb813bdeca4eb357f32efba4cd58a2562a840
Python
8,624
251
""" Created in March 2024 @author: Laurène David <laurene.david@ip-paris.fr> @author: Thomas Bonald <bonald@enst.fr> """ from typing import Union import numpy as np from scipy import sparse from sknetwork.clustering import BaseClustering from sknetwork.ranking import PageRank from sknetwork.clustering import get_mod...
230761a6cf1fd6512d93cde1d0b14cfae19dafe44fcd9bdf568adc2952d00580
Python
8,624
278
from array_api_compat import array_namespace as get_namespace, device import numpy as np import pytest from conftest import approx, to_backend from pyriemann.geometry.distance import distance_thompson from pyriemann.geometry.geodesic import ( geodesic, geodesic_chol, geodesic_euclid, geodesic_logchol, ...
7755fe63ef1addc1fbdb4f4037e19ccd4bae982947fc43c1768253b7ae038133
Python
8,624
227
# Copyright (c) 2025, Siyu Wang, Shengbin Di, Yuxi Chi, Johnsonms, Linfeng Zheng, Haoyan Huang, Lanbo Li, Yun Zhong, Man Yuan, Minmin Sun, Yong Li, Wei Lin. """Fused multi-head attention (FMHA) backward for the SM100 architecture using CUTE DSL. Constraints: * Supported head dimensions: 256 only * mma_tiler_mn must ...
81b55a4bbcdefab826420840ec5d6e0b761acae4ecd6776fd351619133e4aebc
Python
8,625
237
from collections import defaultdict import time from PIL import Image import pprint import numpy as np import torch from torch import optim from torchvision.utils import save_image, make_grid import torchsummary import src.models as models import src.objectives as objectives from src.utils import Logger, Timer, save_...
e0ba38e3a0bf6e7d90f420994f5281492f5d9293f407c44ca6b5c2d720f50619
Python
8,625
185
from __future__ import print_function, division, absolute_import import os import argparse from tqdm import tqdm import torch from torch.autograd import Variable from torch.utils import model_zoo # http://scikit-learn.org from sklearn.metrics import accuracy_score from sklearn.metrics import average_precision_score f...
055805a446ae6fedd0658f72235dcf9e4f1e3cab105cd099f46deb246cd522c6
Python
8,626
219
''' TNS class : Tree ''' import copy import json import logging from collections import namedtuple import numpy as np from morphio import PointLevel, SectionType from tns.utils import TNSError from tns.generate.algorithms import basicgrower, tmdgrower from tns.generate.section import (SectionGrower, SectionGrowerPath...
68bd270638a7916f42ed1a3a1b9a8e86667585778f368ccedeca69c6dcf6faf0
Python
8,631
266
"""Unit tests for flash_attn.cute.utils module.""" import functools from flash_attn.cute import utils as cute_utils from flash_attn.cute.utils import hash_callable def with_positional_default(value): def inner(arg=value): return arg return inner def with_keyword_default(value): def inner(*, a...
fa4f6b713a40d6ca7e1d1d451abd0eb0adcc09105f7007cb33c49feb1ed2c2af
Python
8,633
268
"""Tests for the shared bounded-run / playback engine.""" from __future__ import annotations from threading import Event import pytest from bokeh.document import Document from larvaworld.portal.canvas_widgets.environment_models import LarvaPreviewFrame from larvaworld.portal.simulation.run_playback import ( DEF...
7c8c7779a4c6fc02c83a2855a5a1679204a50485565b495c95e034df939a89f6
Python
8,634
244
model = dict( type='FasterRCNN', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretra...
8c1e5c8c62000af96057f62bdcc444201fba79bf8a41f35d4a2d923d4a6edd71
Python
8,634
244
model = dict( type='FasterRCNN', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretra...
c282164922ffab035499fcebf4af8a2d76d17b2c26bab58a1d71f9811d79f1d2
Python
8,634
244
model = dict( type='FasterRCNN', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretra...
c297d54df9c2e1f8b6e3d19352813dfd3ff1a981c732ebc4a9206d61d0def173
Python
8,636
244
model = dict( type='FasterRCNN', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretra...
e9f05d20d31100726557a72aef806084e969cb1f5b14823eab7036c05eeb4557
Python
8,636
244
model = dict( type='FasterRCNN', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretra...
f78f0d4e3ca5b5300244087f3a079cd419d5a8e168cf08617b2af550b3414314
Python
8,637
276
# -*- coding: utf-8 -*- # # Wyrm documentation build configuration file, created by # sphinx-quickstart on Fri Jun 28 11:37:55 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All co...
4ff0a7a5ec085d4e1cffb3fb8de501fb33a87a756a9c0813729774c3be705adb
Python
8,638
244
model = dict( type='FasterRCNN', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretra...
ccf90e078bf8282a8de3c550ec7a668683706400897ca8929a79b13a106f5c30
Python
8,638
197
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import os from pathlib import Path from typing import Any import numpy as np import torch import torch.distributed as dist import torch.nn.functional as F from PIL import Image from ultralytics.data.dataset import...
7bcd1ce85311408def695fa7d731098c3fcc8a6c7c5cf2b29cf996dcde3f4a80
Python
8,639
290
"""dictTool: merge/split/flatten/unflatten dict Author: Jin Lee (leepc12@gmail.com) at ENCODE-DCC """ import re from collections import defaultdict try: from collections.abc import MutableMapping except AttributeError: from collections import MutableMapping def merge_dict(a, b): """Merges b into a ...
cbacdb74968e6b0135464d3210b688f0ed5649b708276c7eba2b1091c4d68333
Python
8,641
215
from __future__ import annotations from typing import Dict, List, Optional, Tuple import torch import torch.nn.functional as F from pytorch_lightning import LightningModule from torch import Tensor from torch.nn import Module from lightly.utils.benchmarking import knn_predict from lightly.utils.benchmarking.topk imp...
60bed75e0da8a01e6e0f5ffdc86192c919d66f9c4bb8b84d139595f6936660eb
Python
8,645
211
# Copyright 2022 Deepfold Team # # 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 agreed to in writin...
c5030f241a0844a6ee7e7a5556bdf2a6e72e0ab67d7fc76d59fe3d46da95eaa3
Python
8,645
229
# -*- coding: utf-8 -*- # Copyright (C) 2020 [COMET-ML] # # 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 without limitation the rights to use, copy, modify, #...
2b9892f7e4780278fcec09fb3e3b2bff548cdc4941f44c5d1e6f0df328da43be
Python
8,646
222
"""Run a command in its own process and measure its wall-clock time and peak memory. The memory of the process and of its child processes is sampled every 50 ms and summed: on macOS their physical footprint (what Activity Monitor shows; resident memory leaves out the compressed and swapped pages of a large read), else...
381f3c7398f213afb2a52b67c3a09560d2077d8c361d4754ab83089f5822fe24
Python
8,647
235
import pkg_resources import logging from PyQt6 import QtWidgets, uic from matplotlib.widgets import SpanSelector import numpy as np from bmlab.session import Session from bmlab.controllers import EvaluationController from bmicro.gui.mpl import MplCanvas import warnings logger = logging.getLogger(__name__) MODE_DE...
b17fa7055d8aa02b43282f2e53ed0ad5fb7fa8bbfd70ca980de16758ee9eba1b
Python
8,647
244
model = dict( type='FasterRCNN', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretra...
ebba1d43738cd6e3ded845631f1a5fdff848a75d73050e9c8a7d13324c32fd9d
Python
8,647
155
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # PLUS import os import sys import argparse import torch import plus.config as config from plus.data.alphabets import Protein import plus.data.pfam as pfam import plus.data.dataset as dataset import plus.model.plus_rnn as plus_rnn import plus.mo...
810f2f6e62105a0df777cfd1c1fc13a83f6976f70e26edee231c0ff01e315615
Python
8,648
199
"""Prepare data for segmentation""" import os from os.path import join as opj import shutil import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from scripts.utils.io_utils import write_h5 from scripts.utils.constants import MRI_IMG_DIR, MRI_ORG_LOC_GT_DIR, MRI_CYST_LOC_GT_DIR, ...
2ce762edee8ee4491f33f34e88137fc3f87b9e34efc620307b840cdee66271e9
Python
8,651
267
from functools import lru_cache from typing import Generator import numpy as np from mirp._features.ngtdm_matrix import MatrixNGTDM from mirp._images.generic_image import GenericImage from mirp._masks.base_mask import BaseMask from mirp._features.histogram import get_discretisation_parameters from mirp._features.text...
dcf4a754a19ec4b2532575ac6045f5694a246d5fff609ae15b0a782187e9f4e1
Python
8,654
204
"""Band-edge lockstep: claim -> named leg -> executable evidence (memo D3/B3). ONE support-policy table (tests/support/proofnet/support_policy.tsv) is the authority; this suite holds pyproject's declared bands, the per-leg constraints files, the installed environment, and the HF_5_CANDIDATE enumerated-red manifest in ...
8123ba2016d67bef862d1b537f9b096e83f48b9821b2a3dec1c02e187ea952b2
Python
8,656
276
import math from typing import Any, Tuple import numpy as np import torch from pytorch_lightning import LightningDataModule from torch import Tensor from torch.utils.data import DataLoader, Dataset from pl_bolts.utils import _SKLEARN_AVAILABLE from pl_bolts.utils.warnings import warn_missing_pkg if _SKLEARN_AVAILABL...
1c805139d9de7a44faca8da2937466c358e25767d0101c5f9062e206559553f0
Python
8,658
285
'''ML models''' __all__ = [] import copy from itertools import product from bdpy.preproc import select_top import numpy as np from numpy.linalg import norm from scipy import stats from sklearn.svm import SVC from tqdm import tqdm import warnings class EnsembleClassifier(object): '''Ensemble classifier.''' ...
a02b281405bc75057f2e3f079284bedeb99329bbfe638672d68e1c732a7f2fd5
Python
8,658
208
import sys import os import gc sys.path.append('../TM2_segmentation') import SimpleITK as sitk import numpy as np import pandas as pd import nibabel as nib from skimage.transform import resize, rescale from scipy.ndimage import rotate from scipy import ndimage import matplotlib.pyplot as plt from numpy import median i...
037599b42c91626d00278df9f865aa4bf3c29628a6d2b7b99461239e77d56ee5
Python
8,659
231
import os import os, sys from config import * sys.path.append(where_am_i()) from pathlib import Path from utilities import dataloading_utilities as dlutils from scipy.signal import correlate from torch.utils.data import DataLoader from utilities.folders import * import pandas as pd import numpy as np import pickle i...
dff5c6f1ed3dbd2e3a60cc10af7f015df84c4462018f76149aa18450a27dbe55
Python
8,660
173
#!/usr/bin/env python3 """ File: prepare_metabrain_phenotype_matrix.py Created: 2021/10/13 Last Changed: 2021/12/06 Author: M.Vochteloo Copyright (C) 2020 University Medical Center Groningen. A copy of the BSD 3-Clause "New" or "Revised" License can be found in the LICENSE file in the root directo...
f4baa9d9611ef983f2416cde489d26a0cda0f7eb67885d5c377cff15493c1456
Python
8,661
220
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test objects and function in the module ``tfep.potentials.mimic``. """ # =====================================...
4ddba5bb478fe1c18e44923ded98725fd3bceae874b5ea5fbfeda886e265da73
Python
8,666
240
import torch from strategy_obj import ( strategy_proba, strategy_weight, strategy_proba_post_scale_temp_tunning, strategy_BMA, strategy_BMC, strategy_Learn_weights, ) import torch import pandas as pd from itertools import combinations import logging # Delete the padding in order to compare the ...
5caedab2abb0f8fca74a1f8379aafc2d06ea1f6ccada2e62dbe3d52aee854707
Python
8,667
284
"""Bounding boxes transformation functions.""" from __future__ import division import numpy as np __all__ = ['crop', 'flip', 'resize', 'translate', 'affine_transform', 'get_affine_transform'] def crop(bbox, crop_box=None, allow_outside_center=True): """Crop bounding boxes according to slice area. This method...
c78cb7b884273949489cc48067b9656205b18137c6bd1922cad84040993a0fe5
Python
8,667
199
''' Implements the import-export blueprint. ''' import pandas as pd import datetime from dash import ctx, dcc, html import dash_bootstrap_components as dbc from dash_extensions.enrich import DashBlueprint, PrefixIdTransform, Output, Input, State from dash.exceptions import PreventUpdate from utils.utils import cust...
c15cfc3490c9b496e8b9503dcaf875eceded479337301c67e3c02c99292b22c9
Python
8,669
228
#!/usr/bin/env python # coding: utf-8 # This script has kindly been provided by Julia Schessner. from io import BytesIO from reportlab.pdfgen import canvas from reportlab.lib.utils import ImageReader from reportlab.platypus import Paragraph from pdfrw import PdfReader, PdfDict from pdfrw.buildxobj import pagexobj f...
c94cf32a2163cafd971d59095a18cea790d41e90df44f3c86ef4e03a8822e9d0
Python
8,669
246
#!/usr/bin/env python # -*- coding: utf-8 -*- # # spateo documentation build configuration file, created by # sphinx-quickstart on Tue April 5 13:47:02 2022. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # au...
4059d52e4981a7bfaffd6bb69b441c47500fc305d33d90b4110c0e189191eef6
Python
8,673
198
""" cnn_numpy.py -- pure numpy forward pass for SongCNN (see song-feature-analysis/scripts/cnn_model.py), loading weights from a plain .npz file exported from a trained PyTorch checkpoint (see that repo's scripts/export_npz.py). Why not onnxruntime: checked 2026-09-22 -- the fleet's Pi image is 32-bit ARM (armv7/armhf...
c6d0c617dc414a7b01085e456374f12cf58c65a2519c53c31711692010824ec3
Python
8,674
237
"""Explorer memo item-3 riders (lane F25). - P3 pin: input ops receive activation transforms on the TRACE path (the fastlog pin lives in test_explorer_watch_p1_summary_role.py). - P4: retained-memory truth on reduce-only captures plus the two ``total_transformed_*`` read-time totals. - Fused spine kernel: exact-co...
97ccee032771c63d3b3994a77bc71f33a32ff502c0e5ab8366b2e9c614f570c9
Python
8,675
207
# model from ast import Global import torch import torch.nn as nn import torch.nn.functional as F import torch_geometric as tg import torch_scatter import e3nn from e3nn import o3 from typing import Dict, Union # crystal structure data from ase import Atom, Atoms from ase.neighborlist import neighbor_list from ase.vis...
a68ef82afd301f5ad8ecf97ff1439cb453b77bb13aa40d309bc13e69bbc3c18b
Python
8,675
226
"""P5 outcome-matrix cells and lockstep proofs. The remaining design-matrix cells not covered by the P0-P3 suites: raise_on_nan's honest raw-tensor-only scope, the no-frontier halt failure class, cooked-halted gate arming (N4/N5 on ``Recording.to_trace()`` products), the OOM double-fault, the never-fired halt predicat...
5acbe40e6313c9dd8ee59ab3a04a9eb7b8e803685b7c108137a36f858d8d1762
Python
8,676
230
import os import time import numpy as np import pandas as pd import nibabel as nib from os.path import join as pjoin from matplotlib import pyplot as plt from magicbox.io.io import CiftiReader, save2cifti from cxy_visual_dev.lib.predefine import All_count_32k, proj_dir anal_dir = pjoin(proj_dir, 'analysis') work_dir =...
c6afa8dbec3198a4c49aaba3fdff430072d9fe4dd8c7d55fd65733aa02226215
Python
8,676
159
# encoding=utf-8 import os import dataset.data_act as data_act import pandas as pd import dataset.data_weather as data_weather import datetime from ourmodel.loss_transfer import TransferLoss import torch import math from dataset import data_process def load_act_data(data_folder, batch_size=64, domain="1_20"): x_t...
f7e20fab1940dbb8b5d751618b6333c6c906af6ecf0f1c8e98bf10244320e2ae
Python
8,677
210
# Copyright (c) 2022 PaddlePaddle Authors. 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 app...
03ffc4143e556d1657656d32bea6078c68befa146ed53b1ce0f8f1e9621f5aaa
Python
8,679
298
"""Custom ResNet Implementation Note that the architecture we present here differs from the one used in torchvision. We replace the first 7x7 convolution by a 3x3 convolution to make the model faster and run better on smaller input image resolutions. Furthermore, we introduce a resnet-9 variant for extra small models...
ed7e342f529478d180a46d3e64ea2d8b7ff809a2fe70b894540ed9085a92aa2d
Python
8,681
230
# 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 agreed to in writing, software # distributed ...
03c908668f18731ef879802a9effae6a8a7cbd4da0f938bb8b03fcbc207fd3db
Python
8,682
197
import logging from sqlalchemy import select from sqlalchemy.sql.expression import func # Cannot import galaxy.model b/c it creates a circular import graph. import galaxy from galaxy.util import unicodify log = logging.getLogger(__name__) class UsesItemRatings: """ Mixin for getting and setting item rating...
970d5a9167fecee474af140c3034c40f9e464e15a210fd9d5cfccd0809d02cca
Python
8,686
220
"""MS COCO keypoints dataset.""" from __future__ import absolute_import from __future__ import division import os import copy import numpy as np import mxnet as mx from .utils import try_import_pycocotools from ..base import VisionDataset from ...utils.bbox import bbox_xywh_to_xyxy, bbox_clip_xyxy class COCOKeyPoints...
889e2f8ac9dd447fd58bb88fb542e165de7c6148ef12691be137c7195bbeec62
Python
8,692
212
"""Counterfactual-harvest schema (leverage B17 / D-13): fields land NOW. The manifest/resume schema for intervened dataset extraction lands at launch unconditionally — adding a resume-compared policy field to a RELEASED artifact is exactly the migration this schema exists to prevent. Execution ships per ADDRESS CLASS ...
959615a911e53f72a77a96cece1f1c65d90fd58fa4c2e78e7e413224072eaa2e
Python
8,692
211
from functools import reduce import mudata as md import numpy as np import pytest from anndata import AnnData from anndata.tests.helpers import assert_equal from mudata import MuData import muon as mu @pytest.fixture def mdata() -> MuData: return MuData( { "mod1": AnnData(np.arange(0, 100, 0...
44255e7a2a269463642de403f06e9476f7b1f8d0c8ff1283e398578e067695b4
Python
8,693
216
# Copyright (c) 2022, Tri Dao. import torch import torch.nn as nn from einops import rearrange from torch import Tensor from flash_attn.utils.distributed import all_reduce, reduce_scatter class GPT2Embeddings(nn.Module): def __init__( self, embed_dim, vocab_size, max_position_emb...
ceddf697fc0f200a0bfbc73c9a08dc0fc8ec1d0ce86f921e5f3d44083b0874b8
Python
8,693
221
import numpy as np import pytest from seqpro.rag import Ragged from seqpro.rag._utils import lengths_to_offsets def to_py(x): """Universal, layout-agnostic materialization to nested python lists/bytes. Recurses by peeling the outer (always-int) axis; never calls to_packed, so it works on string and string...
8bcece46354cfa4980cbe5ff6682d3801cc330cff2b0d499487f79ac96696f96
Python
8,694
207
#!/usr/bin/python3 # -*- coding: utf-8 -*- """Gridsearching on the Columbia yeti cluster. """ import time import sys import os import stat import subprocess import logging import crf_util from gridsearch_train_crfs import GridsearchTrial class GridsearchTrialYeti(GridsearchTrial): """Adaptation of GridsearchTria...
a2fba1383fb707f1be94e317d35c48bbd66393cb02de56230a3ffe5751fe8313
Python
8,694
182
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
5241a2731a824557606ef77e3f59b014da0d437f1575f4be93093ee18b5b65bd
Python
8,695
243
"""Integration testing utilities.""" import socket import sys from collections import defaultdict from functools import partial from itertools import count from typing import Any, Callable, Dict, Sequence, TextIO, Tuple # noqa from kombu.exceptions import ContentDisallowed from kombu.utils.functional import retry_ove...
994971fc7530c190250dee6c3355e16d291531ba646ac5cd7904a8991392423a
Python
8,695
236
from importlib import resources import logging from PyQt6 import QtWidgets, uic from matplotlib.widgets import SpanSelector import numpy as np from bmlab.session import Session from bmlab.controllers import EvaluationController from bmicro.gui.mpl import MplCanvas import warnings logger = logging.getLogger(__name_...
c6597206ab59ebbd52a47895b0807b59be2614212a5e76b82f382844911d9562
Python
8,695
262
#!/usr/bin/env python3 # flake8: noqa: E402 """ Demonstration script for the new sleep restriction functionality. This script shows how to use the new DailyScheduler and mAGOSleepRestriction classes. """ import datetime import os import sys import time from unittest.mock import Mock # Add the ethoscope package to th...
f608b3643659feb5a6a0c0b22670ed65f6bc3f1c563d7a0fc28b10fe03f290b3
Python
8,695
267
from __future__ import annotations import pytest from pytest import approx # noqa: PT013 from pybind11_tests import ConstructorStats from pybind11_tests import sequences_and_iterators as m def test_slice_constructors(): assert m.make_forward_slice_size_t() == slice(0, -1, 1) assert m.make_reversed_slice_ob...
167a6b0066d61f4aa3f790ce4240459debdc962e1ca73d2dd00f37e44ff2520f
Python
8,697
238
""" Replay of a recorded dataset in the simulation viewer. Drives agents from stored coordinates rather than from a brain, so that experimental and simulated behaviour can be inspected with the same renderer. """ from __future__ import annotations from typing import Any import copy import numpy as np from .. impor...
5bbe5a6ce624e888505d33d599262e29fc76e8f15a557cd5c0957d578cef5da3
Python
8,697
274
from typing import Optional from itertools import chain from functools import partial import torch import torch.nn as nn from .gin import GIN from .gat import GAT from .gcn import GCN from .dot_gat import DotGAT from .loss_func import sce_loss from graphmae.utils import create_norm, drop_edge def setup_module(m_typ...
376396a89cb38c69822e3f98fdcc1670c132421961fd2894ff2a75dae68b6a48
Python
8,701
270
import h5py import numpy as np from tqdm import tqdm import torch from torch.utils.data import DataLoader import torch.nn as nn import torch.nn.functional as F import os from random import shuffle import itertools, operator from load_psam_motif import * from map_protein_name import * import random from utils impor...
eae013958c4d2b290f7bf524629c78660ee70c3e83954a9e07f34d2271082f46
Python
8,705
193
from __future__ import absolute_import from __future__ import division from __future__ import print_function import logging import time import numpy as np import os import torch from voxelpose_lib.utils.vis import save_debug_3d_cubes from voxelpose_lib.utils.vis import save_debug_3d_images from voxelpose_lib.utils.v...
08d4d2324e121c1039bd9fe10d6a86166b43ee36d85725898c3a57bb09ee591c
Python
8,706
197
# FAITHFUL REIMPLEMENTATION from Zhang, Xu, Yu, Zhang, Chen, Yu, "ADL-MVDR: All # Deep Learning MVDR Beamformer for Target Speech Separation" (ICASSP 2021, # arXiv:2008.06994) -- no public code. The official repo # (https://github.com/zzhang68/adlmvdr) is a demo-only page (audio/video/image # assets, no model source), ...
a931008d2871a6e878fbb29a02d9323c2f1e716dde9e94f90a83861372fd5c2f
Python
8,711
272
"""Integration tests for the TorchLens portable I/O flow.""" from __future__ import annotations import importlib.util from pathlib import Path from typing import Any import pytest import safetensors # noqa: F401 import torch from torch import nn pd = pytest.importorskip("pandas") import torchlens as tl # noqa: E...
f8262895da186ab13e2ca1d93b371aae38cffdd1fa85d0ed46a0b5bef6c965fe
Python
8,712
287
import numpy as np import h5py from scipy import signal from scipy.stats.stats import pearsonr from scipy.stats import zscore import os def columnwise_correlation(ypred, y, zscorea=True, zscoreb=True, axis=0): r'''Compute correlations efficiently Examples -------- >>> x = np.random.randn(100,2) >...
0aeef49d897bdbccfa61b2ac5256b0c9c04e01e972321b7543f44fe44300b030
Python
8,716
253
import math import torch import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F from torch import Tensor def prototype_probabilities( queries: Tensor, prototypes: Tensor, temperature: float, ) -> Tensor: """Returns probability for each query to belong to each prototype...
40c3d301a77641543e575ddea720804cf23959268a37f852bb3e286a211c4c39
Python
8,719
265
from abc import ABC, abstractmethod from permacache import permacache, stable_hash import numpy as np import tqdm.auto as tqdm from shelved.hsmm.gene_dataset import ( get_from_genes, run_on_all_genes, run_on_all_genes_with_threshold, run_on_entire_gene, ) from modular_splicing.utils.construct import ...
73dc9461ea36a8be9309250bb41f81b5c6bbdd84d330b50e6bc6b87e83694882
Python
8,720
240
import os from typing import Union, Optional, List, Dict, Any, Literal, Tuple import numpy as np import xarray as xr import torch.nn as nn from tqdm.auto import tqdm from seqexplainer import get_layer_outputs from seqexplainer import get_activators_max_seqlets, get_activators_n_seqlets, get_pfms from seqdata import g...
806cb06e68f8385eca3e4a80a8f3490c421a2220ed10bcd0be6b15f86e2b2243
Python
8,720
230
"""PointASNL: Robust Point Clouds Processing using Nonlocal Spatial Correlations. Yan, Zheng, Li, Wang, Cui, Qi & Tian (Meituan / Stanford), CVPR 2020, arXiv:2003.00492. Source: https://github.com/yanx27/PointASNL PointASNL has two distinctive primitives: 1. Adaptive Sampling (AS) module: instead of fixed FPS centr...
a412142c2aa43f920f0d6fc7d75d5fc669c3547dc25a9359678e47fe20e33b24
Python
8,720
269
#!/usr/bin/env python """ boxplot: - box: first quartile and third quartile - line inside the box: median - outlier: 1.5 IQR higher than the third quartile or 1.5 IQR lower than the first quartile IQR = third quartile - first quartile - The smallest/largest value that is not an outlier is connected to the bo...
ae9220a3623024eb107d7e0f484f267262bb90d63eb6cdd86748228bcdb2c3ab
Python
8,721
267
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import copy from functools im...
0fa933bbea04cbe652654a429e5fa0f0ffba56c1df38816fff15f6a617d1782e
Python
8,722
253
# Copyright (c) 2021 PaddlePaddle Authors. 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 app...
ed328bed3adac84a4c71f22b9b8a640efa4cf07934d9514c919460174c710346
Python
8,722
225
##### # Function to perform outlier analysis and compute descriptive metrics # Francesca Grisoni, TU/e April 2021 ##### import numpy as np def curate_dataframe(df, outlier_test=True, alpha=0.05, convert_to_log=False, rm_high_std=True): """ :param df: :param outlier_test: :param alpha: :param con...
369ec393b8e90513a0c4517ac0b1b9b271d6f220ab0c176ccd80b84edfc63c84
Python
8,726
298
# -*- coding: utf-8 -*- # @Author: gviejo # @Date: 2022-01-02 23:30:51 # @Last Modified by: gviejo # @Last Modified time: 2023-11-16 13:17:59 """ BaseLoader is the general class for loading session with pynapple. @author: Guillaume Viejo """ import importlib import os import warnings from pathlib import Path im...
44fbb6bae07434bb09203d67cc6aebdc3060453b449b153030af3b061457317a
Python
8,727
261
# -*- coding: utf-8 -*- # # 20/20 Permutation Test documentation build configuration file, created by # sphinx-quickstart on Mon Jul 28 13:53:42 2014. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerate...
5465478a86dc07403ad7b92ea86018d8362222c96b7845d5a68d6903404b66e1
Python
8,729
329
"""Deterministic model zoo used by the capture characterization oracle.""" from __future__ import annotations from typing import Any import torch from torch import nn class PlainCNN(nn.Module): """Small convolutional network for ordinary feed-forward capture.""" def __init__(self) -> None: """Init...
cfe4164a4359411f4f2badcd5b803f885531983c26183e8c83333402f30fbff5
Python
8,729
243
from dataclasses import dataclass from pathlib import Path from typing import Dict, List, Tuple import numpy as np import xarray as xr from tqdm import tqdm from hobj.benchmarks.common import ( compare_msen, simulate_sessions, summarize_bootstrap_score, ) from hobj.benchmarks.binary_classification.estimat...
6aa2b8d002a1c933995dac7e32f653d2e7cf347c7ded23c1b26c3bbc11fe0868
Python
8,731
223
import os import zipfile from unittest import mock import h5py import numpy as np import pytest import keras from keras.src import testing from keras.src.saving import saving_lib from keras.src.saving.file_editor import KerasFileEditor def get_source_model(): inputs = keras.Input((2,)) x = keras.layers.Dens...
f72126f499f471cba2544a374993c0c47d57115e4bfdc362fa0304bb2d00dac4
Python
8,732
220
import os.path import numpy as np import pytest CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) GENERIC_KWARGS = dict([ ("write_features", False), ("export_features", True), ("image", os.path.join(CURRENT_DIR, "data", "sts_images_raw", "STS_001", "MR_T1", "image")), ("mask", os.path.join(CURR...
f07dd7d4aacf1b10f75110f0a9ef4d9ee0a764fe2a1177745ced9d86b921a77e
Python
8,733
214
""" navigation plugin - UI load and handling QOL add-ons for easily traversing through the trace plot SimplyFire - Customizable analysis of electrophysiology data Copyright (C) 2022 Megumi Mori This program comes with ABSOLUTELY NO WARRANTY This program is free software: you can redistribute it and/or modify it under...
24e29b5a048b366b8393a4ba8157ee5ebbe64cde12473e2f92c7d2b605dcc2e4
Python
8,734
209
"""Closed host-input-metadata-read witness class for sparse runnable execution (r29-C1). r27-H2 witnessed only ``is_contiguous`` / ``stride`` / ``requires_grad`` reads on a model input. The confirming hunt found MANY more host-reading tensor accessors that steer control flow on facts the shape+dtype input contract nev...
81fd8d54631868456d73e8f36955df42596967aadb95b10abada94d5ec596973
Python
8,734
213
"""Vizmech wave-3 items 18-19: the widened, indexed geometry audit. Calibration discipline (memo s6): every metric is proven in BOTH directions -- a known-bad must fail and a known-good must pass with headroom, never tuned-tight. The known-bad is a PINNED hand-built DOT reproducing the historic 12-way fan-in head-labe...
3f89b3e12b13427582a06e4d7e749c46ce497d3a94f8783c61567efce2f588fa
Python
8,735
225
"""Anti-recurrence tests for the non-torch tensor-display crash (cert10 follow-on). Round-10 fix ``d2bfca03`` correctly made ``finalize_single_pass_trace`` flip every preview-backend (MLX/tinygrad/TF/JAX/Paddle) op's ``_tracing_finished`` to ``True``. That newly routes finalized preview-backend ops with a *saved* acti...
681133e453cf441040c9a7d37871d224aa4f36e55f06c5940fdc58bde4e680f1
Python
8,737
212
#!/usr/bin/env python3 """ Dx AI — training set sub-sampling sensitivity. Question for clinical deployment: how many subjects does the tool need to maintain its accuracy? The Dx AA canonical was trained/evaluated on 131 AD + 367 HC across six cohorts. A new clinical site might only have 30-50 AD subjects available f...