sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e7793154605fe6b7034a1afef3f497b019dd5e5dd7be298d8f9d1b673a401573
Python
10,599
285
"""Validation replay hands each op arguments with the captured ``requires_grad`` and grad mode. ATen can pick a different kernel when an input requires grad, or when grad mode differs: on macOS arm64 a Cin=1 3x3 conv runs ``Slow2d`` for a grad-requiring weight and ``Winograd3x3Depthwise`` otherwise, and the two differ...
ff25b648cb88c720590e240f5aa6d4710dcad10d2388d4a7e3c1397b22cb02c1
Python
10,601
259
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
8bee03a9314786b274eb38cd2734f7d5750c1b6c1bb3ce024a614a24cd572420
Python
10,606
279
"""Pinned tests for the mechanical belt (protocol-invisible coverage). The belt membership is DERIVED per build (never hand-listed): every wrapped entry outside torch's override registries whose probe call fires zero ``TorchFunctionMode`` callbacks and touches tensors. On this build that is exactly ``{torch.from_numpy...
a7b6d5ffb9d1597d08a40a3a869744caebc2a8379b517fdc6b63835f4956c166
Python
10,612
294
# This module defines an image scraper for sphinx-gallery # https://sphinx-gallery.github.io/ # which can be used by projects using plotly in their documentation. import ast import functools import logging import os import textwrap import warnings import plotly from plotly.basedatatypes import BaseFigure from plotly.i...
64d32107a0ee31dce2a5248d39f144003c9e46431e7f48fef18fffc73697b956
Python
10,615
304
from contextlib import contextmanager from unittest.mock import Mock, patch import pytest from amqp import ChannelError from kombu import Connection, Exchange, Producer, Queue from kombu.transport.virtual import QoS from kombu.utils.encoding import ensure_bytes from celery.contrib.migrate import (State, StopFiltering...
cb3af48dba779ad14f9a6674833658c221646c228e775d17ae57b0b68c2466a8
Python
10,615
291
import glob import numpy as np import torch import os #os.environ['CUDA_VISIBLE_DEVICES'] = '0, 1, 2, 3, 4, 5, 6, 7' import sys #os.environ['EPICS_CA_ADDR_LIST'] = '164.54.128.27' import shutil import custom_logger import helper_small_model as helper from agx_update import agx_update from slack_update import post_m...
0a79b2b44ebac74137ec2b0c310bf0080f90e05aac78762e91bf3cd2f2729de0
Python
10,618
295
"""Artifact-v2 layout contract tests (extract memo D1/D16; lane C04). Unit coverage of the substrate kernel: the commit protocol's ledger append, trusted-prefix reading (torn tail dropped, mid-break typed, missing member typed), tail repair before appends resume, the write-once stimulus-id sidecar, field-by-field sign...
647088e8748d328f431bc7025e5a6141f17df042a921fb5a26ae014b56380281
Python
10,618
271
""" Job runner plugin for executing jobs on the local system via the command line. """ import datetime import logging import os import subprocess import tempfile import threading from time import sleep from typing import ( TYPE_CHECKING, ) from galaxy import model from galaxy.job_execution.output_collect import d...
8567afcd2a45cd8ae365509cfe297e2ae347bfea9eacea98594fcdf0fbf14675
Python
10,620
279
import os import numpy as np import pandas as pd CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) def test_quick_start(): # Quick-start example 1 (extract features) from mirp import extract_features feature_data = extract_features( image=os.path.join(CURRENT_DIR, "data", "sts_images"), ...
d8033c42d934c14ffe363ee933bbc47e23b5ab2ba309346ef911c1967bf31cd9
Python
10,627
280
#!/usr/bin/env python """Convolutional components/networks.""" import keras_cortex.layers import tensorflow as tf def _residual_stack(x, filters, blocks, stride1=2, name=None): """A set of stacked residual blocks. Args: x: input tensor. filters: integer, filters of the bottleneck layer in a block....
00c154f45715923f169de797abb3315642707e70ddd3ae5d6a1dd5aaca6e233c
Python
10,633
284
"""Bound-method root contract (lane F41; foldA MEMO s5 item 9 + D11). The ruled root contract, pinned on toy models: ``tl.trace`` accepts an ``nn.Module`` OR a bound method of one; the owner resolves via ``method.__self__`` and registers as a submodule of the TL-authored wrapper root; ``stepped_module`` defaults to th...
662b1ad7f827ffa42c6275b69ad05404a930b08e34359942b2ba8ee29b6ffa37
Python
10,634
302
from collections import deque, Counter import math BIOLOGICAL_PROCESS = "GO:0008150" MOLECULAR_FUNCTION = "GO:0003674" CELLULAR_COMPONENT = "GO:0005575" FUNC_DICT = { "cc": CELLULAR_COMPONENT, "mf": MOLECULAR_FUNCTION, "bp": BIOLOGICAL_PROCESS, } NAMESPACES = { "cc": "cellular_component", "mf": "m...
4a8fd131501b4f4bc92b4129cacfad09f7eefd1363cd70e187fd4633e2774a92
Python
10,635
274
import math import torch from einops import rearrange, repeat from flash_attn.bert_padding import pad_input, unpad_input def generate_random_padding_mask(max_seqlen, batch_size, device, mode="random", zero_lengths=False): assert mode in ["full", "random", "third"] if mode == "full": lengths = torch.f...
50fd89eed9501d1366e7063dcabc919db3973553db78bc388bc3c473a065905d
Python
10,636
255
"""DSE regularizer.""" import math from typing import Tuple import torch import torch.nn.functional as F from torch import Tensor from torch.nn import Module class DSERegularizer(Module): """Dense Structure Estimator regularizer for dense representations. This experimental regularizer is based on the train...
9cfa979541dcdb9baebf10e716fbe4a060142b2d18be1132d5d1661d80b005a2
Python
10,640
285
""" This is the script that is used for the wave propagation using the angular spectrum method (ASM). Refer to Goodman, Joseph W. Introduction to Fourier optics. Roberts and Company Publishers, 2005, for principle details. This code and data is released under the Creative Commons Attribution-NonCommercial 4.0 Int...
b157cbc33f75f1132df530f04361824bc39a30d4051ce6df1cd5c388e49b3117
Python
10,640
219
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from typing import Any import numpy as np from .basetrack import TrackState from .byte_tracker import BYTETracker, STrack from .utils import matching from .utils.gmc import GMC from .utils.kalman_filter import Kal...
e08f3c63701c9aefc4b1656aca046031f73a89057234ba976a8aff69c37d2443
Python
10,643
314
"""Phase 5 capture-unification predicate intervention tests.""" from __future__ import annotations from typing import Any, cast import pytest import torch from torch import nn import torchlens as tl from torchlens._trace_state import TraceState from torchlens.fastlog import RecordContext, Recording from torchlens.o...
0057a506d3e9360fd0968fc631f9e69b4520261b08cdd9ee8c94ee197fb7039f
Python
10,646
283
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test objects and function in the module ``tfep.io.dataset.traj``. """ # ======================================...
5542d02b14067e1d862d5ec974ac09f5a407193d9e3b8cbf4d8c7638fa08da68
Python
10,647
287
""" Unit tests for larvaworld.lib.plot.grid module. Tests composite grid-structured figure creation using synthetic data and mock objects. Only tests calibration_plot which doesn't require datasets. """ from unittest.mock import MagicMock, patch import os import pytest from larvaworld.lib.plot.grid import calibrati...
8a3c9a834aadc992d061dfa20f39ec5f728f20b8acf7a61706f64976842d1ff1
Python
10,652
325
import argparse import math import time import brainpy as bp import brainpy.math as bm import numba import numpy as np @numba.njit(fastmath=True, nogil=True) def _adding_problem_generator(X_num, X_mask, Y, N, seq_len=6, number_of_ones=2): for i in numba.prange(N): positions1 = np.random.choice(np.arange(math.f...
921b64a000def3ccbfd5ce6171ba5295b9fc41de6000ac56a93f15a0556bdb0c
Python
10,654
271
import pandas as pd from tqdm import tqdm import os import torch import torch.nn as nn from torchmetrics import MeanSquaredError, R2Score, SpearmanCorrCoef, PearsonCorrCoef from omegaconf import OmegaConf import sys script_dir = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.dirname(script_dir)) f...
041d8be541b11d9acd8b1d564efd46105bf91edeb7a235a40cbc83a9da6142ae
Python
10,656
213
import torch import torch.nn as nn import torch.nn.functional as F from HD_BET.utils import softmax_helper class EncodingModule(nn.Module): def __init__(self, in_channels, out_channels, filter_size=3, dropout_p=0.3, leakiness=1e-2, conv_bias=True, inst_norm_affine=True, lrelu_inplace=True): ...
7d536d7e218065d205c9a78cadc0d89630fe4365d1abe65dec796b0b2ce01b08
Python
10,657
303
# bcinetwork.py - # Copyright (C) 2007-2009 Bastian Venthur # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This ...
87098e44767c232cbe4d702ae8a30a4022f2b7c8e7c0fa2e89b5db20ac5e4661
Python
10,659
322
#!/usr/bin/python import sys import os from shutil import copyfile import re import pandas as pd import numpy as np import math import ConfigParser import tabix ##### Return index of a1 which exists in a2 ##### def ArrayIn(a1, a2): results = np.where(np.in1d(a1, a2))[0] return results def ArrayNotIn(a1, a2): tm...
25a0393d3229cec0ec4199e41359f0ce33ae58cbbe2aed46584cd0ad11dd6bc5
Python
10,660
241
from distutils.command.build import build import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Code suppressing TF warnings and messages. # os.environ['CUDA_VISIBLE_DEVICES'] = '-1' import sys import argparse import numpy as np import random sys.path.append("../") import time import gc from tensorflow.python.framework....
60896a53dc6dc04a00385e8113ecf93dd2064a536ff87c4dc11dbd057f39d5c8
Python
10,662
392
"""Callbacks available from R's C-API. The callbacks make available in R's C-API can be specified as Python functions, with the module providing the adapter code that makes it possible.""" from contextlib import contextmanager import logging import sys import typing import warnings import os from rpy2.rinterface_lib ...
1f1735e7fdf1ee0ca031264870e7936f428ce8be639493dc345f1c567004ce5b
Python
10,664
313
# 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...
811b17df063cd0802691669a77f85d5b8f550ffd724234280631e7ed35b46cfb
Python
10,666
283
import torch import torch.nn as nn from bioseq2seq.utils.misc import aeq from bioseq2seq.utils.loss import CommonLossCompute def collapse_copy_scores(scores, batch, tgt_vocab, src_vocabs=None, batch_dim=1, batch_offset=None): """ Given scores from an expanded dictionary correspon...
b82462e201cfcd12f8d20ff44689fa3b229ded9d5c8133183b088d90534a96d0
Python
10,668
283
#!/usr/bin/env python3 """ 5D Eval — Diagnostic B: sub-type clustering within disorders. Does k-means on AD / FTD / PD subjects in 5D space reveal stable sub-types that a sub-type-aware classifier could exploit? Measurements per disorder: - k-means for k ∈ {2, 3, 4} fit on concatenated disorder subjects - Silhoue...
f8dfc836125ee8498689abd7a0bc2013fb9a0926b8590c3322cbeb97cde50a6c
Python
10,668
269
from inspect import getfullargspec as fargs from typing import List, Union, Callable import numpy import numpy as np import tensorflow as tf from tensorflow.keras.layers import TimeDistributed from angorapy.tasks.wrappers import TaskWrapper from angorapy.utilities.error import IncompatibleModelException from angorapy...
96d384728a3600772cc58036b9a34c9ae1d9f9d17e1b60256bde55aa0c6bbd1b
Python
10,669
265
import os,sys,math,pickle import random as lrand import rpy2.robjects as robjects import argparse import numpy #import svmutil def init(): lrand.seed(1982) robjects.r('library(splines)') robjects.r('library(stats4)') robjects.r('library(survival)') robjects.r('library(mvtnorm)') robjects.r('lib...
3d39d673867984cd30ea8920c279ff2298d7f3f018ad8ddcc7168d783042b24b
Python
10,672
326
#!/usr/bin/env python """ TODO: - define __all__ or limit available functions in some other way. """ import numpy as np import pandas from argparse import ArgumentParser try: # python < 3.3 from collections import Iterable except ImportError: # python >= 3.3 from collections.abc import Iterable from ...
be7b44020a897f2f98bf376d332ce55471632c68571bbfd168b7b03ecb08d652
Python
10,673
260
"""Parses an individual line in a BED file.""" from collections import namedtuple import logging # Initialize a global named tuple to make handling BED lines less awkward BED_HEADER = ('chrom', 'chromStart', 'chromEnd', 'name', 'score', 'strand', 'thickStart', 'thickEnd', 'itemRgb', 'blockC...
b100bba0452e321877d8d24180d89200fd0c485faad8087f7f357281df6c140e
Python
10,675
185
"""1. Distributed training of deep video models ================================================ Training deep neural networks on videos is very time consuming. For example, training a state-of-the-art SlowFast network [Feichtenhofer18]_ on Kinetics400 dataset (with 240K 10-seconds short videos) using a server with 8 ...
b86accab47274e612ee427b6ecd9416dcf21a7ee0b7b0e5b188c36218b0d7106
Python
10,675
301
#!/usr/bin/env python3 """Diagnostic O — Tier 3.3: richer feature expansions + selection. Dx N showed Quad_LDA (linear + squared → 30 features) crosses both AD bars (0.863/0.786). This diagnostic tests whether we can push further: 1. cubic_expansion: linear + sq + cubed (45 features) 2. pairwise_top10: l...
6ec8a4ff4706fd2aeeadd50a9fa01bccf1f7123f1e758723ff5c04f130ef4b23
Python
10,676
275
from itertools import accumulate from pybedtools import BedTool, Interval import numpy as np import pandas as pd from torch.utils.data import Dataset __all__ = ['WholeGenomeDataset', 'FastWholeGenomeDataset', 'process_genome_preds', 'post_merge_blocks'] class WholeGenomeDataset(Dataset): '''Dataset f...
4057c111893a55aaed2703c7c47ae79bb089f872f3a5d534df29235b370b26ed
Python
10,679
237
# 均匀采样效果较差 import json import numpy as np import os, sys import random from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional ...
1cd42781231725e68f57d3bf1adfde5bd120874ef6421d63cc74b3e2272669f5
Python
10,680
251
''' Load K-folding models from groups and evaluate performance author : obanmarcos ''' import os import os, sys from config import * sys.path.append(where_am_i()) import lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_utilities...
bac7dea15d212d220df4a8e5eaef3126741db0e9fb7e01b294ddd287e78755bb
Python
10,681
233
#!/usr/bin/env python3 """ File: pic_replication_plot.py Created: 2021/12/13 Last Changed: 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 directory of this source tree. "...
c351c71372bd75f3127590dceca50463ac1178816a8b2536344745d91f920ef5
Python
10,681
283
#!/usr/bin/env python3 import numpy as np import seaborn as sns import re import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cmx import glob, struct import sys, argparse, os def parse_args(argv=None): parser=argparse.ArgumentParser(description='Script for generating the jobs t...
072e609b4df5e9ae6b3671173269e5cd1f3d57bf7dc192fc7f8cf04ee10dc2b1
Python
10,683
289
import torch import time import torch.nn as nn from sklearn.neighbors import kneighbors_graph from .Modules import * from .Utils import * from .Loss import * class PAST(nn.Module): """ PAST Model: latent feature extraction and spatial domain deciphering with a prior-based self-attention framework for spatial t...
86bc107853e8852c5bfe3ee0df19c72e79cfc1c8779681f970d1eb3d84c1670f
Python
10,683
290
import numpy as np import numpy.typing as npt import pandas as pd import scipy import statsmodels.api as sm from anndata import AnnData from numba.typed import List from statsmodels.stats.multitest import multipletests from tqdm import tqdm from .perm_utils import get_lr_bg, get_lr_features def perform_spot_testing(...
6bb57e433cc50382dc0649e1d2e934f42cbbf579a88d2b692ccf6d31ae7002ad
Python
10,684
314
from collections import defaultdict from typing import ( TYPE_CHECKING, ) from pydantic import ValidationError from typing_extensions import Self from galaxy.model import CollectionStateSummary from galaxy.tool_util_models.parameters import ( AdaptedDataCollectionPromoteCollectionElementToCollectionRequestInt...
5969f64e64166b8dc6c12af07bae34288fbd4f4cc7f7956c836445aa3953e908
Python
10,686
274
import os from datastructure.wsi import WholeSlideImage as WholeSlideImage import numpy as np from scipy.stats import rankdata class Patient(object): """ A class to represent one patient with diagnosis and histological slides. Attributes ---------- identifier : string (Anonymized) identi...
72c47f1320c22546fca96312343b8df4adb95c4472eccdf1ae9751b6f6aeaf56
Python
10,688
230
import numpy as np import prob2020.python.utils as utils import prob2020.python.mutation_context class SequenceContext(object): """The SequenceContext class allows for deciphering sequence context and for randomly permuting mutation positions while respecting sequence context. """ def __init__(self, ...
8773db8141ee07c3c6cec7d2bd2e4789147f8970e70faebfcfaa26561fb497cd
Python
10,689
307
#!/usr/bin/env python # encoding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import os, sys, re import logging import TGraph import TNode import Node_alignment import Compact_graph_whole from Topological_sort import Topological_sort import TGLOB...
bb7e1d904b6561d44d2174fc1a47413f533087628c386f178d8924530c8cfe3b
Python
10,689
275
from typing import Type from dataclasses import dataclass import cutlass import cutlass.cute as cute from cutlass.cute.nvgpu import cpasync from cutlass import Int32, const_expr from flash_attn.cute import utils from quack.cute_dsl_utils import ParamsBase from cutlass.cute import FastDivmodDivisorV2 import math @c...
c0d52988aafea07e09dbd6b9c25570df9501ed5591caf725b4901de6093fe920
Python
10,690
316
''' load the RBNS data ''' import csv import re import h5py import urllib3 import urllib import gzip from io import StringIO import requests import numpy as np import time from utils_rbns import create_datapoints rbns_data = 'metadata_rbns.csv' encode_dir = 'encode/' # PROTEIN_NAME = [] # SEQ = [] # CONCENTRATION =...
59fc4fcdb6728d6901c63118c26e4247864865833ead6da3355baf17d70f0e32
Python
10,692
286
import contextlib import numpy as np from keras.src.backend import config from keras.src.utils.module_utils import jax def get_test_data( train_samples, test_samples, input_shape, num_classes, random_seed=None ): """Generates balanced, stratified synthetic test data to train a model on. Args: t...
46d906a3f3b25844b90e3e01b74f4d81196872b63fcfea786b80bda6c2964753
Python
10,695
297
import numpy as np from math import sqrt import mxnet as mx import mxnet.ndarray as nd import mxnet.gluon.nn as nn from numpy import prod # pylint: disable-all def get_weight_key(module): for k in module.params.keys(): if 'weight' in k: weight_key = k return weight_key def compute_weigh...
7971a560ebcbaf3d4891a10a84d8400f2cee21ff7afc93c3e4ddb739177365b2
Python
10,701
249
"""Registered buffer write-side node keeps its backend_address (r87, free FINDING-1 residual). r85's Option-a ``backend_address`` cleanup established the rule "a REGISTERED buffer keeps its registered address; a plain-attribute / list-element buffer is decoupled to ``None``" and restored op / activation / input / outp...
4a6c84bef445d9f60db72b52aed44a419777a89a10e17522e6d2f8611bc0a350
Python
10,702
262
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ PyTorch-accelerated bootstrap analysis. """ # ================================================================...
9ec94071b86a7e3cccbe6dd0f2ea8f6e9576b6cbd2f60d43bfb698cf23851f4d
Python
10,706
272
#!/usr/bin/env python3 """ Diagnostic U — 6-cohort expansion with figshare 5450293 as 4th AD cohort. Adds the Vicchietti/Pineda figshare 5450293 cohort to the Dx P 5-cohort pool. With this addition: - AD-containing cohorts: 3 → 4 (ds004504 + BrainLat + ds006036 + figshare_5450293) - HC-only cohorts: 2 → 3 (ds...
f4a5bde8ae9ef1511f153431673116b2f0aa1c09b86093cf30ecaba4bbab5f00
Python
10,706
236
# 均匀采样效果较差 import json import numpy as np import os, sys import random from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional ...
64969005cc7244d7cccf4ce4b7066f57c768ed2fd1ff00013a290ec0d79ddbe9
Python
10,707
229
####################################################### ### This code is the main routine to combine ### ### simulated SV tracks on an axon from ### ### different synapse starting locations. ### ####################################################### ### Written By: M.W. Gramlich ...
a36ef7b3cf2fe42f624b72030c6ea20c2403ddc1fe07859184041d97d93666c8
Python
10,707
277
"""Entry/tamper matrix for scoped meta admission (memo sec 4.2 / 8.1 item 7). Admission is SCOPED (D2): meta state/inputs are admitted if and only if structure-only is in force. An unscoped carve-out silently captures an unbannered value-free trace — measured to be worse than the refusal it replaces — so every one of ...
c6d2079b8ec0cfd24694a1d02b5db72b9a13fb4da1e1f7a59ce58d890999fecf
Python
10,707
226
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
b6ebfd4baae1cd742e74ff8cb9b9d145c678225c020c1705b19b4d5074edbfcc
Python
10,708
250
import pickle import torch import torch.nn.functional as F from trainingUtils import NBLoss,_convert_mean_disp_to_counts_logits #,MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd from models import Encoder,Decoder,GaussianDecoder,VAE,CellStateEncoder,\ CellStateDecoder, CellStateVAE,...
0dc0e23ba1f444324e230a605cdf529f753c05d45ab620d12abd0f0f4600097c
Python
10,709
254
''' Load K-folding models from groups and evaluate performance author : obanmarcos ''' import os import os, sys from config import * sys.path.append(where_am_i()) import pytorch_lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_u...
f77c042136c4288f1ec3a8dcdc89255d86233d7b867fc9de56b915a8392736a1
Python
10,709
292
"""Reusable Panel button helpers for the portal. No heavy imports -- only `panel`, consistent with the "keep startup lightweight" portal rule in CLAUDE.md. """ from __future__ import annotations from typing import Any, Callable import panel as pn __all__: list[str] = [ "build_load_file_button", "build_expo...
23243f88edad12f03020148a80bbadbe9fe460568eeadf8872afff7f27cb4886
Python
10,714
256
#!/usr/bin/env python3 """ Dx AR — 7-cohort eval with ds005385 added (HC-density binding test) ==================================================================== Adds ds005385 (Wascher et al. 2025, Dortmund Vital — 109 HC age 60-70) as a 7th HC-only cohort to the existing 6-cohort pool used by Dx AA. Runs the canoni...
af2f5f9ceec99d11c7662364cd5653f7102bb6c8e2c3a9c066b7351b6a42356c
Python
10,716
262
"""Fresh/foreign ``nn.Parameter`` provenance-launder closure (r77 F1). Round-76 (hon1 + free-roam, cross-lab) confirmed the LAST layout-class vehicle: the first rung of ``_tensor_has_known_provenance`` treated ANY ``torch.nn.Parameter`` -- including a fresh in-forward ``nn.Parameter(y.detach())`` with no prep stamp, n...
15c998cad07d25b5471607767a52655e3bcb95f76dfff3f059f342b1e695fb09
Python
10,718
262
#!/usr/bin/env python3 """ Dx AV — Classifier-only bootstrap CIs (deployment-relevant CI) ================================================================ Convention: pre-fit rank-norm and whitening ONCE on the full pool; bootstrap-resample only training subjects per iteration and re-fit only the LDA classifier; held-...
679334256510fbd0dfb1100f48c1a9f75818f6ba23c64dbd1c46f48aa6102e5e
Python
10,718
304
from functools import partial from typing import Any, Callable, Optional, cast import torch import torch.nn as nn from timm.models.vision_transformer import Block from torch import Tensor from torch.nn import LayerNorm, Module, Parameter, Sequential from lightly.models import utils from lightly.models.modules.masked_...
9012e89dde1f0633aade2dbda76ffbe3ce96b291c71b54e5661551c975cc9860
Python
10,720
291
import inspect import os import traceback import types from functools import wraps from keras.src import backend from keras.src import tree from keras.src.api_export import keras_export from keras.src.backend.common import global_state from keras.src.backend.common import standardize_dtype _EXCLUDED_PATHS = ( os....
55240331b7758b6c21f8a1f9b5c99bf817f39b5b40b74aeb61bbc6769a9a9965
Python
10,722
297
"""Pascal VOC Detection evaluation.""" from __future__ import division from collections import defaultdict import numpy as np import mxnet as mx from ..bbox import bbox_iou try: from mxnet.metric import EvalMetric except ImportError: from mxnet.gluon.metric import EvalMetric class VOCMApMetric(EvalMetric): ...
a0a0991164ee504b7f4671412d1a683f5fe65671d4bef4bb5f100d53f0b51c28
Python
10,723
174
#!/usr/bin/env python3 from __future__ import print_function import pandas as pd import numpy as np from datetime import datetime import sys import os import argparse sys.path.insert(1, os.path.dirname(__file__)) from core import * from post import * import genotypeio import cis import trans def main(): parser =...
b69e7c636f1d04c5c289b1c591105b26dfaaee9f784cbdb7f5ac01f6ad2c8098
Python
10,725
276
"""Round-12 security regression: ungated intervention ``import_ref`` resolver RCE. r3/r5/r6/r7/r9/r10/r11 hardened the container and function-key resolvers, but a THIRD ungated sink survived in ``torchlens/intervention/save.py``: ``_resolve_import_ref`` did a bare ``importlib.import_module(module_name)`` + attribute w...
3cd58ed1ba409be37102d19fe5ad103ca22ccd4b3643dd5138ac15f1bc9e5789
Python
10,726
295
# from google.colab.patches import cv2_imshow from detectron2.config import configurable from detectron2.engine.defaults import DefaultTrainer from detectron2.data.build import build_detection_train_loader from detectron2.data import detection_utils from detectron2.config import CfgNode as CN from detectron2.stru...
8512f752b0c7f24b4136573a9ade07792b4efdded6bb2de9fb21019e40571bc9
Python
10,727
261
#!/usr/bin/env python3 """ Diagnostic R — HC vs combined neurodegeneration (AD + FTD). Motivation (from Dx Q): AD and FTD share a single pathology axis in the 15-feature space. Centroid distances: HC-AD = 2.52, HC-FTD = 2.09, AD-FTD = 1.24. FTD sits between HC and AD. The AD-FTD sub-axis is weaker (~0.48 pts in PC1-PC...
5cc6afdc5ee11bb270ce166dd6d34861873e9fe9753ac8cc0395e296f27c3a41
Python
10,730
333
from __future__ import annotations import json from pathlib import Path import pytest from larvaworld.portal.datasets.models import ( WorkspaceDatasetRecord, WorkspaceReplayDatasetRecord, ) from larvaworld.portal.datasets import workspace_index from larvaworld.portal.workspace import initialize_workspace @...
b86835963fae3a418c952b250da7c1c4d02c591e33ca31df1acc094c7f7fff56
Python
10,738
238
# -*- coding: utf-8 -*- """ Created on Mon Feb 6 21:01:02 2023 @author: Caterina Brighi """ #%% Import functions import matplotlib.pyplot as plt import matplotlib as mpl import SimpleITK as sitk import numpy as np import pandas as pd import datetime import os import glob import gzip import shutil...
32c3d47cfe52851ce03b35be2a9fd18753d3e74f567ec8a1bf11bdde24848ff4
Python
10,739
319
""" The predict function using the finetuned model to make the prediction. . """ from argparse import Namespace from typing import List import numpy as np import pandas as pd import torch import torch.nn as nn from torch.utils.data import DataLoader from BatmanNet.data import MolCollator from BatmanNet.data import Mo...
ae9483c6fb90d01ad487b00068fda6de264a87fb7d6ac9fa7457d6a9de8f8e8d
Python
10,739
304
import ast import html import io import uuid as _uuid import zipfile import yaml from galaxy.datatypes.binary import CompressedZipArchive from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, HasMetadata, ) from galaxy.datatypes.sniff import ( buil...
3751d0e0555e2560c6e8581a491b56c1d44d18115ada39aeab88a7e1533e2131
Python
10,742
287
from __future__ import annotations import json import matplotlib.pyplot as plt import numpy as np from tqdm.auto import tqdm from ..utils import build_gt_id2annotations from ..utils import build_pr_id2annotations from ..utils import COLORS from ..utils import transform_gt_into_pr from ..utils import update_scores fr...
71a9c0d569ac43d1190ac26eccb769871f05cc8d86d8c5ace8caf894cd65384f
Python
10,745
236
# 均匀采样效果较差 import json import numpy as np import os, sys import random from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional ...
33f9658052d13d773bf940944e340ba76caeef608d83cdaab77a3fec4a6fd69c
Python
10,752
255
"""Shard-local capture marker substrate (L8/F6, merge-ranks C2; lands DARK). Pins the uncontended F6 substrate slice: the ``distributed_scope`` marker field (S3-registered ``FieldPolicy.DROP``), the ONE sharded predicate over the placements limb (census plan 3.3(c): setter and future load validator share it), the 3.2b...
15e9d51a328d6e2d4b78f927f7dba25aa9b405372479f36400b6224455a67185
Python
10,756
244
""" preprocessing_02.py — re-referencing and artifact rejection (healthy + stroke) Filtering, resampling, channel harmonization, epoching and label extraction all happen in data_loader_01.py, where the dataset-specific details live. What remains here is re-referencing and trial-level artifact rejection. Re-referencin...
f1e018ac508dab355767d23ac322a789281bd43fa7d6fa7a287590531547652b
Python
10,756
189
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
a199aa57c9f42d36fd853a32637e9116f547cb3ae3be87b6fa963675a3fa0f97
Python
10,760
330
import json import os import shutil import time import matplotlib import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np import nway.diagnostics as nwdi import PIL.Image import PyPDF2 import pytest import pandas as pd matplotlib.use('Agg') TEST_FILE_DIR = os.path.join( os...
3d8c9c0269c0bb3174fc8d04ef85e6bf198efe9f96c3aa31f1753509910168f6
Python
10,763
365
import argparse import json import warnings from ast import literal_eval import six from galaxy_ml.model_persist import dump_model_to_h5 from galaxy_ml.utils import SafeEval, try_get_attr from tensorflow import keras from tensorflow.keras.models import Model, Sequential safe_eval = SafeEval() def _handle_shape(lite...
1da31bd8c9c55f26350d5a7da50d742cccca73181d81e02cc4454cb82959dc60
Python
10,765
278
from typing import Dict, List, Optional, Tuple, Union from PIL.Image import Image from torch import Tensor from lightly.transforms.gaussian_blur import GaussianBlur from lightly.transforms.multi_view_transform import MultiViewTransform from lightly.transforms.rotation import random_rotation_transform from lightly.tra...
d3db0c0316a892ea5c95ad6b4ab7bfb8fcfc54c8b2b08ac3f6d12a07c7187b04
Python
10,765
291
# coding=utf-8 # Copyright 2023 The Google Research Authors. # # 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 applicab...
13711566f83c8071636167d0157559ccb0aa8dad1a7066c3b848d4ee7c84e6ce
Python
10,766
296
#!/usb/bin/env python # gtec.py # Copyright (C) 2013 Bastian Venthur # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version....
30ec8acf2741db9a4b8a473a7acf852f3dd653d3f90204003020bc4479151486
Python
10,771
398
"""Tangent space for SPD/HPD matrices.""" import numpy as np from .base import sqrtm, invsqrtm, logm, expm from .mean import mean_covariance def _check_dimensions(X, Cref): n_1, n_2 = X.shape[-2:] n_3, n_4 = Cref.shape if not (n_1 == n_2 == n_3 == n_4): raise ValueError("Inputs have incompatible...
c1633536dfd8852278f2ec8cc6450e55e0783fbd47f1fe5f3325cec2b5ded78e
Python
10,774
274
"""Transforms described in https://arxiv.org/abs/1904.07850.""" # pylint: disable=too-many-function-args,not-callable from __future__ import absolute_import import numpy as np import mxnet as mx from .. import bbox as tbbox from .. import image as timage from .. import experimental from ....utils.filesystem import try_...
a4afaf6dad679f9fc29928ef74381480e665f15c9859eade014c94b34ba65bfb
Python
10,775
320
# SOURCE: vendored from quic/aimet-model-zoo @ develop # https://raw.githubusercontent.com/quic/aimet-model-zoo/develop/aimet_zoo_torch/quicksrnet/model/models.py # https://raw.githubusercontent.com/quic/aimet-model-zoo/develop/aimet_zoo_torch/quicksrnet/model/blocks.py # # QuickSRNet (Qualcomm AI Research, arXiv:2303....
eaa989cce2021e28d60b9f4cae7a53367c63b46d35b0392ef8de996ffb006972
Python
10,780
294
"""Functions to convert preprocessed UK Biobank BOLD data to BIDS derivatives format.""" import glob import json import os from nipype import logging from nipype.interfaces.fsl.preprocess import ApplyWarp from xcp_d.data import load as load_data from xcp_d.ingression.utils import ( BIDS_VERSION, TEMPLATE_SPA...
141ab8202dd127df1abe9b7f2b716c95b66e528e476cf9918dd4f15c64bfc98b
Python
10,781
284
"""C02 FactCore substrate: identity partition, grains, joins, health, scopes. sumfam item 7 (FactCore + IdentityIndex + grain menu + capture fingerprint), item 8 (serialized HealthFacts + three-state verdict + alias exclusion), item 9 (at_capture/retained_now), and the costreport item-2 aggregation face with its D7 bo...
40a4a9b76ab0b07116cc1434c0b5ca3b7794768aa05631a842313d9d1146cb0e
Python
10,784
172
from __future__ import division from __future__ import print_function from os import makedirs, path import numpy as np import warnings def default_metric(curriculum_params, input_data, correct_output, output_mask, output, epoch, losses, verbosity): """ Default metric to use to evaluate performance when using Curric...
11ed9308a4650bcd6b4426e439e001d6fbadd5e758e3ddef28e967e1e9f32e16
Python
10,785
304
from __future__ import print_function, division, absolute_import import argparse import os import shutil import time import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim import torch.utils.data import torchvision.transforms as transforms import torchvision...
3f4d1fbc5bbe9fc814f89ab488370c5b14a26683974bcfb709e2b8df9c930961
Python
10,788
325
# coding=utf-8 # Copyright 2024 The Google Research Authors. # # 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 applicab...
e8c5eb28ba664fa2a3227d5b08513def7d0321c9ee2b0a3ad45d39a2f5204b7d
Python
10,788
294
"""Real-model Tier-1 rows (memo sec 8.1 items 3-4, 8; sec 8.2 expectations). Toy-only validation is disqualifying — the shipped structure-only suite was green while five defect mechanisms lived on real models. Structure-only capture is CPU-cheap, so genuine HF rows run every PR (offline: config-built twins, cached che...
beb116833e75cbd0e6ca67b43ed849263f0ffc9418079fe6d19a79d37e8b69dc
Python
10,791
262
"""Per-layer result cache for the out-of-core engine. With ``engine="out_of_core"`` each feature read (``get_buildings``, ``get_landuse``, ...) is assembled by the bounded per-call path and then its **result** is written once to a persistent GeoParquet under a temp directory, keyed by the source file + the read's para...
7065ae7d6fbbe39d32cd91dfb0d71fee725d2a1281dbe99f86db65079f9634fb
Python
10,793
282
"""Opaque / non-finite non-tensor model-input honesty for sparse runnable execution. Round-4 hardening. The round-3 fix witnessed *grammar-encodable* non-tensor Python inputs (bool/int/finite-float/str/None) so a changed control input diverges instead of false-verifying. But a non-tensor leaf *outside* the frozen lite...
05274e8325e9db47a61f9be877f9bfd50c90091b8c500b98c3c8e528e375d87f
Python
10,796
254
"""P1-8 · 回归校准位移的区间:把 β̂ 自身的不确定度算进去。 为什么这个脚本必须存在 ---------------------- 稿件 3.7(b) 把肺时钟的位移换算回年龄尺度: Δage ≈ ΔY / β̂ = (−2.11) / 0.136 ≈ −16 年 95% 区间:bootstrap 重抽 220 人校准样本 → [−20, −13] 两处问题,都是 R2 指出的、必须由脚本固化而不是手改的: 1. **方差放大因子写错了量。** 稿件写 "variance amplification ≈ 1/r² ≈ 3.4"。 但 age = Y/β̂ 是**除法**,一阶传播给出 ...
d52edd8d70d76f8ca51196b87aa891d8b50570e41841731be9101907a5daa096
Python
10,796
281
import os as os import sys import json import jsonschema import pywt # Local dependencies import train import basics import eval ################################################################################# def make_config(model_name): return { 'cwd': '', 'nadh_data': '', 'fad_data': ...
5391b3984aaffba93db648d6ecba587f6481acab24922f285bd27fe0262b3758
Python
10,798
281
import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import Normalize, LogNorm import matplotlib.animation as manimation from mpl_toolkits.mplot3d import Axes3D import mpl_toolkits.mplot3d as a3 from spitfire.chemistry.mechanism import ChemicalMechanismSpec from spitfire.chemistry.flamelet2d import...
0e1bd2729b97efcf34aa46822f5bf3190aa514dee1bfc7d963498c002abf6658
Python
10,802
329
import attr import numpy as np from working.synthetic_data.mutation.codon_mutation import CodonMutation from working.synthetic_data.splicing_mechanism.place_splice_sites import ( add_splice_sites, ) def codon_realization(codon_table, slpd, rng): """ Realize codons from a splicing length pattern distribu...
8c4c575f094fd84d3a0a8ec87ff8d36377113a7192b39ae8a593d59dbda71aaa
Python
10,802
282
""" This module contains controllers for adaptive time stepping based on embedded temporal error estimation. """ # Spitfire - a Python-C++ library for building tabulated chemistry models and solving differential equations # Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC (...