sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
58c10c6e97c492d0ca16db3515e4d04b15cbdfe88f1dce3d48697379d4cf9ebb | Python | 10,803 | 288 | from biss.backend import BissClassifier, save_prediction, get_volume_share
from glob import glob
import os
from IPython.display import clear_output
from IPython.display import display
from zipfile import ZipFile as zip
from ipywidgets import Layout, Dropdown, Button, Output, FloatProgress, Label, VBox, HBox
from .viewe... |
836552688fab94b82b19aa95fa37b7c9ad607c8f12b9768cbce6e05fa608f55e | Python | 10,806 | 318 | import os
from typing import Optional
import numpy as np
import gym
from gym import spaces
from gym.error import DependencyNotInstalled
def cmp(a, b):
return float(a > b) - float(a < b)
# 1 = Ace, 2-10 = Number cards, Jack/Queen/King = 10
deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]
def draw_card(np_r... |
d0a69fff6d70c9ed81383f718a0924a287ee68be12ff3fa8fe3a37c99a5888f5 | Python | 10,806 | 236 | #!/usr/bin/env python
import torch
import argparse
import pandas as pd
import random
import numpy as np
import os
import warnings
import copy
from embedding import SynonymousShuffleExpectedGradients, GradientAttribution, EmbeddingMDIG, EmbeddingIG
from onehot import OneHotSalience, OneHotIntegratedGradients, OneHotMDI... |
fd1fc099dce4f33a05e9df27ad1ba4750e8d9410b1174d3c235d442f90866244 | Python | 10,806 | 339 | """
Simple utils to save and load from disk.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
# TODO(rbharath): Use standard joblib once old-data has been regenerated.
import joblib
from sklearn.externals import joblib as old_joblib
from sklearn.preproce... |
ae79b94ff10fd46d6a2077f64d6a0138eeba9141551ff6cec8625564c219e7dd | Python | 10,807 | 296 | import numbers
import numpy as np
from scipy.linalg import eigh
from sklearn.base import BaseEstimator, TransformerMixin
from .geometry.base import sqrtm, invsqrtm
from .geometry.geodesic import geodesic
from .geometry.mean import gmean
class Whitening(TransformerMixin, BaseEstimator):
"""Whitening, and optiona... |
b027e1728cc78c74f8c180207f850fc5df190a0a96e019a3dc642909d6a53692 | Python | 10,807 | 332 | """
Merging of edited parameters into a simulation configuration.
Reconciles what the builder produced with the stored configuration, coercing
each value to the shape the configuration expects rather than overwriting
whole branches.
"""
from __future__ import annotations
import math
from numbers import Number
from p... |
5706bda63fd6d3a74c76139239081f970462c7a531f99bcc248d5a3a2fd71a56 | Python | 10,810 | 296 | """A class for Tensorflow specific optimizer logic.
The major behavior change for this class is for tf.distribute.
It will override methods from base Keras core Optimizer,
which provide distribute specific functionality, e.g. variable
creation, loss reduction, etc.
"""
import warnings
import tensorflow as tf
from ... |
44a4b9aefdf7b9cf946d3d9a6d5e1872eff1e304b7b289eca94dad05b50a0bb0 | Python | 10,811 | 239 | from __future__ import division
import argparse, time, logging, os, math
import numpy as np
import mxnet as mx
from mxnet import gluon, nd
from mxnet import autograd as ag
from mxnet.gluon import nn
from mxnet.gluon.data.vision import transforms
import gluoncv as gcv
gcv.utils.check_version('0.6.0')
from gluoncv.dat... |
a529d65647d3043f8312620c0728a14d0558f2ae603476e2522876ff8f0e992b | Python | 10,813 | 249 | """MS COCO Instance Segmentation Evaluate Metrics."""
from __future__ import absolute_import
import io
import sys
import warnings
from os import path as osp
import numpy as np
import mxnet as mx
try:
from mxnet.metric import EvalMetric
except ImportError:
from mxnet.gluon.metric import EvalMetric
class COC... |
a63e2fbab7106f4172a88041e1f1f288851f325021e74b17d968d69a5479462c | Python | 10,815 | 320 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""ResNe(X)t 3D stem helper."""
import torch.nn as nn
def get_stem_func(name):
"""
Retrieves the stem module by name.
"""
trans_funcs = {"x3d_stem": X3DStem, "basic_stem": ResNetBasicStem}
assert name ... |
646e49aaa219d228380b05e4486ea1fef8ed47ea0591545da65e2e1f9f438fda | Python | 10,817 | 295 | import pytest
import sys
from rpy2 import robjects
from rpy2 import rinterface
import rpy2.rlike.container
import rpy2.robjects.conversion as conversion
r = robjects.r
class DummyNamespace(object):
def __getattr__(self, name):
return None
has_numpy = False
try:
import numpy
has_numpy = True
... |
5f5cd83e99518b5c7bdad97ef3c9c3fea4189aa8794c48bb02e0843b29220392 | Python | 10,822 | 266 | """
This module define MetricAccuracy
"""
import imp
import logging
import torch
from metrics.generic_metric import GenericMetric
import numpy as np
import pickle as pkl
import os
import pandas as pd
from collections import Counter
import math
from collections import deque
class MetricSmin(GenericMetric):
"""
... |
a847923ac174c40421e796feac27eccfc24a4acbc0acb34ad5f0f8e42383d893 | Python | 10,824 | 302 | # Copyright 2025 Google.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
6eeef093033206c7ee97b102a0752e308fbdcf4ba96d9d20c6b2eb9213dfd245 | Python | 10,825 | 258 | """4. Train FCN on Pascal VOC Dataset
=====================================
This is a semantic segmentation tutorial using Gluon CV toolkit, a step-by-step example.
The readers should have basic knowledge of deep learning and should be familiar with Gluon API.
New users may first go through `A 60-minute Gluon Crash Co... |
84e3993c2ffb0d33af3a5e5d9d93d91090b1d8726ee7f029417aa27b41a86103 | Python | 10,825 | 300 | import scanpy as sc
import numpy as np
import pandas as pd
import anndata as ad
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import colors
from matplotlib import rcParams
# Function for ploting of pie charts
def func(pct, allvals):
absolute = int(pct/100.*np.sum(allvals))
retur... |
2745a9aec1bf88f45a036372e4f800ad219fcbc21b1da74f76d98706b323c144 | Python | 10,831 | 282 | # coding=utf-8
# Copyright 2026 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... |
f159f2fa74c9f196bf135e867a6ec0d04eea516b2c61520ce4a45f2e3a118cfb | Python | 10,831 | 299 | #!/usr/bin/env python3
"""
File: create_scatterplot.py
Created: 2021/04/29
Last Changed: 2021/11/12
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 sourc... |
1f7d7a3000420e7646c75a20a3e95d9766f305ff4cbb3e4e8d4d9f110ee47047 | Python | 10,834 | 296 | """Phase 9 bundle diff renderer snapshot tests."""
from __future__ import annotations
import re
from io import BytesIO
from pathlib import Path
from types import SimpleNamespace
from typing import Any
from xml.etree import ElementTree
import numpy as np
import pytest
import torch
import torchlens as tl
from torchle... |
065d00af56e75b339cb1088c2c02117cf5c135826374c7c7771afbdac52d6beb | Python | 10,835 | 340 | import cffi # type: ignore
import os
import re
import sys
import warnings
import situation # preloaded in setup.py
# from rpy2.rinterface_lib import ffi_proxy
import importlib
spec = importlib.util.spec_from_file_location(
'rinterface_lib', 'src/rpy2/rinterface_lib/ffi_proxy.py')
ffi_proxy = importlib.util.modu... |
d4e311f58f99d347aafea470014e92df366e5c1a7d5b6eff6987e403e056fd7b | Python | 10,835 | 351 | """
Barplots
"""
from __future__ import annotations
from typing import Any, Dict, Optional, Sequence
import itertools
import numpy as np
from matplotlib.patches import Patch
from scipy.stats import ttest_ind
from .. import plot, util, funcs
__all__: list[str] = [
"error_barplot",
"intake_barplot",
"bar... |
f7ade9f6bdef6306738b5436bcc67db0bd792bc3073d5a7cd48a6f27644f081b | Python | 10,835 | 304 | """Registry Tables A/B, the nine censuses, waivers, KNOWN-GAP mechanics (item 3).
Everything else binds into this; new deltas block from this merge (a set
difference cannot flake, D25). The H0 corruption plants prove the validation
gates can go red, and the waiver schema's refusals are live from the first
merge so the... |
c0f80350cc6019add57c96bbff6ddc7d56f388177a53b3bf93c581a9b4abf63f | Python | 10,836 | 313 | import glob
import numpy as np
import os
import re
import tempfile
from addict import Dict
from collections import defaultdict
from pathlib import Path
from subprocess import call
import cv2
from ..dataset import GluonCVMotionDataset, DataSample, FieldNames, get_resized_video_location
from ..io.video_io import VideoFr... |
ee3c5d6637b81eae3c3f3f56baa3a0215fef2fd7f287b8a3758f538ce243bbaf | Python | 10,840 | 309 | """Series of memory buffers sued."""
# Named tuple for storing experience steps gathered in training
import collections
from collections import deque, namedtuple
from typing import List, Tuple, Union
import numpy as np
Experience = namedtuple("Experience", field_names=["state", "action", "reward", "done", "new_state... |
4b408d2e56c55f1f22c2e0381266c6943c0b09b15f375afdddbaa0ff2bd1109c | Python | 10,845 | 340 | """Measurement-method tests for the benchmark runner and regression gate.
These are the R28 seed tests: the runner must speak the current ``save=``
predicate API (not the removed ``keep_op=``/``keep_module=`` spelling), the
gate must detect baseline rows that disappear from the current run, timing
must record CPU time... |
4d087138fb2ce118f1832560c694917b7d476937169a7f8b5635816e4be48f39 | Python | 10,845 | 317 | """Generate and work with PEP 425 Compatibility Tags."""
from __future__ import absolute_import
import distutils.util
import logging
import platform
import re
import sys
import sysconfig
import warnings
from collections import OrderedDict
import pip._internal.utils.glibc
from pip._internal.utils.compat import get_ext... |
cc93a3056f842f06f4aae96a71400a0212f654d34941b97dc8549690acca3d6e | Python | 10,850 | 289 | """DLA network with Deconvolution layers for CenterNet object detection."""
# pylint: disable=arguments-differ,unused-argument
from __future__ import absolute_import
import warnings
import numpy as np
from mxnet.context import cpu
from mxnet.gluon import nn
from mxnet.gluon import contrib
from . deconv_resnet import ... |
ff77008d51d56558c021d521f640920984293b108dd09282812516c6973e2206 | Python | 10,859 | 351 | import os
import numpy as np
import pandas as pd
from tqdm import tqdm
from scipy.stats import norm
import nibabel as nib
from nilearn.glm import threshold_stats_img
from nilearn.plotting import plot_surf_stat_map
from nilearn.glm.second_level import SecondLevelModel
from nilearn.image import math_img, new_img_like
i... |
a3f0ff595796717662236c633d283ba68b863af696460191c440caf43cc05c80 | Python | 10,861 | 319 | # This file originally from pip:
# https://github.com/pypa/pip/blob/8f4f15a5a95d7d5b511ceaee9ed261176c181970/src/pip/_internal/pep425tags.py
"""Generate and work with PEP 425 Compatibility Tags."""
from __future__ import absolute_import
import distutils.util
from distutils import log
import platform
import re
import s... |
04df00065160fb8bc11102151fa91ac7258aa1cd050315bf9dc5b6d84e9bd824 | Python | 10,863 | 323 | """Conformance tests for v7 memory quantity fields."""
import gc
import re
import tracemalloc
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.constants import (
BUFFER_LOG_FIELD_ORDER,
GRAD_FN_LOG_FIELD_ORDER,
GRAD_FN_PASS_LOG_FIELD_ORDER,
LAYER_LOG_FIELD_ORDER,
... |
8530dae516a05db3b4e38879cc5de9ce72653a39ab0733d2e46cff54b22176a6 | Python | 10,871 | 355 | """
Miscellaneous non-normalizing data transformations on AnnData objects
"""
from functools import singledispatch
from typing import Optional, Union
import numba
import numpy as np
import scipy
from anndata import AnnData
from sklearn.utils import check_array, sparsefuncs
from ..logging import logger_manager as lm
... |
18985de7f7c791648235a4ca522c25e3b9d74f8b85df4c539701257293a6f125 | Python | 10,873 | 277 | #!/usr/bin/env python3
"""
Dx AO — cross-condition battery: does the Dx AA pipeline generalize
beyond AD?
Tests whether the rank-norm + ridge whitening + quad-LDA architecture
(the methodological core of the AD confirmatory tool) gives useful
discrimination on other conditions: Parkinson's disease, MDD, psychosis,
and... |
87f75b90aea9e79a9b9d52e07dcd397c377a273f66ffeaa0e5ae3123c640107a | Python | 10,873 | 292 | """Style and aesthetics definitions for plots."""
from itertools import cycle
from functools import wraps
from specparam.modutils.dependencies import safe_import
from specparam.plts.settings import (AXIS_STYLE_ARGS, LINE_STYLE_ARGS, COLLECTION_STYLE_ARGS,
CUSTOM_STYLE_ARGS, STYLE_... |
32ad7903fe4ddd5e7bf3f0eff026e9e335c83ff0fc5e2abfc956d8fba30dbb2b | Python | 10,875 | 290 | # 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... |
b5069025a729af8b9ebb5b9f91ea29d592bda1b03d1333bf3df6fef36ebeeb11 | Python | 10,876 | 313 | """
Functions to compute power spectral density and mean power spectral density.
"""
import inspect
from functools import wraps
from numbers import Number
import numpy as np
import pandas as pd
from numba import njit
from .. import core as nap
@njit
def _overlap_split(start, end, interval_size, overlap):
N = i... |
389074338932c1d6de4c5be04a81cc23060a523422f8cca1354479ade112e01a | Python | 10,877 | 284 | """r20j hardening: IR container spec correctness + registry honesty.
Covers ledger findings N4 (false-VERIFIED tensor-key dict witness), N5 (rebuild
must reject malformed specs), N6 (most-derived registration dispatch), and N7
(snapshot dedup must not drop the later observation's event index).
"""
from __future__ imp... |
24ef5168c88bc2fec26fa86ebaf557e36c3e37d0526589176bc0a310eac890db | Python | 10,878 | 412 | """Compact faithful audio and memory-sequence classics.
Paper: SincNet, LEAF, Deep-FSMN, and MIMN.
"""
from __future__ import annotations
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class SincConv1d(nn.Module):
"""SincNet first layer with learnable low/high cutoff frequencie... |
d424b580bd85ab1fac272c702b0c9a6adfc8510de36719856a34d8414a624043 | Python | 10,879 | 331 | import pathlib
import dask.array as da
import numpy as np
import pytest
import zarr
from ome_zarr.scale import Scaler
from ome_zarr.writer import write_image
class TestScaler:
@pytest.fixture(
params=(
(1, 2, 1, 256, 256),
(3, 512, 512),
(256, 256),
),
... |
26f40a803a061f5708bebba19389c599dbe9f9603d803323664eb4df5ab125a8 | Python | 10,884 | 236 | import torch
import torch.nn as nn
import sys
import os
from .backbone_module import Pointnet2Backbone
from .transformer import TransformerDecoderLayer
from .modules import PointsObjClsModule, FPSModule, GeneralSamplingModule, PositionEmbeddingLearned, PredictHead, \
ClsAgnosticPredictHead
class GroupFreeDetecto... |
a42a2537ef22ed2c20e2d97b8a4ffd70387e2e7078760005d276c28d880ab91b | Python | 10,886 | 247 | #!/usr/bin/env python3
from DeepRegFinder.preprocessing_functions import *
from pybedtools import BedTool
import yaml
import sys
import os
import time
import pandas as pd
import argparse
import shutil
"""
First argument: input .yaml file
Second argument: name for output folder where files stored
Outputs used for trai... |
bce0f885a98b5244130493c60785d578666665da826f76b0f6b2f3cc0da6f7de | Python | 10,887 | 233 | import numpy as np
import pandas as pd
import torch
import scipy.stats as stats
import subprocess
import sys
import os
import glob
from datetime import datetime
sys.path.insert(1, os.path.dirname(__file__))
from core import SimpleLogger, Residualizer, center_normalize, impute_mean
has_rpy2 = False
e = subprocess.cal... |
7ac5f13b2e2954efd59e06bb0f3d452c3080fe2bf860a809934015958ce5ef37 | Python | 10,890 | 196 | import numpy as np
import pandas as pd
import time
import tensorflow as tf
from keras import __version__ as keras_version
from PCAfold import preprocess
from PCAfold import QoIAwareProjection
from PCAfold import __version__ as PCAfold_version
print('numpy==' + np.__version__)
print('pandas==' + pd.__version__)
print('... |
ad9b433d6949e55cd10c1471ad61fff2410036c78d2337d36c78ab562ed6a187 | Python | 10,894 | 282 | #!/usr/bin/env python3
"""
Unit tests for camera initialization timeout mechanisms.
Tests the failsafe mechanisms implemented to prevent ethoscope from hanging
indefinitely during camera initialization, particularly for picamera2 compatibility issues.
"""
import logging
import os
import queue
import tempfile
import t... |
261e9094aae17427582fa39ece33a8ed40444b89a8679da364c47aaef3e3da0f | Python | 10,897 | 325 | """Input-facet patcher fixes (grind-p3-fixplan T3, fix-patching lane).
Four coupled defects in the input-facet patching path of
``torchlens/semantic/patching.py``:
* [HIGH] the patcher indexed BFS-ordered ``input_ops`` ordinals into a DFS
tree walk, silently patching the WRONG leaf on mixed-nesting inputs. The
le... |
4e8618f2a240f7c05b60df9a97e8ae7fcefcb0cf37685166ce502394faad86fa | Python | 10,897 | 254 | #!/usr/bin/env python
"""Parse For Explicit Instantiation
Usage:
ParseForExplicitInstantiation.py --classFile <pathToITKTemplateHeader>
ParseForExplicitInstantiation.py [--minRepeats=<repeatNum>] --classFile <pathToITKTemplateHeader>
ParseForExplicitInstantiation.py (-h | --help)
Options:
-h --help ... |
ea88f1a938ea8b39ff819bc8be463a9167fc88efba0d79bd2d13aef0762c229e | Python | 10,898 | 289 | import numpy as np
import numpy.linalg as npl
import pytest
import scipy.special as sps
import torch
from pytest_mock import MockerFixture
from torch import Tensor
from torch import distributed as torch_dist
from lightly.loss import DetConBLoss, DetConSLoss
from lightly.utils import dist as lightly_dist
class TestDe... |
3eb241c484fccf4f5402dcbf7cadc3e87e518d4752713cde42c3162a926d4639 | Python | 10,899 | 267 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# Some parts of the code were referenced from or inspired by below
# - Dong-Hyun Lee's code (https://github.com/dhlee347/pytorchic-bert)
# - Tristan Bepler's code (https://github.com/tbepler/protein-sequence-embedding-iclr2019)
""" PLUS-TFM model ... |
ac6ec28b2f1a4b797c391a7807b88f83b430452d418262c3dfa7b0f3516e39f9 | Python | 10,900 | 296 | # Copyright (c) 2025, Tri Dao.
# Ported Cutlass code from C++ to Python:
# https://github.com/NVIDIA/cutlass/blob/main/include/cute/arch/mma_sm100_desc.hpp
# https://github.com/NVIDIA/cutlass/blob/main/include/cute/atom/mma_traits_sm100.hpp
from enum import IntEnum
import cutlass
import cutlass.cute as cute
# ------... |
87b4f3f0c6590cf1e0389a1de22cc5d2105455a0c814bb809f8ccf15a7ece2ee | Python | 10,901 | 267 | """tviz strips, prediction pictures, and metric oracles (memo items 8-10).
The zero-dependency emitters (bare-install duty), the paper strip, the
lens-fed prediction pictures with their provenance wording, and the
loss/entropy alignment oracle (composition row 9: top-k + loss + entropy
from ONE logits source, position... |
e206b8793c1d2456b0b9a75b3939d5c92accebb9a4012cbdfda24b2367c68b48 | Python | 10,903 | 291 | """
Unit tests for stimulators/odour_stimulators.py.
Tests HasChangedSideStimulator, DynamicOdourDeliverer,
DynamicOdourSleepDepriver, MiddleCrossingOdourStimulator,
and MiddleCrossingOdourStimulatorFlushed.
"""
import unittest
from unittest.mock import Mock, patch
from ethoscope.hardware.interfaces.odour_delivery_d... |
b5fba7003ec5b6f4e9918270f1c8ab4f08759290662c6427ad362cf6547a3de6 | Python | 10,905 | 348 | import io
import unittest
from typing import Optional
import pytest
import torch
from torch import nn
from torch.nn import Linear
from torch.optim import SGD
from lightly.utils import scheduler
from lightly.utils.scheduler import CosineWarmupScheduler
@pytest.mark.parametrize(
"step, max_steps, start_value, end... |
8be5eaa2dbd3be46f63dde77961383b7b163fc7139b4257190a22044c652c79c | Python | 10,906 | 261 | """Round-33 security regression: name-scope the operator/_operator carve-out.
The r31 structural stdlib deny carves the WHOLE ``operator`` / ``_operator`` module
out of the stdlib/builtin denial (``_ALLOWED_STDLIB_ROOTS``) so the legitimate pure
operators (``operator:neg`` et al.) still resolve on the FOREIGN resoluti... |
8af2de09b0b2e96ade85cde562b46e279cb2f7195a19eb0a8e6211e14a742c23 | Python | 10,907 | 269 | """Tests for specparam.io.models.
Note: load tests load files created from save functions, so failures may reflect saving issues.
"""
import os
import numpy as np
from specparam import (SpectralModel, SpectralGroupModel,
SpectralTimeModel, SpectralTimeEventModel)
from specparam.models.utils i... |
73ec98fee046f99568c2bf1dfeea27e0899dab8284a8ed7e0ff8974a2a46cf54 | Python | 10,909 | 198 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
from copy import deepcopy
import matplotlib.pyplot as plt
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
def describe_model(net):
nparams = sum(p.numel() for p in net.parameters() if p.requires_... |
8e8d9c93dae39d9d8230a68e84cbb86f837754ebe0d43eadf361605e75e2b398 | Python | 10,909 | 253 | import torch
from base import Attribution, PredictionWrapper
from bioseq2seq.bin.transforms import getLongestORF
import pandas as pd
import matplotlib.pyplot as plt
import logomaker
import torch.nn.functional as F
import numpy as np
import time
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
from Bio impor... |
6f571729265e5032fbeb4e0e94ac2210fce82655226d06a015348cbf411b6c34 | Python | 10,911 | 304 | import pytest
import contextlib
import cv2
import PIL.Image
import numpy as np
from pathlib import Path
import nway.transforms as nwtf
import nway.image_processing_utils as impu
TEST_FILE_DIR = Path.resolve(Path(__file__)).parent / "test_files"
@pytest.fixture
def fixed_image_fixture():
# grab one specific file ... |
75c75d845f3381204b651c10d025959d260b7fbe6bef912f7451053fc975076a | Python | 10,911 | 353 | import h5py
import numpy as np
import torch
from torch.utils.data import DataLoader
import torch.nn as nn
import torch.nn.functional as F
import os
from utils_rbns import list2seq
from random import shuffle
from tqdm import tqdm
# from load_psam_motif import *
class ResidualUnit(nn.Module):
"""
Residual uni... |
e656b4e58322ec1e9f2bbc9324e52eb1bc44dd7a3010c504b1b453570b28c141 | Python | 10,916 | 332 | # SOURCE: vendored from facebookresearch/denoiser @ main
# https://raw.githubusercontent.com/facebookresearch/denoiser/main/denoiser/demucs.py
# https://raw.githubusercontent.com/facebookresearch/denoiser/main/denoiser/resample.py
# https://raw.githubusercontent.com/facebookresearch/denoiser/main/denoiser/utils.py (cap... |
9a01daa52edab3edb9ff0803d78e488c9a873bc552746f38906b891d1006ed02 | Python | 10,918 | 320 | # 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... |
54083e613b72ae0da8b32bde5af43a4a4ff7cfb6bb9994ddd3033df8d1a948ee | Python | 10,919 | 257 | import numpy as np
from brian2.only import *
import spatial
def get_neuron_eqn(params, extras, enforced_spikes):
# Noisy dv/dt = ((v_rest-v) + (E_exc-v)*g_exc + (E_exc-v)*g_input + (E_inh-v)*g_inh) / tau_mem + vnoise_std*sqrt(2/tau_noise)*xi : volt (unless refractory)
vtmp = '(E_exc-{v})*g_exc + (E_exc-{v})*g... |
3b34acab4c355fd06e9eb96a614f7c1c86fe7882cadf9a4bd37a256b7dfba110 | Python | 10,921 | 326 | #!/usr/bin/env python3
import multiprocessing
import regex as re
import logging
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from MarkovModels import common
from MarkovModels.BeattieModel import BeattieModel
from MarkovModels.ClosedOpenModel import ClosedOpenModel
from M... |
e3793a645ec814318516caa12a9947a2cb0973f99be3a5a3cd4d3bcd0d997eba | Python | 10,921 | 334 | # LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this software except in complian... |
bffe00de63cb357c9726eb831cea9df3c00f74c05519a0ed99fa231718da318e | Python | 10,923 | 318 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Helper functions for calculating 2D and 3D bounding box IoU.
Collected and written by Charles R. Qi
Last modified: Jul 2019
"""
from __f... |
6ba6d1bb97edbf4bb3afe108837baf9d91a56f43bf1f4bfa27344bcf270e6024 | Python | 10,924 | 197 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
596f26c7afa9765114b8d59e6cbfe6cf746507b8eded9964dac122890de8e9f9 | Python | 10,927 | 344 | from types import SimpleNamespace
from matplotlib import pyplot as plt
import pandas as pd
import tqdm.auto as tqdm
from permacache import permacache, stable_hash
import numpy as np
from shelved.extract_psams import extract_psams_from_motifs
from modular_splicing.data_for_experiments.standardized_sample import (
... |
036fe85aad387b29b35f4ad89b8e84417d4577209f7d8815857e0a70f6cf9c99 | Python | 10,928 | 288 | #!/usr/bin/env python3
"""
File: pic_regplot.py
Created: 2021/04/29
Last Changed: 2021/10/21
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.... |
fd7ba75c09af9dcd4acd98285ddfeda3289cef1663ed7e75e45d587443ae67e6 | Python | 10,928 | 283 | import copy
import numpy as np
import torch
import math
from rdkit import Chem
import networkx as nx
def axis_angle_to_quaternion(axis_angle):
"""
From https://pytorch3d.readthedocs.io/en/latest/_modules/pytorch3d/transforms/rotation_conversions.html
Convert rotations given as axis/angle to q... |
77e7e4c827ce68d1885c106bf7a7a51d8295a692e3781e32778ab7521f486b36 | Python | 10,931 | 234 | import argparse
import glob
import json
import multiprocessing
import os
from re import I
import tempfile
from subprocess import check_output
from shellescape import quote
from mp_dip.old.config import MP_EPOCH_IN_SECONDS, RESAMPLING_FREQUENCY
from mp_dip.utils.utils import read_raw, preanalyse_raw, get_mp_book_paths... |
2eca35b5b12ae1ed99cf4d8298a2b5e2815a8d514d2ea32db6257759af11c7ef | Python | 10,932 | 254 | """Regression tests for RF gradient/verify honesty and rule-install rollback (r19b).
Covers hardening findings:
* W2A3-04 -- ``cross_batch_influence`` must not report a false ``True`` when a
batch-moving transform repositions the batch axis, while still detecting a
genuine cross-batch dependence (the ``undeclared... |
a09d3fe1faddb0aa4540a86f8763e6203a150a734ed6831b6a42e76165f09479 | Python | 10,934 | 371 | from typing import Tuple
from functools import partial
import math
import numpy as np
from tqdm.auto import tqdm
import jax
import jax.numpy as jnp
from jax.tree_util import tree_map, tree_flatten
import flax.linen as nn
from flax.training import train_state
import optax
class MultiHeadMLP(nn.Module):
feature... |
24915201d176945770c43162c283c51fef27602b69cc45adf434b8af2763c968 | Python | 10,935 | 286 | """Round-26 W3 structural-signature hardening regression tests.
HIGH-1: ``compute_graph_shape_hash`` silently dropped every parent edge whose
source is a multi-pass (recurrent) layer: the ordering map was keyed by the
non-pass-qualified ``layer_label`` while ``layer.parents`` references
multi-pass parents by their pas... |
6b7939f03dee833b77d4be8e55e30303f88a7fe37a75af9479a0c00ddb07ea03 | Python | 10,936 | 255 | # pylint: disable=missing-function-docstring, unused-argument
"""
C2D video action recognition models based on ResNet
"""
import torch
import torch.nn as nn
import torchvision
__all__ = ['ActionRecResNetV1b', 'resnet18_v1b_kinetics400', 'resnet34_v1b_kinetics400',
'resnet50_v1b_kinetics400', 'resnet101_v1b... |
4b5f0080f511c3ce580e33d2e8d3c49df5cc9bd3decf8dc70076b7d0b1b65ccf | Python | 10,938 | 196 | import random
import torch
import numpy as np
from numpy import array
from envs.tunl_1d import TunlEnv, TunlEnv_nomem
from agents.model_1d import *
import os
from datetime import datetime
import matplotlib.pyplot as plt
import argparse
from tqdm import tqdm
import re
import sys
sys.path.insert(1,'/home/mila/l/lindongy/... |
e2d44907bc8731e6d27728e8cb24ea7053001fded3a77147f717a3bfd5f860cd | Python | 10,938 | 301 | """
Canonical ingest layer — single source of truth for "raw EEG → 5D features".
Every per-paper pipeline that extracts 5D features from a cohort should
delegate the post-load steps (channel select, CAR, resample, epoch, compute,
average) to `extract_subject_features()` here. Cohort-specific code is
limited to file re... |
8f655e513880d0c10010576b0fc7a3c1b96bafe962ccfb7b8aa5f2c7eb81e24f | Python | 10,940 | 293 | from contextlib import closing
from io import StringIO
from os import path
from typing import Optional
import numpy as np
from gym import Env, logger, spaces
from gym.envs.toy_text.utils import categorical_sample
from gym.error import DependencyNotInstalled
UP = 0
RIGHT = 1
DOWN = 2
LEFT = 3
class CliffWalkingEnv(... |
a6f7405039916b87b6bc67516b542dfdbcc87535038cd5f4b83d213b4c25ba2c | Python | 10,945 | 316 | import re
import warnings
import numpy as np
import pytest
import gym.error
from gym.spaces import Box
from gym.spaces.box import get_inf
@pytest.mark.parametrize(
"box,expected_shape",
[
( # Test with same 1-dim low and high shape
Box(low=np.zeros(2), high=np.ones(2), dtype=np.int32),
... |
b5fbb51c6f8576f00fefcfe2ef843c2549aa04265c3e715637f0de276d8b8cd3 | Python | 10,952 | 376 | """Logging and Profiling"""
import logging
from collections.abc import Mapping
from datetime import UTC, datetime, timedelta
from functools import partial, update_wrapper
from logging import CRITICAL, DEBUG, ERROR, INFO, WARNING
from typing import Any, overload
import anndata.logging
HINT = (INFO + DEBUG) // 2
loggi... |
3838cbd1267da3bdeae6e3599e633fc308531ed810efe939b5dd33aee056c1e2 | Python | 10,954 | 284 | """Generative tlspec parse-robustness sweep (R73, round 3).
The historical parse-robustness tests ENUMERATED hand-picked corruptions; this
module GENERATES them from the artifact itself, so the coverage tracks the
manifest schema instead of a hand-list:
* the key sweeps parametrize over whatever top-level keys a fres... |
8f814f1804245fc9b5e0203aba537462d6d2173480d6f6bff099be75a9bddd63 | Python | 10,956 | 269 | from typing import Any, Dict, List, Optional, Sequence, Union
import numpy as np
import torch
from pytorch_lightning import Callback, LightningModule, Trainer
from pytorch_lightning.loggers import LightningLoggerBase, TensorBoardLogger, WandbLogger
from pytorch_lightning.utilities import rank_zero_warn
from pytorch_li... |
0e746794e0d44393c584345e0a198d965bce11c4e66fe45691fc80ccbd78d210 | Python | 10,957 | 296 | import re
from collections.abc import MutableMapping
from keras.src import dtype_policies
from keras.src.api_export import keras_export
from keras.src.dtype_policies import DTypePolicy
@keras_export(["keras.dtype_policies.DTypePolicyMap"])
class DTypePolicyMap(DTypePolicy, MutableMapping):
"""Dict-like object ma... |
87757871fed2fdeca871eb8cb040d9a31c83058856fec40690207d6205a715bd | Python | 10,957 | 266 | import numpy as np
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from pgl.sampling.custom import subgraph
import pgl
import math
class DenseLayer(nn.Layer):
def __init__(self, in_dim, out_dim, activation=F.relu, bias=True):
super(DenseLayer, self).__init__()
self.activation ... |
8749b15c3e2cb4cc390c33c50863807988431b61886af6b29509e338892ffee3 | Python | 10,959 | 236 | # 均匀采样效果较差
import json
import numpy as np
import os, sys
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 as F
from torc... |
ea5dee0b657d65659ce1f4f5d7e56046c36f3aceec384afd302d28c9f5c797dd | Python | 10,959 | 302 | from __future__ import annotations
import copy
from functools import partial
import torch
from pytorch_lightning import LightningModule
from timm.models.vision_transformer import vit_small_patch16_224
from torch import Tensor
from torch.nn import Module
from torch.optim import AdamW, Optimizer
from lightly.loss impo... |
7942bc14cef1b97d4df1646b8e3eabe29057d5bdc410bf7b80a3806976adca8e | Python | 10,961 | 374 | # --- 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 Z(_BaseTraceHierarchyType):
_parent_path_str = "surface.contours"
_path_s... |
871e0ab77250702a825ac0b53fac86fa948ed76347ee0e0dfecad08390d1df00 | Python | 10,961 | 374 | # --- 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 Y(_BaseTraceHierarchyType):
_parent_path_str = "surface.contours"
_path_s... |
f84c8e4ae2f5d4ed7fefeb0e7511fc9382e2c4668b5632b243c11dbd0a6e0638 | Python | 10,961 | 374 | # --- 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 X(_BaseTraceHierarchyType):
_parent_path_str = "surface.contours"
_path_s... |
cbafab1b9a11afe3941cb2b4f14bff8ddc8407f3c33f9ca236f13702deb8e1b3 | Python | 10,962 | 287 | '''Feature_decoding-to-Generator reconstruction.'''
import glob
import os
from itertools import product
from bdpy.dl.torch.models import AlexNetGenerator
from bdpy.dataform import Features, DecodedFeatures
from bdpy.feature import normalize_feature
from bdpy.util import dump_info
import numpy as np
import PIL.Image
... |
2801ac7828746fd47190c2946ea0df52f23dc7aee0c0412f445e8c1bbd8541f9 | Python | 10,966 | 285 | import os
import torch
import pandas as pd
import gzip
import subprocess
import shutil
import datetime
from sklearn.metrics import matthews_corrcoef
from data.load_data import mkdir
from torch.nn import functional as F
from scipy.stats import pearsonr
def evaluation(dataloader, model, device, loss):
'''
E... |
7b949086d3c665cf74641617ed46ae0709d7ef6d2bf9a279bf32b0bc5d2f180c | Python | 10,966 | 297 | import importlib
import ntpath
import os
from unittest.mock import patch
import pytest
from celery.utils.sysinfo import (AUTO_CONCURRENCY, PROC_SELF_CGROUP, CpuBudget, _ancestors, available_cpu_count,
cgroup_cpu_quota, cpu_budget, df, is_auto_concurrency, load_average)
try:
posi... |
bc66cabcc0da4b72211471b39e69b91d5309a972ecb75a6fcf8d8341e6e00253 | Python | 10,969 | 265 | from sklearn.model_selection import train_test_split, KFold, GridSearchCV, cross_val_score, StratifiedKFold
from sklearn.metrics import classification_report, confusion_matrix, accuracy_score, make_scorer, f1_score
from sklearn.preprocessing import StandardScaler, MinMaxScaler
from sklearn.svm import SVC, LinearSVC
imp... |
e80773136ac3259d02579bcef3d6f19c1e832c57fea03d8dba37988ac3c3c6d8 | Python | 10,969 | 300 | """Perturbation and deep-clone unit tests for the validation subpackage.
Moved verbatim from ``tests/test_validation.py`` (at its size ceiling): the
replay-input helpers that validation leans on -- ``_perturb_layer_outs``
(every dtype family, saturation, scale, empty and scalar edge cases) plus
``_deep_clone_tensors``... |
03ee9531e4462cd5cefb4dff1037211fd988954bec9fefabb0f8704440c230ec | Python | 10,971 | 286 | """Module for reasoning about structure of and matching hierarchical collections of data."""
from typing import (
TYPE_CHECKING,
TypeAlias,
)
from galaxy.model import DatasetCollectionElement
if TYPE_CHECKING:
from galaxy.model import (
DatasetCollection,
HistoryDatasetCollectionAssociati... |
359f52960d4073539004da3ef77c14fc67157e512cdc3bee695ea2e628e281de | Python | 10,973 | 204 | import os, sys, argparse
def parse_args():
parser = argparse.ArgumentParser(
description=\
"DePTH: a neural network model for sequence-based TCR and HLA association prediction",
prog='DePTH')
subparser = parser.add_subparsers(help='whether to train, predict or do cross-validation', dest='comman... |
1a8535488301b5988f039d2ede0751c18abec44fbdbe5dc7923f4cbdd0232d1f | Python | 10,977 | 283 | """One-backward reads: the by= door and composition rows (F04 item 5, D9).
"Select the 50 most important sites" is one line: the three rank producers
accept a single-target ReadTable, rank at the table's declared grain, and
carry full Selection provenance. The closed loop (read -> select ->
intervene -> re-read) and t... |
1ced8ff261420ef2e1dcc4cdb156dd6bb7cc62ffae5f700d5a3e022d3c979407 | Python | 10,977 | 310 | """Schema v3 exporter core tests: ids, namespaces, edges, attrs, group rows.
Covers modelexplorer memo D1-D7 and D19 on deliberate toys: the universal
always-appended ordinal id rule, dot-split pass-qualified namespaces with
escaping and malformed-stack disclosure, occurrence-preserving ported edges
with the typed unr... |
a29d2ca1ad16a0a172121b9a712b88c5e37dd4d1db5ffe2915d3c3307b8fb8b3 | Python | 10,979 | 337 | import json
import os
import os.path as opath
import shutil
import subprocess
import sys
from codegen.datatypes import build_datatype_py, write_datatype_py # noqa: F401
from codegen.compatibility import (
write_deprecated_datatypes,
write_graph_objs_graph_objs,
DEPRECATED_DATATYPES,
)
from codegen.figure ... |
767425bfa40c364b75ce9c5f2cba4a9b9acbcc4b7cbbaf41b4b6b6bfaa38f6fb | Python | 10,981 | 300 | """Preview parity for compute_input_output_distances (torch Step 4).
Every preview backend must honor the same public surface torch honors — the
canonical ``compute_input_output_distances`` AND the deprecated public
``mark_layer_depths`` alias — with the SAME default (torch's
``CaptureOptions`` default is ``True``) an... |
cd9e35219c2fbeb186aa98251988167b5d9a231fad2a73ce6f6782f0e7ceb5cf | Python | 10,985 | 203 | import os
import re
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import sys
sys.path.insert(1,'/home/mila/l/lindongy/deeprl-timecells')
from scipy.stats import kruskal
from analysis.utils_analysis import sort_resp, plot_sorted_averaged_resp, single_cell_visualization, time_decode_... |
26e76277630c9fe55a19e835c739cad91a4c356c63e73cf71a4894042eb91199 | Python | 10,986 | 255 | """Plotting functions for spatial geometry plots.
"""
from typing import List, Optional, Tuple, Union
import anndata
import cv2
import numpy as np
import pandas as pd
from shapely.geometry import Polygon
from shapely.wkb import dumps
from ...configuration import SKM
from .scatters import scatters
from .utils import ... |
4fbc92135f946b2d014b58c498f5edc21f32510757638d6e019979863d60efd7 | Python | 10,986 | 313 | """
# Source code taken from the BP folks and ported to python3.
Simple Python RDA client for the RDA tcpip interface of the BrainVision Recorder
It reads all the information from the recorded EEG,
prints EEG and marker information to the console and calculates and
prints the average power every second
Brain Product... |
5dfb0cd978e958f311c8c052ae419f43a7da1dd4a4968fcaee80f4b42e73b21d | Python | 10,986 | 286 | """Artifact packet generator for the netron visual signoff (F14, memo s9).
The packet is generated by the SAME harnesses that gate CI, so the reviewer
confirms a stated number instead of forming an impression: per artifact, an
auto-generated ``EXPECTED-APPEARANCE.md`` (node/IO counts, edge-label count
with sample stri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.