sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c0f9e28502a547875b09a4df25c826d9349e6ffbf7c9175b609e435917e743b0
Python
14,147
400
import json from transformers import ( T5ForConditionalGeneration, ) import transformers from transformers import AutoConfig, AutoModel, AutoTokenizer, AutoModelForCausalLM import re from transformers import LlamaForCausalLM, LlamaTokenizer from typing import Any, Dict, List, Mapping, Optional import numpy as np im...
d50fab8c36529217bcd70e97a5cdb5b8f3aa6bf5fcca5e414282520a980a1ba1
Python
14,147
411
"""Tests for specparam.models.model, including the model object and it's methods. NOTES ----- The tests here are not strong tests for accuracy. They serve rather as 'smoke tests', for if anything fails completely. """ import numpy as np from pytest import raises from specparam.utils.select import groupby from specpa...
e0d28467993f352378f073d6cc44164d55c2a828321b525afc35861516738458
Python
14,147
390
import torch from torch import nn from torch.utils.model_zoo import load_url as load_state_dict_from_url __all__ = [ "ResNet", "resnet18", "resnet34", "resnet50", "resnet101", "resnet152", "resnext50_32x4d", "resnext101_32x8d", "wide_resnet50_2", "wide_resnet101_2", ] MODEL_URL...
751f6c2dca4d2c3596c4aef06ceecee2809e0291920e272b468e9267b624e58a
Python
14,150
432
"""L5 M3 pins: rank (stacking) channel — stack_by (a), explicit + licensed auto. Covers the design-memo 4.1 contract: THE LOCKSTEP LICENSE adversarial matrix (the case list IS the predicate — every globally monotone trace accepts, every non-monotone trace refuses), the typed refusals, caption/legend disclosure, rank=s...
3bc479486fe062f5a79072c25b183169db2444f8f1d8e36377f44705162a494c
Python
14,152
287
# -*- coding: utf-8 -*- import brainpy as bp import brainpy.math as bm import matplotlib.pyplot as plt print(bp.__version__) # bm.set_platform('cpu') class PoissonStim(bp.NeuGroup): def __init__(self, size, freq_mean, freq_var, t_interval): super(PoissonStim, self).__init__(size=size) # parameters ...
1ec81338f4319d88a02267345c8bfb963e0326de70174b21fdf91d8a47829b15
Python
14,157
281
# 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...
e77e969ebe04e1783fdc34c47b88d5fdcb0b7c77b1b18da439d8d58822a4e20c
Python
14,157
404
from abc import ABC, abstractmethod from typing import Optional, Tuple import pytest import torch from pytest_mock import MockerFixture from torch import Tensor from torch.nn import Parameter from lightly.models import utils from lightly.models.modules.masked_vision_transformer import MaskedVisionTransformer class ...
f1bc23c51dfde8df54bcacc8bef4c5cd90d7daaeebb068ba97050c224173ca15
Python
14,159
437
import pytest from pyrosm import get_data from pyrosm.config import Conf # The values used to determine oneway road in OSM oneway_values = Conf.oneway_values oneway_col = "oneway" @pytest.fixture def test_pbf(): pbf_path = get_data("test_pbf") return pbf_path @pytest.fixture def walk_nodes_and_edges(): ...
2e6ea92fe03dce336898c63c1f4e40ce4d0463c0e0c820770973a63e588b9bea
Python
14,161
340
from keras.src import backend from keras.src import ops from keras.src.api_export import keras_export from keras.src.backend import KerasTensor from keras.src.backend.common import standardize_dtype from keras.src.layers.layer import Layer @keras_export("keras.layers.Attention") class Attention(Layer): """Dot-pro...
54ea3dc814a2e4a1b7e854408dc93819ce86a14561a26e0fd7f01b3b197e8db9
Python
14,168
345
###################################################### # This file converts raw HIVdb data files (PI, NRTI, # # NNRTI) into easy-to-use fasta files for # # classification. # # # # Author: Jonas Ditz ...
7aeb70b82923ef22877f963a22264ac87808f6181081f88d2fdd95a6f761fb36
Python
14,169
400
""" ---------------------------------------------------------------------------------------------------- Utility for applying settings to device, from a loaded config ---------------------------------------------------------------------------------------------------- Simply call `config_apply_to_device(...
9627ce5404ad4d39418186a55d73ce578b1c508ca37e1fdc49288047026d6280
Python
14,174
378
"""Ancestry/reachability invariants and the label surfaces they guard (B3 L4). Four defects, one gap: * The whole derived ancestry class had NO tripwire. Between two labs, eleven planted corruptions across ``input_ancestors``, ``output_descendants``, ``root_ancestors``, ``internal_source_ancestors``, ``internal_s...
cace832d3403b40d0f7463eee0d85198c30cadbe68df3d3a3a7a4ce4ae9a6749
Python
14,175
249
""" GloDyNE (or previous called DynWalks) https://github.com/houchengbin/GloDyNE STEP1: prepare data STEP2: learn node embeddings STEP3: evaluate downstream tasks GloDyNE hyper-parameters: limit=0.1 # limited computational resources i.e. the upper limit # of selected nodes ...
e63badf3677bc9791c9425a4e7c7ea03d835ce68dc1aa19350204f06b364bdd4
Python
14,175
364
# MIT License # Copyright (c) 2018 Adrian Wolny (https://github.com/wolny/pytorch-3dunet) # 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 t...
5b0fa23c9ce18ab0bfabb3de4ae259a96d9577bd6e20851726eeed74b0fff0eb
Python
14,181
372
import sys import argparse from Bio import SeqIO from Bio.Seq import Seq import pandas as pd import os import numpy as np from seqtools import SequenceTools from collections import Counter ######################## ## HARD CODED THINGS ## ####################### # Firmly set the indexing of nucleotides and amino acid...
c4c2c85b2a6606164f718abc6e8483a8eaa73305d30de2ec4e26323db87fba0c
Python
14,184
326
import hashlib import json import logging import os import sys from functools import cache, partial from pathlib import Path import torch import yaml from llama_index.core import Document, SimpleDirectoryReader, VectorStoreIndex from llama_index.embeddings.huggingface import HuggingFaceEmbedding from llama_index.embed...
3c75b76b4522beda3a110750de5bef70b29b0c2eecf17431300046a6b3dea3b0
Python
14,192
386
# 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...
0a68b2226dddf4b8cea10c5fc7734872965114ae8607cc9c97e519c4e5824928
Python
14,195
344
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 14 15:13:14 2020 @author: Audrey Mazancieux This script performes "event-related" analyses for one subject that has performed the local-global task on signal extracted from an ROI in native or standardised space (using the extract_timeSerie scri...
00ea699255a754a163efc31c325c92b6a1e533e5af896114eae0359cf1d0183e
Python
14,196
309
# FAITHFUL PORT of https://github.com/hqyyqh888/DeepUnfolding_WMMSE @ main # (original: untyped procedural numpy/numpy.matrix script with module-level global # state -- `DeepUnfolding/train_main.py` `forward()`/`test_model.py` `forward_test()` # -- not a runnable nn.Module, and not torch) # # Ported functions: `t...
4cc942eb89143a02db864be8ecda294e357359c5ed7d48daeca6c246be5262ff
Python
14,200
432
# --- 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 Contours(_BaseTraceHierarchyType): _parent_path_str = "contourcarpet" _pa...
33857b01ea704109aa0dd12b4f03e0aeb8a2b6be5e92a98e9b1d58a4d624668b
Python
14,203
316
"""Round-47 security regression (finding secE_1): a POSITIVE forward-dunder allowlist on the run-path callable-reattach gate, closing the ``torch.Tensor.__setstate__`` storage- REBIND class (and its non-forward dunder siblings) the r43/r45 belts miss. secE_1: ``torch.Tensor.__setstate__`` passed ``is_pure_forward_call...
d07c9707f605c6baba41fc60a61393a817394e0f3e6f2f5b7a6d5b3bfebd2d04
Python
14,204
344
"""Mech-interp kit core suite (lane F05; mikit Gate 1 identities on R0). R0 realism: real upstream HF model classes (GPT2LMHeadModel fused-Conv1D, LlamaForCausalLM rotary/RMS/GQA) with constructed weights, zero network. Capture-bearing tests share module-scoped traces and are tiered ``heavy`` (the traces cost seconds)...
f67f06dcf431c916a78097ef87beb477b19e5702a121f22393aa9aa3158ad922
Python
14,209
578
# Copyright 2023 DeepMind Technologies Limited # # 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 agree...
e739b319effde3b37809b2c86a5bc4b8a6a46fdf25ec401ae68b74c5e1eff920
Python
14,211
424
import pickle import numpy as np from absl.testing import parameterized from keras.src import backend from keras.src import layers from keras.src import saving from keras.src import testing from keras.src.layers.core.input_layer import Input from keras.src.models.functional import Functional from keras.src.models.mod...
4235f7089ee4cc9ea7ddf5633f1615956e4d379ec87f6dabd05a29253707c4e5
Python
14,214
441
"""Static buffers returned from ``forward()`` must yield real output layers. Regression coverage for the buffer-sole-output bug (raised 2026-06-05): a model whose ONLY output is a static registered buffer (``def forward(self, x): return self.buf``) used to capture no output layer at all -- ``tl.trace`` "succeeded" wit...
91529adf19103f3cd83e18983d1a0006c8874fc7b7db5e88f75130667e227ba8
Python
14,219
318
"""Round-45 immunizer: exhaustive classification of Tensor getset-descriptor properties. The safe pure-read tensor-property surface (``x.T`` / ``x.mT`` / ``x.H`` / ``x.mH`` / ``x.real`` / ``x.imag``) is the single canonical set ``torchlens.utils._callable_safety._PURE_TENSOR_PROPERTY_NAMES``, shared by the capture-sid...
3ac16f2cb5bedbdd7899d9ae108160ea82193684889ed8517c1c800bfa66d6f1
Python
14,223
321
"""Committed R0 expectations: floors, diffs, manifests (build rows A4/A5). ``expectations_r0.json`` is the REVIEWED measured golden (generated against transformers 5.18.0 / torch 2.13.0 on 2026-10-04 by tracing the committed ``families.py`` builders; regenerate deliberately, never with ``--fix``). The fingerprint and ...
a01a0801263920381717bd2105e01b876eb213becd2562c57366c7efc7ee45dd
Python
14,223
328
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 9 11:33:54 2022 @author: yihaoy """ #%% loading libraries import matplotlib.pyplot as plt from scipy.spatial import distance from scipy import signal import numpy as np import jsonpickle import json from Neuro2Nets import Neuro2Nets from datetime i...
92a8a73e11aaad471dc2723aef3804e5baa03901b019071b042af04c010ea3f0
Python
14,226
319
from typing import Iterable, Optional, Tuple import argparse import collections import os import random import pickle import torch import torch.nn as nn import tqdm import transformers from .utils import device, PrefixLoss, PrefixModel VERBOSE = False # whether to print grads, etc. TOP_K = 20 # for printing grads,...
b28131abd5510b33ebee9621fbc3a170b0af703c6703368c3c8063156f5f801f
Python
14,232
269
import random import os from envs.tunl_2d import Tunl, Tunl_nomem from agents.model_2d import * import numpy as np import torch import matplotlib.pyplot as plt from datetime import datetime import argparse from tqdm import tqdm import re import sys sys.path.insert(1,'/home/mila/l/lindongy/deeprl-timecells') from analys...
624ccb9036e629183a36f66fce6876d77b52298d9665dbb7147a34bbc5017234
Python
14,235
467
"""Tests for the Phase 13 ``torchlens.compat.report`` API.""" from __future__ import annotations import warnings from collections.abc import Iterator import pytest import torch from torch import nn import torchlens as tl from torchlens.backends.tf._tf_compat import get_tf_capability_snapshot from torchlens.compat i...
8be4074c8376b4baa5187135f53c23af60caccb297ec1e00d64ecd063672653d
Python
14,235
344
''' Util functions and classes for neural system identification Author: Santiago Cadena Last update: April 2019 ''' import numpy as np import os from scipy import stats import tensorflow as tf import tensorflow.contrib.slim as slim import hashlib import inspect import random from tensorflow.contrib import layers fro...
d2fccb6337160185ff0cad94ae13610fb3d45e8273576002682f4134267c5914
Python
14,241
292
""" bids_retro main script author: Lucie Chalet """ # import packages import argparse import os import pandas as pd from database_overview import database_overview from quality_testing import * from utils import * def bids_retro(args): """ Formats DICOM database to BIDS standards for PET and MRI pre-clini...
45bf67fafd97b0a7e1d8ca6cf07fb7aedd34dd79b128d37de8e3e796031796c1
Python
14,242
364
from telnetlib import Telnet import torch import torch.nn as nn import torch.nn.functional as F import torchvision.transforms as transforms import numpy as np from optical_unit import * from electric_unit import * from optical_layer import FourierConv class DDNN_w_PhaseNL_NP_1ch_3layer_readout(nn.Module): def __in...
d6aa6b69a2d4c130ec47f05cdcc0a3349c5f81c5266c49d62c7313497b32289e
Python
14,242
394
import logging from autouri import AutoURI from .caper_base import CaperBase from .caper_labels import CaperLabels from .caper_wdl_parser import CaperWDLParser from .caper_workflow_opts import CaperWorkflowOpts from .cromwell import Cromwell from .cromwell_rest_api import CromwellRestAPI, has_wildcard, is_valid_uuid ...
b3dbd0ed82b9fa4555e7a0b2d60d5353e75adb6d71b7111ddb918e6b7eee61a7
Python
14,251
329
''' funkcija za RNN model: stavljaju se nekolko stacked RNN layera ''' # osnovne biblioteke import numpy as np import pandas as pd import math # set to run on CPU # Early stopping from keras.callbacks import EarlyStopping # Evaluation from sklearn import metrics # import funkcije za eval...
12f87068a1ba974ddd194f68113e210177f059c1e74fb2a4db7e42da6f8bf7b5
Python
14,252
363
import theano import theano.tensor as T from scipy.optimize import minimize from scipy.ndimage.filters import gaussian_filter as gf from numpy import fft import numpy as np def setup_graph(): """Setup the theano graph for all possible operations.""" n_x = T.lscalar('n_x') n_y = T.lscalar('n_y') pos_x...
bdbcfd8c9e5d41b6880686d2dd1910ba7ed408d41af57ad1ca95876593b694f9
Python
14,255
403
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import json import os import time from collections import defaultdict import numpy as np import torch from cpa.data import load_dataset_splits from cpa.model import CPA, MLP from sklearn.metrics import r2_score from torch.autograd ...
c660f9471706ab338d8aa41ef66701aae126ee4126d25a78b1965df68c21e133
Python
14,260
383
import numpy as np from keras.src import backend from keras.src import testing from keras.src.backend.common import keras_tensor from keras.src.ops import numpy as knp from keras.src.ops import operation from keras.src.utils import traceback_utils class OpWithMultipleInputs(operation.Operation): def call(self, x...
d393367b099057007a0698407e903989b7480575d013ef871eedbc3448d0884b
Python
14,262
437
"""Interfaces for the concatenation workflow.""" import itertools import os import re import pandas as pd from nipype import logging from nipype.interfaces.base import ( BaseInterfaceInputSpec, File, SimpleInterface, TraitedSpec, Undefined, isdefined, traits, ) from xcp_d.utils.concatenat...
d23dd794ecf7120b984706689c60a1010500a4cd1082ed4e25ed6835f6313477
Python
14,266
369
from os import path # from threading import Thread import traceback import logging import time from ethoscope.web_utils.control_thread import ControlThread, ExperimentalInformation from ethoscope.utils.description import DescribedObject import os import tempfile import shutil import multiprocessing import glob import d...
6379a12e9af4ead48e88018618c0e8f09cecfa18583e6a370521978258c94d1f
Python
14,272
275
import json import random from copy import deepcopy from pathlib import Path import numpy as np import open3d as o3d import torch from scipy.spatial.distance import cdist from tqdm.contrib.concurrent import process_map # or thread_map from external_src.group_free_3D.pointnet2.pointnet2_utils import furthest_point_sa...
f44c00fe9980467e13b2e8bcede897f7ab127ff953339f0f4314da1e6675ab2f
Python
14,275
337
# FAITHFUL PORT of https://github.com/IDEALLab/airfoil-opt-gan @ master (original framework: TensorFlow 1.x) # # BezierGAN for airfoil-manifold capture / aerodynamic shape optimization # (Chen, Chiu & Fuge, "Aerodynamic Design Optimization and Shape # Exploration using Generative Adversarial Networks", AIAA SciTech 201...
7ffbbeecacc2159e615723d5b3dc680ddb40b0738d26f33b7509c2acf62941cd
Python
14,276
373
"""``.data``-alias intermediate-layout fail-open closure (r75 F1). Round-74 (hon1 + free-roam, cross-lab) confirmed the r73 intermediate-layout net FAIL-OPENED on unlabeled receivers: the C-level ``.data`` getter destroyed labels and ``_base``, so ``(x * 2).data.is_contiguous(channels_last)`` recorded nothing and a ch...
f546f07c42f9418e37ea8308d4bb455a8861a19f94cf01ef1b2663507fea864c
Python
14,276
491
import os import sys import tempfile import operator import functools import itertools import re import contextlib import pickle import textwrap from setuptools.extern import six from setuptools.extern.six.moves import builtins, map import pkg_resources.py31compat if sys.platform.startswith('java'): import org.p...
6ada0b163dce0f929f5ec6b975804c0bf988d3a974ebc179c99845e2395ed490
Python
14,280
355
"""Prepares a distribution for installation """ import logging import os from pip._vendor import pkg_resources, requests from pip._internal.build_env import BuildEnvironment from pip._internal.download import ( is_dir_url, is_file_url, is_vcs_url, unpack_url, url_to_path, ) from pip._internal.exceptions import (...
d43e8747281c0ea5671fdc157064fccd344f1bc09c83f1491a7530cfa8bd4216
Python
14,280
440
""" sess_trace_util.py This module contains functions for processing ROI trace data from files generated by the Allen Institute OpenScope experiments for the Credit Assignment Project. Authors: Colleen Gillon Date: August, 2018 Note: this code uses python 3.7. """ """ sess_trace_util.py This module contains fu...
01503850f387884629a1bc95e4846828ffcaef80473ff4e2360e629099267428
Python
14,286
467
import collections import enum import logging import os import sys import typing import warnings from rpy2.rinterface_lib import openrlib from rpy2.rinterface_lib import callbacks from typing import Protocol logger = logging.getLogger(__name__) ffi = openrlib.ffi # Container for module-level C objects needing to be ...
a3ba98a8c1eeac661286cd0768c663990e0eb4e22922a82a7280d29baded4257
Python
14,290
358
"""Benchmarking module for AlignmentFile functionality""" import os import pysam import sys import pytest from TestUtils import make_data_files, BAM_DATADIR, force_str, flatten_nested_list import PileupTestUtils def setUpModule(): make_data_files(BAM_DATADIR) class TestPileupReadSelection: '''test pileup f...
a4dea346a7a1f6168391da70043a60bad92df33d192168ab7d49cf3c30e32589
Python
14,290
358
import numpy as np from sncda import SNCDA from gates import get_ros, ros_inf from gates import get_parkinsons_rotenone from gates import get_parkinsons_type2 from mitochondria import Mito from utils import Recorder, Q_nak from steady_state import get_steady_state import figure_properties as fp import matplotlib.pypl...
f7aad4707386e8680a7a4e10a5d30cfe91a521f104d12271fe61056baf6ca39b
Python
14,290
363
"""Helpers + fitted-projection contract tests (memo B7/P6/B8; lane F19). Covers ``srp_dims_for`` (the honestly-labeled dense-JL heuristic), ``srp_fidelity_probe`` (the T-C12 provenance-bearing report), the P6 ``tl.stats.PCA`` additive upgrade (mean/n_samples/n_features/digest, deterministic sign canonicalization, the ...
86f28207c0a6aefbdbc6bffc092554bd72923917ed773f0a94f9fc0bddd2008a
Python
14,295
320
''' funkcija za RNN attention model: stavljaju se nekolko stacked RNN layera i na kraju samo ide attention layer, nakon svih RNN layera ''' # osnovne biblioteke import numpy as np import pandas as pd import math from attention import Attention # set to run on CPU # Early stopping from keras.callba...
cff0915e431de43a7c99068fba7a5baa6b65b86172b8d0ba6b0a49208a4a4491
Python
14,301
366
import json import pathlib import pkg_resources import numpy as np from PyQt6 import uic, QtCore, QtWidgets from .. import formats from .colocalize_pgrois import StructureCompositeGroupedROIs class Colocalize(QtWidgets.QWidget): def __init__(self, *args, **kwargs): super(Colocalize, self).__init__(*arg...
bd5d26dcf71066fbe1325b587644ebcd856711709046af4f0b6c18cdf238501e
Python
14,302
374
import argparse from typing import Any, List, Tuple import torch from pytorch_lightning import LightningModule, Trainer, seed_everything from torch import Tensor from torch.optim.optimizer import Optimizer from torch.utils.data import DataLoader from pl_bolts.datamodules import ExperienceSourceDataset from pl_bolts.m...
23f3bd9ab1edfcc70cf90e2040f108b98e87200df53eef60f171eca6ee47c4d7
Python
14,303
416
""" ROI Template Manager for organizing and managing ROI template files. This module provides utilities for managing ROI template files, including loading builtin templates, validating templates, and converting legacy ROI builders to template format. """ import json import os import warnings from typing import Any f...
68bb16a3dc3fc18d315469fd34f97ea2597d945f39a98870cd6efb5b136b1f47
Python
14,306
333
"""P0-1 · Exhaustive sign-flip permutation for the GSE169148 paired cohort. Why this script exists ---------------------- The manuscript's central quantity is the *distribution of signs* of the paired delta -- "12 of 18 mortality outputs decline against 7 of 18 chronological ones" -- and until now it was reported with...
2fdf7cb51151b431c61acb6d45cfd22ad250207c2284e87b9e52460d4b422ade
Python
14,308
411
# -*- coding: utf-8 -*- """ Created on Mon Feb 15 13:24:28 2021 @author: KEPetousakis """ import Code_General_utility_spikes_pickling as util import numpy as np import Code_General_Nassi_functions as nf import matplotlib.pyplot as plt from copy import deepcopy as dcp import scipy.stats as stats import matplotlib impo...
c5dcaabba0c9b81012888b1c896cf18c1d255f1c0e249468c394815fe7562356
Python
14,308
405
#!/usr/bin/env python import argparse import glob from pathlib import Path # try to set cache/config as early as possible (for clusters) from util import gen_util gen_util.CC_config_cache() from matplotlib import pyplot as plt import torch import pandas as pd import numpy as np gen_util.extend_sys_path(__file__, p...
f04341fd3da133229b2b099f26d8582f6d844a909502215e003879defcf9ac87
Python
14,313
354
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in May 2018 @author: Nathan de Lara <nathan.delara@polytechnique.org> @author: Thomas Bonald <bonald@enst.fr> """ from typing import Union import numpy as np from scipy import sparse from sknetwork.embedding.base import BaseEmbedding from sknetwork.linalg imp...
a7ff7f573fcaf90e4f2a25ad1dd920d76cbf5efe168c7f2b929c57a51ef4acee
Python
14,315
352
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: bream/platform_qc_results.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection f...
3b3daa38e1a49508f5b07e8f8b25364bf467eeba1bb7f3cb30db3f891ab91801
Python
14,321
376
import tensorflow as tf from tensorflow import keras import numpy as np import time from matplotlib import pyplot as plt import pandas as pd import random #%% select a portion of data from database from gemmi import cif number = [] I = [] for i in range(0, 1000000):#1667834 try: doc = cif.re...
cf5c9a8cb1e69fe1836feaf367988794a98f6430db3bd7cda8fda35dff33dca1
Python
14,324
369
# -*- coding: utf-8 -*- """ Grammar to parse headers in Amira files """ import sys import re import time import collections from pprint import pprint TOKEN_NAME = 'name' TOKEN_NUMBER = 'number' TOKEN_STRING = 'string' TOKEN_OP = 'op' TOKEN_COMMENT = 'comment' TOKEN_NEWLINE = 'newline' TOKEN_COMMA = 'comma' TOKEN_COL...
b1bdbf8e2001f79d9e4a33a110d096c41fca66ef237f9c5008bca215d807feff
Python
14,330
374
# Copyright (c) 2024, Tri Dao. import pytest import torch import torch.nn.functional as F from einops import rearrange, repeat from flash_attn.ops.triton.layer_norm import ( layer_norm_fn, layer_norm_ref, rms_norm_ref, layer_norm_linear_fn, ) is_sm8x = torch.cuda.get_device_capability("cuda")[0] >= ...
d6fde3e2f765136458e93273d8b819dc3ed43943375c5ab2f28ddb8fb94d50c7
Python
14,334
401
"""Round-10 security regression: RCE via output-container reconstruction + member traversal. FINDING 1 (CRITICAL RCE): the portable output ``ContainerSpec`` (torchlens-owned, so the safe unpickler correctly admits it) carries ``type_module`` / ``type_qualname`` as plain KEEP strings plus literal constructor args. Reco...
7f7b4544daf065e045f39bd6930c5ecc96a661de6675ee537c5f1bb0ecf75849
Python
14,336
391
"""Round-5 security regression: load-time / run-time ``torch.from_file`` file-I/O. ``torch.from_file`` is a ``_VariableFunctionsClass`` factory that CREATES/TRUNCATES an arbitrary file (``shared=True``) or READS an arbitrary file into a tensor (``shared=False``). Its real ``__module__`` is plainly ``"torch"``, so the ...
a333561849a9fa004e83ddd19bea46cb5baf3d85048a7e4ee5d5870faaf4cccd
Python
14,336
388
from __future__ import annotations import importlib.metadata as im from larvaworld.gui_v2.registry_bridge import ( GuiEntry, GuiNavigationModel, build_navigation_model, ) from larvaworld.gui_v2.tabs.home import build_home_text, build_home_widget from larvaworld.gui_v2.tabs.placeholder import ( build_e...
776accde322d76eb0404482883ff9395beb39afc76d8ce0cd4bd9a7ab7f52965
Python
14,337
300
#!/usr/bin/python #-*-coding:utf-8-*- # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use...
534351d7b9f8fa4e16c26794a78bdbe89b8322ad0f6e14366c79649a0e3b56ad
Python
14,338
354
#!/usr/bin/env python """ Automated state annotation using a combination of linear discriminant analysis (LDA) and hidden Markov model (HMM). """ import pickle import numpy as np from pomegranate import ( MultivariateGaussianDistribution, HiddenMarkovModel, ) from sklearn.discriminant_analysis import LinearDi...
b8aca0fae46382446efc3e4a694d6dc32cb59e204aa509f5e8f8992d39b86134
Python
14,339
408
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """Statistical Parametric Mapping""" from operator import mul import numpy as np from .. import _info, fmtxt from .._data_obj import Dataset, Factor, Var, NDVar, Case, asmodel, asndvar, assub, combine, dataobj_repr from .._exceptions import DimensionMismatchErr...
dfb3c48a4c63d7829437599e6a35ce8bf99ed4f0895e658e1153e587b4063297
Python
14,340
363
"""r55 CLASS 1 + r57 immunizer -- portable device strings are closed-gate data. r54 ``sec_2`` (HIGH): a tinygrad ``.tlspec`` carries per-blob ``logical_device`` / ``device_at_save`` strings in plaintext ``manifest.json``; the codec passed them straight into ``tinygrad.Tensor(device=<attacker str>)`` where the ``disk:<...
7ea44147a7da748c84e4cedd8827644cd236061b4a3ae068e457070fca29b42a
Python
14,346
358
# pylint: disable=missing-function-docstring, missing-class-docstring, unused-argument """R2Plus1D, https://arxiv.org/abs/1711.11248. Code adapted from https://github.com/pytorch/vision/blob/master/torchvision/models/video/resnet.py.""" import torch import torch.nn as nn from torch.nn import BatchNorm3d __all__ = ['R2...
db22de0fd927c98abdaa73ab6c38ca83d49670cd129fd6f17550f1feb8b116b4
Python
14,346
300
""" Module containing all the supported datasets, which are subclasses of the abstract class :class:`robustness.datasets.DataSet`. Only includes the Dataset classes that used in Feather et al. 2022. Currently supported datasets: - ImageNet (:class:`robustness.datasets.ImageNet`) - Word-Speaker-Noise: (:class:`robu...
23f7abed1a172158c55b6f1f486db093012fe8cfeb1c17c1a5226eab71fac2e2
Python
14,347
389
"""tviz typed-record contract rows (memo D2/D5/D6/D12/D13/D16/D19). Construction validation, honesty metadata, the closed annotation-kind vocabulary, receipt attachment validation, and the sum-to-score invariant -- every ``tv_*`` refusal class is provoked here or in the render/bridge suites. """ from __future__ impor...
7e843b45c49b5b0d061608ceca70500993765e18a0509ce5449586d71f0c9e41
Python
14,350
359
import mne from mne.io import Raw from mne.preprocessing import read_ica from .constants import * from .data_types import Epochs, FrequencyBands from .modeling import CrossValidation, EEGmodel, RTmodel, Tuner from os import path, makedirs import pickle as pkl import logging import shap import matplotlib.pyplo...
ac0ecde90cdc28ba18ae73f8165e578c1c88a8fd0df76a51a38478707e612c7f
Python
14,356
352
"""Tests for xcp_d.ingression.abcdbids.""" from pathlib import Path from unittest.mock import patch import nibabel as nb import numpy as np import pandas as pd import pytest from xcp_d.ingression import abcdbids # Small imaging grid: 5x5x5 = 125 voxels; 5x5x5x4 = 500 voxels (under limit) _SHAPE_3D = (5, 5, 5) _SHAP...
12fbcd5a1af2915de54e46473a08687f07a667efec8b1286f7b5d4c906d2f437
Python
14,361
416
"""Message migration tools (Broker <-> Broker).""" import socket from functools import partial from itertools import cycle, islice from kombu import Queue, eventloop from kombu.common import maybe_declare from kombu.utils.encoding import ensure_bytes from celery.app import app_or_default from celery.utils.nodenames i...
c9216e35ef4dec2767d5676f9aa859ac0974fc2c55988ad3990c13b300882954
Python
14,368
466
from contextlib import contextmanager from unittest.mock import Mock, PropertyMock, patch, sentinel import pytest from celery import canvas, group, result, uuid from celery.canvas import Signature from celery.exceptions import ChordError, Retry from celery.result import AsyncResult, EagerResult, GroupResult def pas...
1b05181cfe37d1d9b2630eca8adab39432307f61cef0e6daf30ca3224afb8967
Python
14,369
342
"""Implicit-boundary tightening pins (L9 memo 1.2). The close routine is a journal/scavenge/finalize split whose FINALIZE guard lives INSIDE ``_close_implicit_backward_pass_if_open`` so no caller can bypass it: JOURNAL + SCAVENGE run on every close on any thread; FINALIZE (the R36-1 D2H fence + full projection) runs o...
49a8680e7990c5ac2b3285c044d677917d6fdf49435d859962388155da2a14eb
Python
14,369
347
"""Round-49 hon2_1 immunizer -- cross-thread captured-operand consumption over the PATCHABLE private-C free-function modules (`torch._C._{nn,special,fft,linalg,sparse,nested}`). r47 closed the `torch.ops.*` class surface. But a private-C FREE function (`torch._C._nn.gelu(gate)`) is a THIRD op surface: it bypasses BOTH...
f006971f690f7d74aa934d87e4afb9d8fd78731e5a50e5c35cfecaa12e00e1f2
Python
14,371
405
import numpy as np import scipy import brian2.only as br from tqdm import tqdm import matplotlib as mpl import matplotlib.pyplot as plt import pandas as pd import network import analysis from functools import partial from multiprocessing import Manager, Pool import sys from time import time import os ...
78814b70614536b3492905693c403c231ef6632d4bbc4bcc049aee721bc5526c
Python
14,376
461
#!/usr/bin/env python # # Copyright 2020 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
81c71e07c394ebcfa24809176d3bbd137a1b1ac766087af06aab351e6a087c8e
Python
14,376
403
"""Extended image transformations to `mxnet.image`.""" from __future__ import division import random import numpy as np import mxnet as mx from mxnet import nd from mxnet.base import numeric_types __all__ = ['imresize', 'resize_long', 'resize_short_within', 'random_pca_lighting', 'random_expand', 'random_fl...
f685b4142c4f057e4dcf5c220fce8e6c890b58091e3fbe9fbcb81088125e1e43
Python
14,377
384
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals, absolute_import, division from six.moves import range, zip, map, reduce, filter from six import string_types import numpy as np from collections import namedtuple import sys, os, warnings from ..utils import _raise, consume, axes_check_a...
338a29799df1445dc66390f31db4aa8252617c306a92429458b060d80667da28
Python
14,386
344
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 19 10:30:02 2019 @author: Sebastien M. Popoff Based on https://openreview.net/forum?id=H1T2hmZAb """ import torch from torch.nn import Module, Parameter, init from torch.nn import Conv2d, Linear, BatchNorm1d, BatchNorm2d from torch.nn import Conv...
59c435da630a408a4a28dfb03eab8ba5e98eb16927ae1a861fdbbb5f9923b0ea
Python
14,388
390
"""Single-parameter popup content: the Inspect/Add-Parameter view, shared between read-only display and editable clone-and-save. Standalone from `parameter_db_app.py`, which owns the popup *shell* (`_DraggableResizablePopup`) and database-wide actions (Remove confirmation, the table itself) -- these builders only produ...
527f44c6cb99b836b3fce71c761ee7b848e686035bbf2aae8a172433616e5b1a
Python
14,389
320
# This code shows the process of extracting features from a PyTorch model # developed by Meta researchers # For details about the model or paper, see https://github.com/facebookresearch/ConvNeXt # https://arxiv.org/abs/2201.03545 # Ref: Islam et al, Revealing Hidden Patterns in Deep Neural Network Feature Space...
b73850b3c396415f957c246f6177ff71cece5bda57314908cc97da06aeda627c
Python
14,398
354
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Functions for converting ABCD-BIDS-format derivatives to fMRIPrep format. These functions are specifically designed to work with abcd-hcp-pipeline version 0.1.3. https://github.com/DCAN-Labs/abcd-hcp-pi...
a2a91db4ab9344f72cd428d18239a032298a16ad78308b8725cc17d02ebff23b
Python
14,404
384
""" SETUP.py — Run this ONCE from your eeg_wheelchair/ folder. It writes all the correct source files directly to src/ so there are no version mismatch issues. Usage: cd /Users/ariachadha/Desktop/eeg_wheelchair python SETUP.py """ import os, sys ROOT = os.path.dirname(os.path.abspath(__file__)) SRC = os.pat...
2ff4e25f90bcab068a2725359314afa71400e517a7de92eb60f3b7c5638bfba0
Python
14,405
360
# Copyright (c) 2025, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri Dao. import math from typing import Optional 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, ...
5d4e57d1f3342c68665a32dba54c20298d51012c4ecae153ef10e76109e875d0
Python
14,408
392
# 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...
0975cf1728591eb2c5d3b9537a10bdd94a0c319c2946c91d4125c4479910493e
Python
14,409
386
# 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...
8728fe0c9bf1914b1939e070a64af3c1505c2f94e3620553619a235791174ded
Python
14,409
396
""" Functions to compute phases and envelopes """ import numbers import numpy as np import pynapple as nap def apply_hilbert_transform(data): """ Apply the Hilbert transform to a time-series. This function wraps :func:`scipy.signal.hilbert` to compute the analytic signal, which represents the orig...
37ae624982851d627a296600215aaaf5ce59f9f761e2b8bd88a3b70fb5f9f058
Python
14,415
423
import os import warnings import torch from tlib import tutils from ..utils.data import read_batch, get_random_subset, plot_grid from .datasets import Dataset, ImageDataset, ImageDatasetFromFiles class DataModule(tutils.classes.StateAndArgsSaver): """ DataModule combining all datasets. :param train_dat...
4000f4a2b0ec2e9f12a841d1e1e098b571c4826f32ee8b1bd725a356f7e0a697
Python
14,420
415
# SOURCE: vendored from https://github.com/automl/RNAformer @ main # # RNAformer (automl group) -- a scalable axial-attention transformer for RNA secondary- # structure / base-pair prediction, operating directly on an LxL pairwise "contact map" # latent built from the sequence via an outer-sum sequence-to-matrix embedd...
bee3a863c8474aa887b94960138983c8f40bc754d1c760f7255d20caeaa5fb69
Python
14,420
304
import os import logging import shutil import argparse import numpy as np from tqdm import tqdm import mxnet as mx from mxnet import gluon, autograd from mxnet.gluon.data.vision import transforms import gluoncv gluoncv.utils.check_version('0.6.0') from gluoncv.loss import * from gluoncv.utils import makedirs, LRSched...
efd2be0c13f3c64ab14b28d2e181ba086291a3586563fcbc5366bb9e01eda570
Python
14,420
358
# 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...
f7567f7899e5ad477631d4a63d0842059a68de0c41fcaf9978c120483ea32436
Python
14,422
306
"""Perform transfer-learning for offset stratification with a provided COVID-Net From the trained weights of a COVID-Net for COVID-19 identification in radiographs, this tool performs transfer learning to re-use these weights for stratification of patient offset (# of days since symptoms began *) Steps to use this: 1...
080d8b3831a31fc75413d5fc97a9c899a4c04b513516ca975ff6e2a174af3152
Python
14,429
360
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 28 19:17:40 2022 @author: fcheng """ '''Feature-to-Generator reconstruction.''' import glob import os import sys from bdpy.dl.torch.models import AlexNetGenerator from bdpy.dataform import Features, DecodedFeatures from bdpy.feature import norma...
e29f5594392d9d8c2be746c61c24b10c02f76b9b2882acd809ad3752c838ec5c
Python
14,430
356
"""Acceptance test of st.tl.cci.run on a synthetic Visium HD sample. Checks the results match a stored baseline, and records time and memory so they can be followed over time. It takes minutes, so pytest deselects it by default: # Baselines from the code checked out, e.g. master: pytest -m acceptance --accept...
cad5e49f3ef1bcf470610ae03dc64cee05b7dcde820a8e13af41128cdc02d080
Python
14,437
341
from typing import Optional import numpy as np from anndata import AnnData try: from typing import Literal except ImportError: from typing_extensions import Literal def _generate_vf_class( adata: AnnData, vf_key: str, method: str = "gaussian_process", nonrigid_only: bool = False, ): if v...