sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5889da5e17220655884d5a2fcfc3a1c9caa57e263d01161328e5d77e5baf5db7
Python
23,132
601
import keras from keras.src import backend from keras.src import tree from keras.src.api_export import keras_export from keras.src.distillation.distillation_loss import _convert_loss_to_function from keras.src.models.model import Model from keras.src.saving import serialization_lib @keras_export("keras.distillation.D...
59a98f6f21d573fef2e51b486876f66b554a9991dfc7821f8f62d2dd6c2875d0
Python
23,133
538
from cfg import * from flatmapper import FlatMapper sys.path.append('atlasoverlay') import atlasoverlay as ao hex2rgb = lambda x : tuple(int(x.lstrip('#')[i:i+2], 16) for i in (0, 2, 4)) class BrainPlotter: def __init__(self, a = 1, atlas_overlay_dir = './', flatmapper_dir = './', data_dir = './', ...
e920e249faf0256fe24118093d2bacd3ff2bdd18d6b2487b68fda7cd21b38b31
Python
23,133
608
""" GTN Search Library - Interface to the GTN SQLite database. Provides search over Galaxy Training Network tutorials and FAQs using SQLite FTS5 full-text search with BM25 ranking. """ import logging import os import re import shutil import sqlite3 from dataclasses import dataclass from datetime import ( datetime...
b6fd4a5187a56b6e6af5e929735333b7d28bba0cb9002d2c0f30359910ade180
Python
23,140
573
import numpy as np import pytest from absl.testing import parameterized from keras.src import backend from keras.src import layers from keras.src import ops from keras.src import testing from keras.src.testing import test_utils class AttentionTest(testing.TestCase): def test_attention_basics(self): # No ...
057d2a60f1c8d89937203654c1f2696e909f46bf16bf2f51e95b83be1c63246c
Python
23,160
639
import logging from typing import Dict, Optional, Union import torch from e3nn import o3 from e3nn.math import soft_one_hot_linspace from e3nn.nn.models.gate_points_2102 import Network as GateNetwork from e3nn.nn.models.gate_points_2102 import smooth_cutoff from e3nn.nn.models.v2106.gate_points_networks import Message...
609d624e80b1db11863155a2565cdc3dcf9b965efc6ea6fd2e3174d2f2b26157
Python
23,166
673
"""The typed batch envelope and the collate door (extract memo D9 + item 5). Every batch that reaches the model travels as ONE :class:`BatchEnvelope`: positional args, kwargs, the INPUT-DERIVED row count, the auxiliary attention mask, and a JSON-portable disclosure that rides the manifest and the resume signature. Coe...
dbb52986ff934f927f920e3493b038cf78c9e1e9049abe37e78f15f42d826b52
Python
23,170
580
"""r29 capture/validation hardening pins (round-32 re-attack closures). F1 (HIGH/SECURITY): the r28 storage-rebind ancestry barrier (91fff81c) failed open for the LAYOUT-fact family. A storage-SWAPPING ``t.data = rhs`` receiver's own label is correctly refused by the barrier (rung 1 of ``_resolve_layout_rooting_labels...
d1d9356ea131cb8afca3ceb92e5a920d760c0063e42638979176753366ee7c99
Python
23,171
399
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
6be2087f64ab63e1904c8d57f52adcced33fe7f68149317f58517abd6cd2805a
Python
23,175
613
"""SO(3) diffusion methods.""" import numpy as np import torch from scipy.spatial.transform import Rotation as scipy_R import logging import os from scipy.spatial.transform import Rotation import pickle import scipy.linalg ### First define geometric operations on the SO3 manifold # hat map from vector space R^3 to L...
e5600fdd430289b7bff29c57145c3eeeffeb803b718f380ee4959fb5a816c873
Python
23,179
583
# 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...
a95a238ab51e19aa1647418a79cb4d503a0c5b9c8241cc182eba86ee3dee17ef
Python
23,191
426
""" The proposed methoed: GloDyNE --------------------------------- limit=0.1 # limited computational resources i.e. the upper limit # of selected nodes # NOTE: limit i.e. $\alpha$ in our paper num_walks=10, walk_length=80, # random walk hyper-parameters ...
92924933da5b1262ea4c38382dd8ca0f0ed6f5c92972e8176154c3a5762e14e1
Python
23,194
588
from collections import namedtuple from jax import random, grad, jit, lax, vmap import jax import jax.numpy as jnp import numpy as np from jax.scipy.stats import multivariate_normal from jax.scipy.stats import t as studentst import optax import functools import seaborn as sns import scipy import sys import os import ma...
ebd8f6204ce5fd5efc5c3702d7556b43706dd7fb0edcf1e48aff8e1f27b1d413
Python
23,213
583
# 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...
579abcb7bfdc6572de61f416320caaa050153c8d348a2432fddd3569ee9efa09
Python
23,218
558
"""Environment-fingerprinted golden resolution for the god-lane oracles (M13). The byte-identity oracles (surface-v1, viz identity, legacy artifact, state keysets) freeze REGRESSION baselines, not cross-environment identities: a different torch/python build can legitimately change qualnames, float formatting inside re...
03d2b373205d078b5f95b1edf0508e17ac15c942560d76025a2859131b77fd1c
Python
23,251
497
import sys import numpy as np import pandas as pd import random import pkg_resources #from importlib import resources from collections import defaultdict from sklearn.preprocessing import OneHotEncoder from tensorflow.keras.activations import relu from tensorflow.keras.models import Model from tensorflow.keras.l...
c0d2b87f118e3033f6fc95fb08da144608e92a9493f4d28019fdf2ea8d019080
Python
23,257
768
""" Histograms """ from __future__ import annotations from typing import Any, Optional, Sequence import itertools import numpy as np import pandas as pd import seaborn as sns from .. import plot, reg, funcs from ..model import moduleDB as MD __all__: list[str] = [ "module_endpoint_hists", "plot_ang_pars", ...
148405f3007e6fdf9d6d35fe8b75023e09f161e59c7e23d9905ea45cc4d573ca
Python
23,261
551
''' Fast rasterization of cell coordinates into images. Implementation of STalign.normalize, STalign.rasterize and STalign.rasterize_with_signal (see their docstrings for the parameters). The results equal those of the original per-cell loop up to floating point rounding (relative differences ~1e-15). How it works -...
a3c75150b58afa7982031fdb06be0e78f63eed5bbd88fb814a4343baccbeaf83
Python
23,274
567
import logging from typing import Any, Dict, List, Union import numpy as np import numpy.typing as npt import torch from ase import data as ase_data from e3nn import o3 from pymatgen.analysis.graphs import MoleculeGraph from pymatgen.core.structure import Molecule from torch_geometric.data import Data from torch_geome...
d7fee2c5044cd863fff8a5451d28e9f5070db0ff1f37d5bcb56182cb776c10fe
Python
23,285
813
""" Classes and methods for managing nested dictionaries and lists """ from __future__ import annotations from typing import Any import copy import json import pickle import typing import agentpy.sequences import pandas as pd __all__: list[str] = [ "AttrDict", "load_dict", "save_dict", "bidict", ...
e1704bbe864798896d96bba03c350a807dd60b122076e41f160881665ff19683
Python
23,285
746
#!/usr/bin/env python # # Copyright 2005 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...
72bfedbd8f68de95c944c5f2b35faa0f517cd1f7938c9e1db661d9e966e1d38d
Python
23,301
506
import argparse import gzip import pathlib import logging import numpy as np from Bio.PDB import PDBParser, Polypeptide from constants import AMINO_ACID_INDICES from scipy.spatial.transform import Rotation def get_arguments(): """Fetch command-line arguments""" argument_parser = argparse.ArgumentP...
ef71cb1006a39d9b8c24d141ae48f7c2560c75cbff3fb98ffda2c570247d8d6a
Python
23,301
582
# 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...
f54f59ae0da1b35b5dc9f2a6b7e77726b0321fb355e9e34c5e52f3240b8ac673
Python
23,301
536
import json import pandas as pd import os import glob import torch from torch.utils.data import Dataset, DataLoader, ConcatDataset, random_split from torchvision import transforms import hashlib from PIL import Image, ImageDraw import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches na...
e645cdd6b523d36ae63289caeed65c4bc82453820c5e5a67a1dacce63350fe8f
Python
23,302
558
"""Unit tests for sensor-level analysis.""" import mne import numpy as np import pytest from mne_rsa import rdm_epochs, rdm_evokeds, rsa_epochs, rsa_evokeds, squareform from numpy.testing import assert_equal def load_epochs(): """Load some of the MNE-Sample data epochs.""" path = mne.datasets.sample.data_pat...
d4d55e5829ac94125fcb8546c05517a8e58b0700ec9a6f611b10e8e125f1bc8a
Python
23,308
552
import ipdb import torch import torch.nn as nn from ourmodel.loss_transfer import TransferLoss import torch.nn.functional as F class AdaRNN(nn.Module): """ model_type: 'Boosting', 'AdaRNN' """ def __init__(self, use_bottleneck=False, bottleneck_width=256, n_input=128, n_hiddens=[64, 64], n_output=6...
39fc66409105327a0823042e9b62b83df6d3c029fcaefbc0df1c25bdf3584d83
Python
23,327
664
# -*- coding: utf-8 -*- import os import glob import pysam import pytest import shutil import gzip from pathlib import Path from TestUtils import load_and_convert, make_data_files, slurp_file, CBCF_DATADIR def setUpModule(): make_data_files(CBCF_DATADIR) def read_header(filename): data = [] if filenam...
8ee52cf595ae3bc24c001d68221cb905cb475e012ab7f4cdd5e199cc965651ec
Python
23,333
602
# 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...
1bc7540e5a73f748a11d0d09b5e51f24269dcce88713d431decdf1e6b2091511
Python
23,351
302
from __future__ import print_function import sys import logging from statistics import mean from svim.SVSignature import SignatureDeletion, SignatureInsertion, SignatureInversion, SignatureTranslocation, SignatureDuplicationTandem, SignatureInsertionFrom from svim.SVIM_clustering import consolidate_clusters_bilocal, ...
27b407f7e9cb90eed270f5c875aae03336bb1f95202dc4753a6b8d58e9fde111
Python
23,352
686
import random import numpy as np import pandas as pd import scipy.sparse as sp from numba import jit import scanpy as sc from sklearn.svm import SVC from sklearn.neighbors import kneighbors_graph from torch.utils.data import Dataset import torch def setup_seed(seed): """ Set random seed Parameters --...
28401859a66cd54f66144c510aacc5bdafa4732c0687e63e57926c20cd41c5c1
Python
23,363
726
import pickle from decimal import Decimal from itertools import count from random import shuffle from time import time from unittest.mock import Mock, patch import pytest from celery import states, uuid from celery.events import Event from celery.events.state import HEARTBEAT_DRIFT_MAX, HEARTBEAT_EXPIRE_WINDOW, State...
bb99de12b34e3a202f863846203d2c73d691cfb83a2f8f5cc5c05464368ce688
Python
23,367
676
# -*- coding: utf-8 -*- # %% [markdown] # # Find Fixed Points # %% [markdown] # The goal of this tutorial is to learn about fixed point finding by running the algorithm on a simple data generator, a Gated Recurrent Unit (GRU) that is trained to make a binary decision, namely whether the integral of the white noise inp...
bad12efd8d18c3bb726e408e1dd0d2acfded5a8f1b50e9de78debfccf9b84b3d
Python
23,396
547
""" Copyright (C) 2022 Giansalvo Gusinu <profgusinu@gmail.com> 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, m...
034941931d095dc6c722b61c23545a1b66aec56275f9a59dcb5f591b0b853028
Python
23,403
564
# encoding: utf8 """ PyTorch implementation of the HMAX model of human vision. For more information about HMAX, check: http://maxlab.neuro.georgetown.edu/hmax.html The S and C units of the HMAX model can almost be mapped directly onto TorchVision's Conv2d and MaxPool2d layers, where channels are used to store the...
558891f373ca79a87fc70308f646d26ec63a39c633bea51ef76c47afec33e62e
Python
23,453
644
"""Regression tests for the dual predicate-consolidation review (opus + sol). Every test here encodes one reproducer from the 2026-08-11 predicate reviews (``results/review-predicate-opus.md`` / ``results/review-predicate-sol.md``). Tests marked FIX failed at 4f568d5f (pre-fix arming proof); tests marked PIN character...
654a4d9ac7d07ca0bfe20246d4dd843e454a9c0993b112a72916d61658edf9c6
Python
23,460
692
# SOURCE: vendored from https://github.com/igashov/DiffLinker @ fafbe47afe6cf068e9e1b23e7145377fb0f89f89 # (src/egnn.py -- the real E(3)-equivariant EGNN `Dynamics` network used as the noise- # prediction backbone of DiffLinker's fragment-conditioned diffusion model. The nn.Module # architecture (GCL, EquivariantUpdate...
711f93b13ceccd205da03fd3dc8288cad6d0ddf92ae1b993692e3a6a6c1066dd
Python
23,463
413
import argparse, time, logging, os, sys, math import gc import numpy as np import mxnet as mx import mxnet.ndarray as F import gluoncv as gcv gcv.utils.check_version('0.6.0') from mxnet import gluon, nd, gpu, init, context from mxnet import autograd as ag from mxnet.gluon import nn from mxnet.gluon.data.vision import ...
862a87f41c000c09adf1493f45103f8df5ba57877718dd4bada03a770bf42c05
Python
23,476
664
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """Plot multidimensional uniform time series.""" from typing import Union, Sequence import matplotlib.axes import numpy as np from .._data_obj import Datalist, Dataset from .._names import INTERPOLATE_CHANNELS from . import _base from ._base import ( PlotTy...
49ed3153ff0cc5802f8bd7e4c7bed5909d68492ba85ebae5e07500e68698f69e
Python
23,483
492
import numpy as np #try: # import statsmodels.api as sm #except ImportError: # import statsmodels as sm import statsmodels as sm from statsmodels.genmod.generalized_linear_model import GLM from tqdm import tqdm from ..utils import gislib, constants, utils from ..core.flowdataframe import FlowDataFrame distfunc =...
80dd28cdf28694e1afefdcc13535177ea7b9c92931b3487eb16998696259b543
Python
23,488
669
import numpy as np import pandas as pd import matplotlib.pyplot as plt import copy import pickle import warnings import matplotlib.pyplot as plt from sklearn.model_selection import KFold import shap from typing import Tuple import xgboost as xgb from lifelines.utils import concordance_index plt.style.use("bmh") np.r...
60afa1dbcd646667f08d182e6ca4b92ec2299ba2a122847c3af700507ded4d98
Python
23,497
615
"""L5 M2 pins: size encoding channel (``size_by`` + ``scale=``), D4 default-applied. Covers the design-memo 3.1 test list plus the 2.2 "dims" typed-shape-path pins, the 2.4(ii) funnel image-drop rule, the C2(b) width/height/fixedsize writer discipline, and the 2.3b rolled-aggregate size verdicts (size REFUSES where co...
f360ccc099a965bf7fca5f1f8129355a75088365542b78d5e52f6d8e599e5357
Python
23,499
622
"""Hardening tests for loop/recurrence grouping (round-21). Locks the fixes for the round-20 adversarial findings: * Multi-output calls (LSTMCell h/c, fused RNN/GRU/LSTM output/state slots) must produce one recurrent layer PER OUTPUT SLOT, never interleaved passes of one layer (review F3, review's fused-module ge...
7c8fd9c7a6b2f5bbba92c66e5de666fe5824f02b1abfc31c34733e06ca759c27
Python
23,502
620
from datetime import datetime, timedelta, timezone from unittest.mock import MagicMock, Mock, call, patch import pytest from google.cloud.exceptions import NotFound from celery.backends.gcs import GCSBackend from celery.exceptions import ImproperlyConfigured class test_GCSBackend: def setup_method(self): ...
31f5c77e9914ec5b9aae32220a5c9ca865cd5e70c0f752e680d126d5c61e267a
Python
23,511
609
#!/usr/bin/env python3 """ Build GTN Search Database from GTN Repository. This script processes the Galaxy Training Network repository and creates a SQLite database with FTS5 full-text search capabilities for fast tutorial search. Usage: python build_database.py <gtn_repo_path> [--output <db_path>] """ import js...
f790b99eedded9e8388021c080e10572aa7bcecb465d884ee816dec1ab93a41d
Python
23,516
389
import os import logging import numpy as np import tensorflow as tf from tensorflow import keras from sklearn.linear_model import LogisticRegression from sklearn.model_selection import KFold import matplotlib.pyplot as plt from matplotlib import cm import seaborn as sns # %% Set training parameters n_sessi...
a21b73d577bb12d622206e011b4642072321214e35207639bb9719824065e0a4
Python
23,519
749
import datetime import os.path import fnmatch import math from typing import Any, Iterable from os.path import split import numpy as np import pydicom from pydicom import FileDataset, Dataset, datadict, DataElement from pydicom.multival import MultiValue from pydicom.tag import Tag def lookup_modality(modality: None...
5571f2c456ac2800a792449e978b72040097561509826110eba32d32f3cd702c
Python
23,532
658
import os import pytest from tensorflow import data as tf_data from keras.src import backend from keras.src import layers from keras.src import models from keras.src import ops from keras.src import testing from keras.src.backend.common import standardize_dtype from keras.src.layers.preprocessing import feature_space...
2c2e806c6b1e7dea6b6097e4466fd010e460146acf7723c348cefed5d8b8be7e
Python
23,556
652
import datetime as dt import os import brainpy_datasets as bd import numpy as np import pandas as pd __all__= [ 'HarData', 'CheetahData', 'GestureData', 'OccupancyData', 'OzoneData', 'PersonData', 'PowerData', 'SMnistData', 'TrafficData', ] def _cut_in_sequences(x, seq_len, inc=1, y=None, stack_ax...
b20e6bd820803b87a9e67d8de52d11934ccb661a4c9977747bc7b0622bba8109
Python
23,582
674
""" behav_plots.py This script contains functions for plotting pupil and running analyses. Authors: Colleen Gillon Date: January, 2021 Note: this code uses python 3.7. """ import numpy as np from matplotlib import pyplot as plt from matplotlib import ticker, patches import seaborn from util import logger_util, pl...
f0cd362ce7d8e1a9c510a5236bd22b62dbcfbfff597c26ad3cc966ea79bbd271
Python
23,586
468
#import scipy import numpy as np import logging from ridge_utils.utils import mult_diag, counter import random import itertools as itools zs = lambda v: (v-v.mean(0))/v.std(0) ## z-score function ridge_logger = logging.getLogger("ridge_corr") def ridge(stim, resp, alpha, singcutoff=1e-10, normalpha=False, logger=rid...
7c2f358035191b1ef8ee7b79e31463476c9f130e9cac8fca50f68815ef81b971
Python
23,588
619
import copy import numpy as np import scipy.ndimage as ndi import scipy.fft as fft import pandas as pd from copy import deepcopy from scipy.special import factorial def pool_voxel_grids(x1, x2, pooling_method): if x1 is None: return copy.deepcopy(x2) elif pooling_method == "max": # Perform...
88afaaae7324d89b83a02daa0d7502ea190bbcc247fd4a88056b8731f1049c1d
Python
23,597
540
# -*- coding: utf-8 -*- """ @File : cci_two_cluster.py @Time : 2022/07/03 11:50:40 @Author : LuluZuo @Version : 1.0 @Desc : spatial cell cell communication """ import itertools import random from typing import Tuple import numpy as np import pandas as pd from anndata import AnnData from scipy.spar...
0c6a5cd1d131900b877aae8337a1f0a52dc0de56b96593de55aeed5b1a65da6b
Python
23,618
605
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
169ec82f55c563e12ecd64560c9f59d25c8fdef5e997248db084c0568aa6d2ea
Python
23,619
650
import torch as th import torch.nn as nn import numpy as np import random import torch.nn.functional as F from torch.distributions import Normal from torch_scatter import scatter_add from sklearn import metrics from sklearn.metrics import roc_auc_score, mean_squared_error, precision_recall_curve, auc from scipy.stats i...
b530425554f927671f02baae081298e5935babc0cf094d70ba7df9a3330e7897
Python
23,640
513
#!/usr/bin/env python """ Importer for dataset published from Centre de Conférence Pierre Mendès-France Ministère de l'Économie, des Finances et de la Relance """ import csv import sys import os import progressbar import subprocess import zipfile from glob import glob from multiprocessing import Pool import hashlib i...
ff4f5bb745b59524426516d05cb385b461c15a2fc2c0310d361a5d13d0fdb57d
Python
23,653
686
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains th...
637c739a7c6a44b50bf4e5de0cef3a4ca6cbcf07f3a2bdb14c3074218f6b31e7
Python
23,656
686
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains th...
b4cc1d282cc037ba811cabce472154a5fb02733fe138af977881fd96856f23bc
Python
23,662
784
""" Shared logic behind the environment builder. Normalizes the builder's object rows against the stored environment payload, so the canvas, the form and the saved configuration stay consistent. """ from __future__ import annotations from dataclasses import dataclass import copy import re from typing import Any fro...
ae793b145c67d571c0b2aa8149673d988d77f6a7173abd04c5a9c951cb8f116f
Python
23,666
518
# SPDX-License-Identifier: LGPL-2.1-or-later #!/usr/bin/env python #-*- coding: utf-8 -*- import os from collections import OrderedDict import numpy as np from .utils import general as utils from .plotting_functions import single_in_cohort_soc_plot from .plotting_functions import make_RasterPlot from .write_to_file imp...
e7ac321eef98c100a2cbbe84c6cc23bfeebcbf25a0987cb4fdef150b9a885357
Python
23,673
732
import logging from collections.abc import Callable from typing import Any, Self, TypedDict import numpy as np import ome_zarr_models.v06.coordinate_transforms as ozmt import pytest import transformnd as tnd import zarr from ome_zarr_models.v06.coordinate_transforms import ( AnyTransform, CoordinateSystem, ...
b04ba6dd971d09721eb9efa00d151db1e2160efc1742c4c61609406d1fe7e577
Python
23,676
528
import abc import logging import os import shutil import tempfile from typing import ( NamedTuple, ) from sqlalchemy.orm import Session from sqlalchemy.orm.exc import DetachedInstanceError from galaxy.datatypes.data import ( Data, Directory, ) from galaxy.datatypes.registry import Registry from galaxy.dat...
040e3c37dd9d160e94238d8f16a2c2520df1afdaeef9de79d40382893379d6be
Python
23,681
527
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import itertools import json from sklearn.metrics import classification_report from role_prediction.graphormer.data import get_dataset import torch import math import torch.nn as nn import pytorch_lightning as pl from role_prediction.graphormer...
a683ed9737151f1649af70a7ccdde90c527ef60e2ab9238a846adee1f27ee326
Python
23,684
656
"""Adversarial regression tests for CLC tile scheduling. These cases intentionally target scheduler-sensitive shapes: mismatched sequence lengths, non-aligned tiles, GQA ratios, minimal problems, and larger persistent workloads. This is deterministic adversarial coverage, not randomized fuzzing. """ from contextlib i...
e203579cf6c0fa472f21d353b62e386dcdd14bddfc499b010ac9e59e0173d67b
Python
23,684
572
from __future__ import annotations from typing import NamedTuple, Optional, Sequence, Union import bream4.legacy.device_interfaces.devices.promethion as legacy_promethion from bream4.device_interfaces.devices.base_device import BaseDeviceInterface Temperature = NamedTuple("Temperature", [("current_temp", float), ("d...
8a81754204aa7823a14b4ef08a2e9f220938278f4bc230034f5cd3bedad99184
Python
23,691
504
from typing import Callable, Dict, List, Optional, Tuple import torch from pytorch_lightning.utilities.exceptions import MisconfigurationException from torch import Tensor, nn from pl_bolts.utils import _TORCHVISION_AVAILABLE from pl_bolts.utils.warnings import warn_missing_pkg if _TORCHVISION_AVAILABLE: from to...
1561a6a8ca5f8ec63fd42dd7bebe2156b0be99487e0287f056f0d0708ac83611
Python
23,701
461
"""Single-shot Multi-box Detector.""" from __future__ import absolute_import import os import warnings import mxnet as mx from mxnet import autograd from mxnet.gluon import nn from mxnet.gluon import HybridBlock from ...nn.feature import FeatureExpander from .anchor import SSDAnchorGenerator from ...nn.predictor impor...
8510aa5de9eb62db602d41ae4ada2e965299697bfb6c292202115d9f3afe396e
Python
23,702
579
"""Worker command-line program. This module is the 'program-version' of :mod:`celery.worker`. It does everything necessary to run that module as an actual application, like installing signal handlers, platform tweaks, and so on. """ import logging import os import platform as _platform import sys from datetime import...
71c82ad620035f86daa97809b26de8fdcc44c8f8e0d02fc40cb034055c323f57
Python
23,706
548
# adapted from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/datasets/coco.py import contextlib import copy import datetime import time import io import json import logging import os from PIL import Image import numpy as np import portalocker from ..detection.detection_utils import try_im...
0867028f397389fc3fe4b9892b6bf77526aeb696c1e1c1889ec3d204afb34ae6
Python
23,711
535
"""Sparse-call argument decoding and binding.""" from __future__ import annotations import math from collections.abc import Callable, Mapping, Sequence, Set as AbstractSet from typing import TYPE_CHECKING, Any, cast import torch from ._runnable_state import ( _OUTPUT_COUNT_FLOOR, RunResourceCeiling, _al...
7a9e73c31cb8d96a3a54fc671f0fe1be9b696cdf079147c032eedefc71424fff
Python
23,712
805
#!/usr/bin/python3 # import modules import argparse import sys import tempfile version = "0.1.5" ############### # sb43 modified to suit casm need and output additional columns : boiotype, gnene name and chromosome # Hong-Dong Li, GTFtools: a Python package for analyzing various modes of gene models, bioRxiv, 263517...
b32fd51187a61e428dc9ae149ca05d79900e3bd3fbbcf6df1c84a85fa6612b1b
Python
23,712
543
""" MXNet implementation of tracktor in SMOT: Single-Shot Multi Object Tracking https://arxiv.org/abs/2010.16031 """ # pylint: disable=line-too-long,logging-format-interpolation,unused-argument,missing-function-docstring from __future__ import absolute_import import logging import time import numpy as np import mxnet ...
6a18a511d7ffb2468ad4d703c3bf4cd1d91b770a7f827d93e0d9a6c25a8339d8
Python
23,725
591
# 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...
0502b55ace73a14f2bb8f8536f5b71cad8224152d0b282c0930667e3d1d646cb
Python
23,731
627
import collections import ctypes import io import math import numpy as np import os import pyogg import tempfile import wave from .helpers import LimitingPool from collections import namedtuple from .io import open_remote, remove_remote, copy_remote, is_remote_path AudioFormat = namedtuple('AudioFormat', 'rate channe...
8c35b7ecf9f9794293e09ce4aac27988a9f85054ead32ad4d6c76ed1983f95f0
Python
23,753
637
import math import torch import torch.nn as nn import torch.nn.functional as F from timm.models.layers import trunc_normal_, DropPath from timm.models.registry import register_model from model import common def make_model(args, parent=False): return MogaNet(args) def build_act_layer(act_type): """Build activ...
7b335a3d1cf2dfc966da51d65d94d440711d2f2c82de8db7e57ab248d9cafad1
Python
23,767
826
import numpy as np from numba import jit # , njit, prange ################################ # Time only functions ################################ @jit(nopython=True, cache=True) def jitrestrict(time_array, starts, ends): n = len(time_array) m = len(starts) ix = np.zeros(n, dtype=np.int64) if n == 0 ...
186a963573429006223b800c6da9ec5154f123d4099cce5d2b15a48653e6f295
Python
23,778
597
import copy from keras.src import backend from keras.src import ops from keras.src import utils from keras.src.api_export import keras_export from keras.src.layers.layer import Layer from keras.src.layers.rnn.gru import GRU from keras.src.layers.rnn.lstm import LSTM from keras.src.saving import serialization_lib @ke...
46fe5408b58ea2672662c4265c398ddda00056fa9883ca2bc2b3b29f7c7a22ee
Python
23,781
679
"""Some basic example datasets for testing.""" from distutils.version import LooseVersion from itertools import product import os from pathlib import Path import shutil import string import mne from mne import minimum_norm as mn import numpy as np from .. import _info, load from .._data_obj import Dataset, Factor, Va...
64f77ecc9715d68403804f2e23ff1fc8eb27549b31c9a96d0fff63cddce62c87
Python
23,782
458
#!/usr/bin/env python # coding: utf-8 # In[3]: import tensorflow as tf import tensorflow.keras as keras from tensorflow.keras.layers import Reshape, Input, Flatten, concatenate, Dense, BatchNormalization ,Conv1D,Conv2D,Conv3D,MaxPool1D, MaxPool2D,MaxPool3D, GlobalMaxPool2D, Dropout from tensorflow.keras.optimizers i...
f902d3d32d6a2b863b5898ef4b92ef3946b5539c1912908a895dae53e2cbc28f
Python
23,785
755
import logging import os import sys import numpy as np import mne sys.path.insert(0, '/mnt/homes/home024/abraun/pymeg') sys.path.insert(0, "/mnt/homes/home024/abraun/conf_meg") from optparse import OptionParser from os import makedirs from os.path import join import pandas as pd from joblib import Memory from pyme...
e3e6d67672672673b4c53c6a874f77d07bb84f438a916ecb582c177bb515bc81
Python
23,790
755
"""Tests for ``tl.debug.infer_input_shape``.""" from __future__ import annotations import torch import torch.nn.functional as F from torch import nn import torchlens as tl class TinyMlp(nn.Module): """Simple MLP with a statically readable input width.""" def __init__(self) -> None: """Initialize l...
e4e21394eb608858d246885b8001a42b249d49f9e5de992fa79e046dffff6534
Python
23,794
710
"""Callable identity for extraction resume (extract memo D8 + item 15). The classifier digests everything a Python callable can OBSERVE — bytecode, signature facts, default values BY VALUE, closure cells BY VALUE, and every global name the bytecode actually loads — and refuses exactly where it is blind. The classifica...
eae7c17a4172b5c0f0731acedcbbaf91d7f14edc46d218719ed4d86f5646883a
Python
23,808
559
import logging import os import time import traceback from datetime import timedelta from typing import TYPE_CHECKING try: import pbs PBS_IMPORT_MESSAGE = None except ImportError as exc: pbs = None PBS_IMPORT_MESSAGE = ( "The Python pbs-python package is required to use " "this feature...
1b7da400b07169fdada99b69e7da61a731c411e539b2140c27e517a33e79c5e2
Python
23,811
688
import warnings from keras.src import backend from keras.src import layers from keras.src.api_export import keras_export from keras.src.applications import imagenet_utils from keras.src.models import Functional from keras.src.ops import operation_utils from keras.src.utils import file_utils BASE_WEIGHT_PATH = ( "...
20540c1f3a098f69047b4218bf3c8fbd814d8a6f7ac6080d00042ba80b2300ff
Python
23,845
634
"""Output-tree reconstruction honesty for the unified ``Trace.run`` surface. Round-6 hardening. A run reporting ``VERIFIED`` MUST return the exact output object -- correct container TYPE, all non-tensor literal leaves byte-exact, all fields. A lossy or wrong output must be ``UNVERIFIABLE`` (or diverged), never a silen...
5b0caf4e1b5c985327263835bc85130bf4cb26b3379d18de45d6f7b3b6cb84b4
Python
23,854
608
"""Capture-OUTCOME corpus for detached torch references — the stage-2 deletion gate. This module converts the detached-reference corpus from patch-MECHANICS assertions ("the crawler rewrote slot X to wrapper Y") to capture-OUTCOME assertions ("the op appears in the trace" / "the miss has exactly this signature"). The ...
4664451da073dd7502d997d56219cfcb5d63db39ca3607f797630c6f293ab9d5
Python
23,874
606
import unittest from unittest.mock import patch from codecarbon.core.emissions import Emissions from codecarbon.core.units import Energy from codecarbon.external.geography import CloudMetadata, GeoMetadata from codecarbon.input import DataSource from tests.testutils import get_test_data_source class TestEmissions(un...
9716d26935187ec2227c5eb20c80dc8f5a030aff62ca1c0333fadcafe0f1363d
Python
23,876
589
"""Consumer-ledger generation and closure gates (P0). Regenerates the ledger from the tree and the scenario battery every run, asserts the closure properties, and DIFFS the regenerated inventory against the git-tracked artifacts next to this test, so P2 keeps a reviewable migration checklist and producer/consumer drif...
1a760bba2ff4ec0ef39182c8b4b4fda510131e67d65b93316387ff7b345c66c4
Python
23,888
616
# 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...
f625f35a689cbd0397170466f1cdf057e758e224a66f68f28b819f183facfbd3
Python
23,914
553
import pkg_resources import nanite.model as nmodel import numpy as np from PyQt5 import uic, QtCore, QtWidgets from .. import units class TabFit(QtWidgets.QWidget): def __init__(self, *args, **kwargs): super(TabFit, self).__init__(*args, **kwargs) path_ui = pkg_resources.resource_filename("pyjib...
264d0d9abba7aaadd8da9765eae0dbe7535a988e752841c354c66aa6a477e685
Python
23,920
686
""" Intermittency modules alternating between activity and pause. Larval behaviour is organized into bouts: stretches of crawling or feeding separated by pauses. These modules generate that alternation, either by sampling the bout durations from fitted distributions or by running a branching process, and gate the craw...
7ef1151636093cd2074dccdc2e5160816373630d786ff79455d65841f5c82294
Python
23,921
591
from keras.src import backend from keras.src import constraints from keras.src import initializers from keras.src import ops from keras.src import regularizers from keras.src.api_export import keras_export from keras.src.layers.input_spec import InputSpec from keras.src.layers.layer import Layer # TODO(abheesht17): M...
7711993dff82b1dd60478cac81145d9d3c61e773e20a5d88417c255ef895a7c7
Python
23,922
719
""" The dataset analysis app. Lets the user pick stored datasets and render the plots that apply to them. """ from __future__ import annotations from html import escape from typing import Any import pandas as pd import panel as pn from larvaworld.lib.reg.graph import GraphRegistry from larvaworld.lib.process.datas...
2898e7265e33ff418a1c73b1166c6b4619f421b4717c4442cd12730af77d393b
Python
23,926
570
""" Functions specific for LIFE data set. """ import os import numpy as np import mne import pandas as pd from tools_general import load_json def read_erp(subj, dir_data, decim=1, notch=False, h_freq=45, baseline=(-.2, -.05)): """ Read the data from stimulus based recordings Adapted from Denis Engemann <...
36e858ca5249065e7dba11be128cb31588195b30e117b5d9007f0a51d29bb9ee
Python
23,941
482
#!/usr/bin/env python3 """Журнал протокола B («Когда выгодно учиться»): статистика и HTML-секция. Читает runs/daily/protocol_b.jsonl (суточный прогон runs/daily_b.py), считает по всему накопленному то, что объявлено в PREREGISTRATION_B.md, и отдаёт машинное состояние (docs/journal_b.json) плюс HTML-фрагмент, который r...
23c72f3d7e57dc063bbf6b7b24c25af78f24fde77df61e6cadfad25c397eeb0c
Python
23,964
616
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import logging import math import random import numpy as np import torch import torchvision.io as io from . import transform as transform logger = logging.getLogger(__name__) def temporal_sampling(frames, start_idx, end...
29cd8e3d15eeaaef3ee5c9714aa0dd910c7b4ce81765e2922ed2b557ec0f4329
Python
23,965
592
""" Validation functions for input preprocessing. This module contains functions to validate different aspects of the input data before it's processed by the preprocessing pipeline. """ from typing import List, Dict, Any, Tuple, Optional, Set import logging import os import copy import json import re import tempfile ...
310d00679ef920dd6e0c82fe8f9dcf202a2c495979f2040b24297d2b41084d98
Python
23,966
808
import builtins import inspect import io import logging import os import platform import sys import threading import types import warnings from contextlib import contextmanager from functools import wraps from importlib import import_module, reload from unittest.mock import MagicMock, Mock, patch import pytest from ko...
35a8d8af169aeed47bf8e5b8d7d9ec59ae1d54ba6d69e9c024af43599cfeec35
Python
23,972
605
"""Three-layer capture snapshots for the parity harness. A snapshot canonicalizes one capture into JSON-able structures across the three comparison layers the design-of-record names: * ``journal`` — the op-event stream exactly as postprocess step 0 consumes it (intercepted at ``materialize_from_events`` entry, the ...
7272feffbe27321dd423a0184037c1bf48a1e6a4db7bd73563fc7ff565e90f1a
Python
23,976
461
########################################################################## ## ## ## Copyright (c) 2019 Philipp Lösel. All rights reserved. ## ## ## ## This file is par...
e7e6c96fe22534b0ba3aa570e34fc2f59b8c54ddbb19ffffb6d0afc41782b531
Python
23,977
385
from __future__ import print_function import sys import logging from random import seed, sample from statistics import mean, stdev import numpy as np from scipy.cluster.hierarchy import linkage, fcluster from edlib import align from pysam import FastaFile from svim.SVSignature import SignatureClusterUniLocal, Signat...
031e7b188938ffdf045fd038986c1b3185f8782de28f1ba9a2725f2e13bbe01c
Python
23,987
742
""" Screen renderable items for pygame-based simulation visualization """ from __future__ import annotations from typing import Any import os import param from ..param import ( Area2DPixel, IntegerTuple, NestedConf, NumericTuple2DRobust, Pos2D, PositiveInteger, PositiveNumber, PosPix...