sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1ad7ae6155e4e8a0f7c0d3aad4222370b192fd772bf4d7cca6544970a7690b3e | Python | 9,499 | 234 | """
Quality-control helpers for sc_crop detection-based cropping.
Public API:
check_label_crop(label, bbox) → dict — check that no SC voxels are lost after crop
save_bbox_nifti(bbox, ref_nii, path) → None — save the crop box as a binary NIfTI mask
check_seg_truncation(seg_nii, bbox) ... |
100cfe50b457c5341501b08ede40f7ba1cf082c86dc4f3bd3aff1071e0d5e2ec | Python | 9,500 | 315 | #!/usr/bin/env python
from __future__ import print_function
import os
import sys
import io
import json
import re
import getopt
from lxml import etree
from collections import OrderedDict
#
# This script updates the documentation of a SimpleITK class in its
# JSON file. The documentation is pulled from the correpso... |
3d3dec7e73d8badc8b152262516cbc5bfa854a5eb528d2fff247f826c8c3eaa6 | Python | 9,501 | 225 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Transformation that constrains the rotational degrees of freedom.
"""
# ======================================... |
0d61d30132348894d77386e3d2b626c8061b28d138d1cc9b3ecbbebd7b03e97f | Python | 9,505 | 237 | import re
import time
import pytest
import torch
from einops import rearrange
from flash_attn.models.gpt import GPTLMHeadModel
from flash_attn.models.opt import opt_config_to_gpt2_config, remap_state_dict_hf_opt
from flash_attn.utils.generation import update_graph_cache
from flash_attn.utils.pretrained import state_di... |
ee8d8a6cdd1d41f4d20b511fae984fa9778d6e527b53d6d16984577402ca0fc6 | Python | 9,507 | 225 | import os
import yaml
import copy
import torch
from src.optim import Optimizer
from src.data import prepare_data
from src.util import human_format, cal_per
from src.solver import BaseSolver # Some basic functions
from model.classifier import CLF
class Solver(BaseSolver):
''' Solver for training'''
def __init__... |
c75f1cb83c88103a601b24645bb42335cf06ffb036316c323d65d6968c673d34 | Python | 9,509 | 246 | # Given intersected sumstats files, picks loci for fine mapping based on user
# specified parameters such as min. zscore and number of SNPs.
import argparse, os, sys
def pick_loci_parseargs(): # handle user arguments
parser = argparse.ArgumentParser(description="Given sumstats files, picks" +
" loci for fine ... |
4592399deacb5e56c938db9a0ab1fe9c83e7f0b8930ff7fea6df43fc75ee4f79 | Python | 9,511 | 233 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# ------------------------------------------------------------------------------
# coding: utf-8
# pylint: disable=missing-docstrin... |
b62483e8ec3e1142f87c6f76b8bcdb5e727919ad83bc8b165b2e2ff0354d3486 | Python | 9,511 | 267 | """GNOT: General Neural Operator Transformer.
Hao et al., 2023.
Paper: https://arxiv.org/abs/2302.14376
Source: https://github.com/HaoZhongkai/GNOT
GNOT is a neural operator transformer designed to handle heterogeneous inputs
(multiple functions defined on different grids/point clouds) and complex geometries.
Key di... |
243a5453e9148203a16f0616a84e682b8ed2c66ce0b5c6d3580d2285f6408788 | Python | 9,514 | 210 | # ------------------------------------------------------------------------------
# Based on:
# apex
# Copyright (c) NVIDIA
# Licence under The BSD 3-Clause "New" or "Revised" License
# https://github.com/NVIDIA/apex
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modificati... |
ff6b99eac24e149b0982958b6330a459e9196a5a439e4c593fa17ecf50ea138f | Python | 9,515 | 260 | """Base Model for Semantic Segmentation"""
import math
import warnings
import numpy as np
import mxnet as mx
from mxnet.ndarray import NDArray
from mxnet.gluon.nn import HybridBlock
from ..utils.parallel import parallel_apply
from .resnetv1b import resnet18_v1b, resnet34_v1b, resnet50_v1s, resnet101_v1s, resnet152_v1s
... |
0e3dafff90750bdcede8eb1ebb968a9c8c9eb7b85bc8df78984eda4a3f4e21b5 | Python | 9,517 | 237 | '''
K-Folding script
author: obanmarcos
'''
import os
import os, sys
from config import *
sys.path.append(where_am_i())
import lightning as pl
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_utilities as dlutils
from utilities.folders import *
... |
a8c24d296997e624303cee2ffa8eacb48ec6b683558273fde37c6f49547b0b1d | Python | 9,519 | 271 | __credits__ = ["Carlos Luis"]
from os import path
from typing import Optional
import numpy as np
import gym
from gym import spaces
from gym.envs.classic_control import utils
from gym.error import DependencyNotInstalled
DEFAULT_X = np.pi
DEFAULT_Y = 1.0
class PendulumEnv(gym.Env):
"""
### Description
... |
c253ab5f4183b54cf0dfd9957a2a51817b625e1e917e03af5d478c349603f3fc | Python | 9,519 | 245 | import os
import glob
import random
import pickle
from data import common
import numpy as np
import imageio
import torch
import torch.utils.data as data
class IRData(data.Dataset):
def __init__(self, args, name='', train=True, benchmark=False):
self.args = args
self.name = name.replace('_IR','')
... |
8f4aa05f743f1a9f6db3ea0c3a1804a673a661e8ba4604457ffa61b4c8484161 | Python | 9,520 | 250 | """grind-r8 cluster 4.0.2: the WRONG-TRACE capture-cache family (R39 x3 + R35).
Three cache-correctness holes all served stale/wrong data under ``cache=True``:
* ``_callable_code_digest`` omitted ``__closure__`` cells, so two
factory-configured forwards sharing one code object collided on one key and
the cache se... |
70cf5a197b7a1aa0bb26f980239ff108c7434e231d5b242c01a92ab111da30c2 | Python | 9,522 | 217 | import enum
import math
import numpy as np
import torch as th
##########################################################################################
# DIFFUSION CODE BASE FOR PROTEIN SEQUENCE DIFFUSION WAS ADAPTED FROM LM-DIFFUSION #
# (https://github.com/XiangLi1999/Diffusion-LM) #
... |
5aba9f304a0e02fc67cf22cbbc984389f2c2fccc1e5911ed7600658f54820074 | Python | 9,524 | 234 | import torch
import torch.nn.functional as F
from functools import partial,reduce
from typing import Union
from captum.attr import configure_interpretable_embedding_layer, remove_interpretable_embedding_layer
class OneHotToEmbedding(torch.nn.Module):
'''Converts one-hot encoding into dense embedding'''
... |
6186ca8b420214b90bab5288009529de950eb3666f27254213f6d22d12c0cec1 | Python | 9,524 | 283 | import argparse
import time
import numpy as np
import brainpy as bp
import brainpy.math as bm
import brainpy_datasets as bdata
from functools import partial
class SigmoidBeta(bp.DynamicalSystemNS):
def __init__(self, alpha=1., is_train=False):
super(SigmoidBeta, self).__init__()
if alpha is None:
sel... |
1772eb4f0ba66fcbe1f40acf9fd6f4c110eeb98648d71f6588ea721d7a506e10 | Python | 9,525 | 215 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 29 18:04:08 2021
This is the configuration file for Experiment 2, post-cue delay length = 3 cycles variation. To run the experiment,
pass the path to the folder which is to contain the data from all Experiments on lines 205-206.
@author: emilia
"""... |
559e513ee770c2d7853c5026bc49110f770462e5b3c6710f691356795d92f6b4 | Python | 9,526 | 299 | """
Tools for loading data from text files.
.. autosummary::
:toctree: generated
tsv
var
"""
import csv
import gzip
from pathlib import Path
import re
from numbers import Number
from typing import Sequence, Union
import numpy as np
from .._types import PathArg
from .._utils import ui
from .._utils.parse im... |
b12440978203874c509ba3c6e41aee793633317dc38f9d7a78568e635997d62b | Python | 9,526 | 273 | import re
from typing import Any, Dict, Iterable, List, Tuple
from warnings import warn
import torch.nn as nn
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from pl_bolts.models.detection.yolo import yolo_layers
class YOLOConfiguration:
"""This class can be used to parse the config... |
e41dab3509509aec3854d856bb590aa8cf1a52cc7ee85f29d8556bd775f0cc0f | Python | 9,529 | 261 | """Validation deepcopy fidelity and plain-attribute fallback coverage.
Rung-1 menagerie findings (2026-10-04): FreeV's ``AttrDict`` (``self.__dict__ =
self``) deep-copies into an object with an empty attribute namespace, so the
ground-truth forward on the copy raised ``AttributeError``; WavTokenizer's legacy
``weight_... |
07b77de2143f745bfa08a7d3383e1be5f2ae50dd01ecf776d76b54a987918215 | Python | 9,530 | 227 | """F29: the recurrence fold under the fixed decision rule (agent memo 3.4).
Six acceptance criteria plus the FOLD COHERENCE TEST (membership agreement
with the renderer's collapse plan). The depth-series criteria (flat class
count across 6/12/24 blocks) run on the real gpt2 series and are marked slow;
the structural c... |
fe535a2e29af5e9335e21d806682a12e70450ab3587652db34d738ad858d9d7a | Python | 9,531 | 243 | import os
import sys
# Dirty fix, :TODO rewrite tools as a package - joined directly to Snudda or the lab
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, "tools")))
import unittest
from hash_value.make_hash import *
import json
import glob
import collections
"""
Test for the c... |
098857f1cf547296d375f8f5884e9a01dcd592c26c079d441a7848737d50d5f7 | Python | 9,534 | 237 | '''
K-Folding script
author: obanmarcos
'''
import os
import os, sys
from config import *
sys.path.append(where_am_i())
import pytorch_lightning as pl
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_utilities as dlutils
from utilities.folders i... |
aa92be046ab18eba613daeeadd51b94c5e996dc748bd3692f4dc6da783400276 | Python | 9,534 | 225 | """r16 write-class closure: the last ACCESS + TEMPORAL dimensions of the tensor-WRITE class.
Regression guard for the two r16 findings that close the remaining write-class gaps:
* C1 (ACCESS) -- the raw data pointer reachable off the STORAGE HANDLE
(``tensor.untyped_storage().data_ptr()`` / ``tensor.storage().data_... |
5e1c655c26f0840434b5fdabf0eb3dd4a1cdb002fd55b557652b528276abcd57 | Python | 9,535 | 266 | """ResNet with Deconvolution layers for CenterNet object detection."""
# pylint: disable=unused-argument
from __future__ import absolute_import
import warnings
import math
import mxnet as mx
from mxnet.context import cpu
from mxnet.gluon import nn
from mxnet.gluon import contrib
from .. model_zoo import get_model
__... |
1b2169e1b03cbd11f9354cc7b69e88b0a4535c06d1651e39f5b0401d5d6885bd | Python | 9,536 | 226 | """r53 hon_1: ambient global autograd/inference mode is RECORDED and RESTORED.
A pure-Python branch on ``torch.is_grad_enabled()`` / ``is_inference_mode_enabled()``
is steered by an ambient GLOBAL every other result-affecting knob already records.
The whole-class immunizer: the mode is a REQUIRED recorded ambient fiel... |
74dbade07c548d8c224ab6f1c2a12af1780d062046fb881afc666dd7985e27c1 | Python | 9,538 | 207 | import torch.nn as nn
from collections import OrderedDict
import torch
def conv_layer(in_channels, out_channels, kernel_size, stride=1, dilation=1, groups=1, bias=True):
padding = int((kernel_size - 1) / 2) * dilation
return nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding=padding, bias=bias,... |
5952502dc83b68f840d7e93add6be80036da7da9904a3bae5b400be5462fb6ee | Python | 9,539 | 254 | """
This is support login with password and check download file
"""
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import ui
from bs4 import BeautifulSoup
import re
#import pandas as pd
import os
import time
from collections import OrderedDict
import ... |
aafdab5cbdf5eaf1ad9f6b80ed212b9453fbaa48d734ecbb46bef47e3495569e | Python | 9,540 | 292 | import gzip
import hashlib
import os
import shutil
import sys
import tarfile
import tempfile
import zipfile
from contextlib import contextmanager
import numpy as np
import torch
from pl_bolts.utils import _TORCHVISION_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
PY3 = sys.version_info[0] == 3
if _... |
25149845cfb8373c22cf325642d632045ed6cc99b42f711ce065177384f48054 | Python | 9,541 | 259 | #!/usr/bin/env python
# coding: utf-8
# overall goal ------------------------
# the goal is to put only one HLA allele in test data, while make sure that
# the tcrs in training + validation do not have overlap with those in test
# still want to sample according to frequency matching
# put one target HLA allele in te... |
d9f624132d9e42cb3a79be2950b0da13bb6bfca21781b699f15d7087266afaf1 | Python | 9,541 | 259 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in the module ``tfep.utils.cli.launcher``.
"""
# ===================================... |
866f7b6a26eb067d1d184e70614b048abd8fc200715d81763d11839c9f3d6fa4 | Python | 9,544 | 216 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 29 18:04:08 2021
This is the configuration file for Experiment 2, post-cue delay length = 1 cycles variation. To run the experiment,
pass the path to the folder which is to contain the data from all Experiments on lines 207-208.
@author: emilia
"""... |
86dac3295824232a00533a01a74857cb15db58e6dbfac07f4998e9ed147b3dd3 | Python | 9,546 | 220 | """
Dealing with Line Noise
=======================
This example covers strategies for dealing with line noise.
"""
###################################################################################################
# sphinx_gallery_thumbnail_number = 2
# Import the spectral parameterization object and utilities
fr... |
f4a0d1d2e598415395d1dcb31e16eb4f2fe14089240afd203a99c83754f5b07f | Python | 9,546 | 269 | # Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved.
#
# Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0
# International License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://creativecommo... |
60b5d8736c2fddec411632fa71234f686fcae32367baf39674f225a475dcbf38 | Python | 9,547 | 197 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
f9db94df6491f838d994b17060fbe0fb519594bec22d6e06c01c004a964d57fd | Python | 9,548 | 234 | """H3 input-aliasing honesty, both directions (r29-C3).
Torch capture de-aliases model inputs, so an aliased-input runtime call that mutates a model
input is unreproducible against the recorded de-aliased path. Two r29 gaps:
* F2-hon (GAP): a VIEW-mediated input mutation (``a[0].add_(100)`` with ``a is b``) targets t... |
76b32dc404ef72379ff55d1d96df9c19715cd441519f6e8b9013add4bc31e1e5 | Python | 9,549 | 309 | import dateparser
import locale
locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' )
try:
from local_extractor.utils import common_utils
except ImportError:
import sys, os, pathlib
path = pathlib.Path(__file__).absolute().parents[2]
path = os.path.join(path, 'local_extractor')
if path not in sys.path:
... |
a0b72e0867134447ca3604869ac1b4af02c010d7fa3f3fad7b2146f7b5a43208 | Python | 9,549 | 232 | """r55 CLASS 2 immunizer -- no attacker instance state is read-then-called on load.
r54 ``sec_3`` (MED, latent RCE amplifier): ``metadata.pkl`` deserializes into the
``Trace`` state dict; an attacker who plants a top-level ``_internal_set`` key had
it read off the INSTANCE and invoked by ``rehydrate._assign_rehydrated... |
c79dec0d9f96b61f242f4cd4f0db2c21f2aa8a4c65bb625c2b75d65b048c1363 | Python | 9,549 | 258 | def plot_psd_pb(filename, metafile, markerfile, *args, **kwargs):
'''
This function plots the PSD (in dB) of the frequency range of your choice.
This function is to be used after EEG acquisition. The PSD compares two events
if you so choose (such as eyes open-eyes closed) or you could plot just one
... |
1fc95990f36af40d22beda6d04286cc01ae71b13da9f2223a44a1f3fa127310e | Python | 9,550 | 307 | from collections import defaultdict
import io
import json
from itertools import repeat
from multiprocessing import Pool
import numpy as np
import pandas as pd
from tqdm import tqdm
import sqlalchemy
from sqlalchemy.orm import sessionmaker
from contextlib import contextmanager
from omop_learn.backends.backend import O... |
d2888be092aa7f197f8356cdae4e8aa877bddde9c140f6b0ddf58f0c85dd3c4d | Python | 9,551 | 265 | """Evaluation code for BDD100K panoptic segmentation.
############################################################################
Code adapted from:
https://github.com/cocodataset/panopticapi/blob/master/panopticapi/evaluation.py
Copyright (c) 2018, Alexander Kirillov
All rights reserved.
Redistribution and use in ... |
64bd5126d4b6e141226a6b4a12bb5188357bc64743181f10593df90171823912 | Python | 9,554 | 262 | """Behavioral arming tests for the never-ship-a-major hook script.
``scripts/check_no_breaking_markers.py`` is layers 1 (commit-msg) and 3
(pre-push) of the locked no-major-bump release policy, and until grind r4 it
had ZERO behavioral coverage — ``tests/test_packaging_diet.py`` asserts only
that the pre-commit CONFIG... |
af02248bf07b56541566df41e34a97f202290e59be49e1190d277860c327e1dd | Python | 9,554 | 238 | """tl.migrate v1: the deciding real-artifact test and the transaction law.
The DECIDING TEST is named by the memo, never assumed (MEMO 3.6): migrate
the genuine harvested v2.31.0/v2.33.0/v2.34.1 artifacts to the current
schema, load under main, validate, and assert provenance and
absent-family disclosure. Failure inje... |
aee116e1c9740c2e9bb948ce962679b819d0291bf442f16f7594aee59cea3750 | Python | 9,555 | 269 | import logging
import json
from typing import List, Union
import numpy as np
import numpy.typing as npt
import scipy
from pymatgen.core.structure import Molecule
from pymatgen.analysis.graphs import MoleculeGraph
from pymatgen.analysis.local_env import OpenBabelNN, metal_edge_extender
import torch
logger = logging... |
15aa73825e9dea49ec438ff657a808cd9bd2726b23d7146376a1ac61fe36df6c | Python | 9,556 | 268 | """Smoke coverage for receptive-field visualization helpers."""
from __future__ import annotations
from collections.abc import Mapping, Sequence
from fractions import Fraction
from typing import Any
import pytest
import torch
from PIL import Image
from torch import nn
import torchlens as tl
from torchlens.receptive... |
1be810d134ed51e37e78dfd499045cebdf2e9a607ee067ae30c51f5ff451c951 | Python | 9,556 | 277 | import dask.array as da
import numpy as np
import pytest
import zarr
from numpy import ones, zeros
from ome_zarr import OMEZarrLabels, OMEZarrMultiscale
from ome_zarr.data import create_zarr
from ome_zarr.format import FormatV04
from ome_zarr.io import parse_url
from ome_zarr.reader import Node, Plate, Reader, Well
fr... |
f3201d3ee206372a0ccbd8211cae472f1f1617c99bf467f145d47d05b6b37e80 | Python | 9,556 | 212 | """ROS/Open3D pointcloud converter
This script can be imported as a module and contains the following public methods:
* `pointcloud_ros_to_open3d`
* `pointcloud_ros_to_numpy`
* `pointcloud_numpy_to_open3d`
* `pointcloud_open3d_to_ros`
* `pointcloud_open3d_to_numpy`
* `pointcloud_numpy_to_open3d`
"""
... |
f02b39d3d506bd635bedbcf684d0623b8abb72153e79ea1100fdf0e87a5ebd5b | Python | 9,558 | 243 | # #brighter.py
import numpy as np
import cv2
from PIL import Image, ImageEnhance
import subprocess
import os
import sys
import shutil
import argparse
import ffmpeg
from pathlib import Path
"""
Version: V2, 210419, modified by Julia (greenwald.juj@gmail.com)
------------------------
LINK TO ORIGINAL SOURCE:
https://git... |
24d5e071e7819e1c45d092e235d88617da243610fa5717a588baca1b5646c0d7 | Python | 9,559 | 290 | """Round-28/31 validation identity-witness pins (FN-1..6 closure).
The round-31 false-negative hunt proved that a dropped parent edge whose saved
value is "trivial" (bool mask, all-zero, all-abs-one) was INVISIBLE to every
validation layer, and that a wrong-parent swap between value-identical
producers passed by const... |
dbd54511a68bb747f8218b28f56cbac44181a80491d18c93fc5e0b4616d1ece2 | Python | 9,560 | 316 | import pytest
import pickle
from io import BytesIO
import rpy2.rlike.container as rlc
class TestOrdDict(object):
def test_new(self):
with pytest.deprecated_call():
nl = rlc.OrdDict()
x = (('a', 123), ('b', 456), ('c', 789))
with pytest.deprecated_call():
nl = rlc... |
d5d60987099850d703f28b409a925b06ce0deb6d3e57020b09c7648f6b8d765e | Python | 9,561 | 304 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... |
3ce147b0329c0a8b9d9281a3458692102511225484464b29db5a015e55d038d4 | Python | 9,562 | 237 | import os.path as os_path
import pkg_resources
import traceback
import nanite
from PyQt5 import uic, QtCore, QtWidgets
from PyQt5.QtCore import QStandardPaths
from ..extensions import ExtensionManager, SUPPORTED_FORMATS
class ExtensionErrorWrapper:
def __init__(self, ehash):
self.ehash = ehash
def ... |
141f32556c4289faf2d85b521b8173fcedf6fb08a8b2ab11146a12e01bfc214c | Python | 9,565 | 239 | """7. Fine-tuning SOTA video models on your own dataset
=======================================================
This is a video action recognition 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... |
72932cf99b738c8775488c96da6172420355b4ff375c0cef1d460163736f4b76 | Python | 9,566 | 317 | from __future__ import annotations
import pytest
m = pytest.importorskip("pybind11_tests.smart_ptr")
from pybind11_tests import ConstructorStats # noqa: E402
def test_smart_ptr(capture):
# Object1
for i, o in enumerate(
[m.make_object_1(), m.make_object_2(), m.MyObject1(3)], start=1
):
... |
67b23e9e13f3aae80f7d1296092595fd51d22d45cb83dfd9a55b4d7b5eef1626 | Python | 9,567 | 258 | from types import SimpleNamespace
import numpy as np
def positional_effects_near_splicepoints(
data,
*,
num_motifs,
blur_radius,
effect_radius=100,
normalize_mode,
splicepoint_types="AD",
**kwargs,
):
"""
Positional effects of motifs near splicepoints. This is a wrapper around
... |
acc01bfea08c883b8b29aa449ab8967509312373aaf87375047fc1b670a8e2da | Python | 9,570 | 254 | #!/usr/bin/env python3
"""Compare two SASS files, ignoring register assignments and addresses.
Normalizes registers per-instruction so that two instructions doing the
same operation with different register allocations compare as equal.
E.g. "UIADD3 UR30, UP1, UR30, 0x70, URZ" and
"UIADD3 UR14, UP1, UR38, 0x70, UR... |
d526d199bfa6002785aaace13ab2ab76b10f99dc9743d070d7b68813f7cb9385 | Python | 9,570 | 273 | """
Simple scikit-learn interface for Emb-GAM.
Emb-GAM: an Interpretable and Efficient Predictor using Pre-trained Language Models
Chandan Singh & Jianfeng Gao
https://arxiv.org/abs/2209.11799
"""
from numpy.typing import ArrayLike
import numpy as np
from scipy.special import softmax
from sklearn.base import BaseEsti... |
82837219aa09512d9bebd9e3e3bab91a1fa8449b595cc45b406a2b960c57c05c | Python | 9,572 | 198 | import re
from typing import Optional
import numpy as np
import pandas as pd
import patsy
import statsmodels.api as sm
from anndata import AnnData
from patsy import dmatrix
from scipy import stats
from scipy.sparse import issparse
from statsmodels.sandbox.stats.multicomp import multipletests
from ..logging import log... |
8d3832f6415de011c6fc62193577e82e6d18fbe355ca879c2b90dcbf98ad191e | Python | 9,572 | 252 | """W051 FIX2 -- the declared-crossing chain arm of the alignment license.
The audit-3.1 license (``tests/test_w051_episode_join_grading.py``) refuses
tail alignment unless the source width is the emitted-only or the measured
entry-plus-one-per-step shape. That refused the DECLARED tool-call shape: a
``generate()``-sty... |
919c218cca891d957d05ca1214ccf35e4d2c41a643f941cd95c04aeefdb23059 | Python | 9,573 | 250 | import ssm
import ssm.extensions.mp_srslds.emissions_ext as mp_emission
import ssm.extensions.mp_srslds.transitions_ext_2 as mp_transition
import ssm.init_state_distns as isd
import scipy.io
from matplotlib import pyplot as plt
import numpy as np
import autograd.numpy.random as npr
import seaborn as sns
from ssm.plots ... |
f7b590a7d4af87e270de82d92fdff9ee0277ce2866e4b9d69524633b03a8ac35 | Python | 9,573 | 298 | """Backing implementation for InstallRequirement's various constructors
The idea here is that these formed a major chunk of InstallRequirement's size
so, moving them and support code dedicated to them outside of that class
helps creates for better understandability for the rest of the code.
These are meant to be used... |
5c6b8dbdf9a7ccc41e85a26db820509ba5352392503a650908aa121c5b8c6859 | Python | 9,579 | 312 | """Planted per-op payload corruption battery (b9 R74/75-2).
The flagship per-op replay comparator had a measured mutation kill margin of
ONE test: with ``matches_saved = True`` planted at the replay callsite, all
of ``test_validation.py`` stayed green and exactly one diagnostics-payload
test failed. Nothing planted a ... |
93cfea5cf89736e4adafe5a7aed85aad1fab8da708eb105fa0b709942903c370 | Python | 9,580 | 233 | import numpy as np
import logging
logger = logging.getLogger("text.regression.interpdata")
def interpdata(data, oldtime, newtime):
"""Interpolates the columns of [data] to find the values at [newtime], given that the current
values are at [oldtime]. [oldtime] must have the same number of elements as [data] h... |
8b27e390a98d655c85566d006e50fb1aec1fdf32797feccf1e17ed131328b22b | Python | 9,584 | 310 | import tensorflow as tf
from keras.src.backend import config
from keras.src.backend.common import dtypes
from keras.src.backend.common import standardize_dtype
from keras.src.backend.tensorflow.ops.core import cast
from keras.src.backend.tensorflow.ops.core import convert_to_tensor
def cholesky(a, upper=False):
... |
ccd1869b223bf244e44468ebc46254f0dbebc2612c803b9db36774b57b0b66e4 | Python | 9,584 | 242 | # 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... |
a924987f66461e2540b17ead78bd9ea426887b4e76aa7e0f43372645bc45580e | Python | 9,590 | 260 | """
Unit tests for target detection diagnostics.
Tests diagnostic capabilities for target detection including image quality analysis,
logging, and diagnostic data collection.
"""
import json
import os
import tempfile
import unittest
from pathlib import Path
from unittest.mock import patch
import cv2
import numpy as ... |
f2f9c82b000c16fa5bee0c12f65bd93012efb4f92f3df8ab62aa4f16ce16f8f1 | Python | 9,594 | 186 | import os
R = os.path.dirname(os.path.abspath(__file__))
def patch(rel, pairs):
p = os.path.join(R, rel)
if not os.path.exists(p): print(f"MISSING {rel}"); return
s = open(p).read(); n = 0
for old, new in pairs:
if old in s: s = s.replace(old, new, 1); n += 1
elif new in s: n += 1
... |
c96c9869a4bd177a3d25b21cce7d3ae00e60d42e7f5222910f119a4ea61bb4b1 | Python | 9,596 | 270 | from glob import glob
from distutils.util import convert_path
import distutils.command.build_py as orig
import os
import fnmatch
import textwrap
import io
import distutils.errors
import itertools
from setuptools.extern import six
from setuptools.extern.six.moves import map, filter, filterfalse
try:
from setuptool... |
1735c90ce4837ac886bad2c07c95b43cb5a231c37572abd7c87fa217d5907b83 | Python | 9,597 | 368 | from unittest.mock import Mock, patch
import pytest
from celery import bootsteps
class test_StepFormatter:
def test_get_prefix(self):
f = bootsteps.StepFormatter()
s = Mock()
s.last = True
assert f._get_prefix(s) == f.blueprint_prefix
s2 = Mock()
s2.last = False... |
a75e42d0e028fdc20866bef33abe717d4c232a45e506052ad500055921ffaae6 | Python | 9,598 | 242 | from rdkit import Chem
from rdkit.Chem import AllChem
import itertools
import numpy as np
import pandas as pd
from copy import deepcopy
from rdkit import DataStructs
from rdkit.Chem import MACCSkeys
from rdkit.Chem.AtomPairs import Pairs, Torsions
from rdkit.DataStructs import cDataStructs
from rdkit.DataStructs import... |
5d006bb5eded015208007ef441cc17ec057b576fad34118e54355521f5aa1af7 | Python | 9,602 | 294 | # -*- coding: utf-8 -*-
#
# xtensor_example_extension documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 26 00:29:33 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogen... |
fa7f141534809ec2a7c99f8a8cb68cb18b12d7122f4dc9aa7100f072a9d97b1a | Python | 9,604 | 216 | #!/usr/bin/env python
"""Methods for creating a story about a training process."""
import datetime
import os
import socket
from inspect import getfullargspec as fargs
import matplotlib.pyplot as plt
import numpy
import simplejson as json
import tensorflow as tf
from gymnasium.spaces import Box
from matplotlib import a... |
02c945adcd3e4499259318ad7ff62456692f49c5343f62f46d518483b3aec8aa | Python | 9,606 | 244 | """Guard: the repo's git hooks must actually be reachable AND functional.
A global ``core.hooksPath`` redirect silently disarms EVERY repo hook --
including the LOCKED ``no-internal-notes`` privacy gate on this PUBLIC repo
and the never-ship-a-major commit-msg/pre-push layers. That is precisely what
happened on 2026-0... |
bf30f400f67d55a2a350836be6ed2776d33b16eed48a635e16f4a308b5608818 | Python | 9,608 | 243 | """R20-2/R20-3: rank-changing getitem receptive fields are exact and honest.
Disputed-r2 b6 seed battery. The rank-changing getitem path (int+slice mixes)
DISCARDED the computed slice affine edges and served unshifted boxes under
``exact=True`` (pad0: H [1,4) vs gradient truth [4,7)), while the int-selected
batch axis... |
200a25725ddb8cdd086f5c37ff6e2ee000dffd4e5a1196b5d2925d560876a69b | Python | 9,609 | 233 | import wandb
import numpy as np
import os
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
import argparse
from sklearn import metrics
import torch.nn.functional as F
from datasets.dcase20 import get_test_set, get_training_set
from models.mn.model import get_model as get_mobilenet
from models... |
dd0ab6b76f7d259063b3601ddc118ca61c17a301fdf2f88b27f7698792445d23 | Python | 9,610 | 298 | """Tests for combined forward/backward visualization."""
from pathlib import Path
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.visualization._render_common import GRADIENT_ARROW_COLOR
from torchlens.visualization._render_leaf import (
_module_key_for_grad_fn,
_param_m... |
10dae05065cf6bd20385175fd4d2f67705d245b80247ebe5226dc50c046f8705 | Python | 9,614 | 195 | import numpy as np
import pandas as pd
import scipy.stats as stats
import sklearn.metrics as metrics
import tqdm
def sample_size(y_true, groups=None):
# create one group per sample if no group provided
if groups is None:
groups = np.arange(y_true.size)
# count groups with posive and negative sampl... |
54ed33d6d91f22d64dbaa4f68ebb8ad555e4a10a0ec7277a4ea05921833f2744 | Python | 9,616 | 249 | # SPDX-License-Identifier: LGPL-2.1-or-later
from __future__ import print_function, division, absolute_import
import unittest
import os
from pyEcoHAB import following as fol
from pyEcoHAB.utils import general as uf
from pyEcoHAB import Loader
from pyEcoHAB import Timeline
from pyEcoHAB import sample_data, data_path
fro... |
567147d92561784644952285a192342db47dd258cca089c90664adbaa8fff874 | Python | 9,616 | 265 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import pandas as pd
import pdb
import csv
import math
import matplotlib.pyplot as plt
import time
EPSILON = 1e-4
df_uniprot = pd.read_csv('Assay_Unip... |
bd3bd5214a4a75edbdcba032c759aa2dbc10870a505f14059477f1fc80c33548 | Python | 9,616 | 230 | import logging
import os
import pickle
import tqdm
from pathlib import Path
from ..dataset import GluonCVMotionDataset, DataSample, FieldNames, SplitNames
from ..utils.ingestion_utils import crop_video, process_dataset_splits, crop_fn_ffmpeg, \
crop_fn_frame_folder
_log = logging.getLogger()
_log.setLevel(loggin... |
544b2010b61fa439d720a244689e0393e8912a835d181e1444dddd8abaf57c9c | Python | 9,617 | 263 | import os
import torch
from PIL import Image
from shutil import rmtree
import matplotlib.pyplot as plt
import numpy as np
import ase
from ase.io import write
from rdkit import Chem
from rdkit.Chem import rdDetermineBonds
from tqdm import tqdm
import schnetpack as spk
import argparse
import logging
from moinn.evaluatio... |
d05812643af1d75b0ccc3a053a45d1a0e5f06675ca863746e396c3bd4a5e7a17 | Python | 9,621 | 214 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Colorscale(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path... |
afce6007282f6115e5b1757bfdaa1758d1f564440e7f64f02db679af03f2ff37 | Python | 9,624 | 306 | """Phase 8a mutator-method tests."""
from __future__ import annotations
from typing import Any
import pytest
import torch
from example_models import TinyReluAdd as ReluAdd
import torchlens as tl
from torchlens.data_classes.cleanup import _scrub_intervention_fields_after_removal
from torchlens.intervention.errors im... |
9d709c8aba0be6498b2ff8449555b90abec3cacb1c324cebfcb39e09b1e88e5a | Python | 9,625 | 260 | """
Maps CodeCarbon EmissionsData to BoAmps report format.
"""
import warnings
from dataclasses import fields as dataclass_fields
from dataclasses import replace
from typing import Optional
from codecarbon.output_methods.boamps.models import (
BoAmpsEnvironment,
BoAmpsHardware,
BoAmpsHeader,
BoAmpsInf... |
ea0ad764a4b5d07dbf57be0d5411b3c6c9e19987ce1f119738eab9977e66b632 | Python | 9,630 | 219 | # SOURCE: vendored from https://github.com/audreycs/Memory-Networks-Automated-Essay-Grading @ master
# Vendored file:
# - model.py (MANM: Memory-Augmented Neural Model for Automated Grading, a PyTorch
# reimplementation of Zhao et al. "A Memory-Augmented Neural Model for Automated
# Grading", L@S 201... |
d116ff4f7785e9b60d0305580503ddfa77f326831509323328d588c4f5f80030 | Python | 9,631 | 236 | import torch.nn as nn
class MLP(nn.Module):
"""
Simple module for projection MLPs
"""
def __init__(self, input_dim=256, hidden_dim=2048, output_dim=256, no_biases=False):
"""
:param input_dim: number of input units
:param hidden_dim: number of hidden units
:param outpu... |
5e583a4cb5d2976d63d4e3c6d1db6948188fb9b9bd9fcc4808a15555a1ee4b3f | Python | 9,632 | 225 | import pickle
from AttentiveFP.AttentiveLayers import Fingerprint
import torch
import pandas as pd
from torch import optim
import os
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
import time
import matplotlib.pyplot as plt
import os
import torch
from rdkit import Chem
import sea... |
4a223b508fd633dda30b88156553c2f580f268a697845a28bc5bf9fcc8e05636 | Python | 9,633 | 258 | """F03 ledger memo items 0 + 0b: bundle honesty batch and fork lineage.
Covers the XS honesty batch (typed non-Trace membership refusal, apply()
member-name idiom, relate as a real method, most_changed doc semantics) and
the fork-lineage carriage (relation-table carry, bundle_id minting,
member-construction anchors, h... |
d06bacbb7a4524fc985c6fd92c4dd2adb601e50ffa8712c0c2bf139f8dd05524 | Python | 9,633 | 255 | # This file is part of MOXελ.
# Copyright (C) 2023 Antonios P. Sarikas
# MOXελ is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This... |
ea7c784d8c8a037ba4f545ca70951a5c1a38b9009230ada45d056af157cf202f | Python | 9,633 | 251 | import time
import datetime
# Classes of operant components
class BaseIO(object):
"""any type of IO device. maintains info on interface for query IO device"""
def __init__(self,interface=None,params={},*args,**kwargs):
self.interface = interface
self.params = params
class BooleanInput(... |
65039fedb595fbfd2ac5f41caacf5729d700be729d649726c6d44bb818247c89 | Python | 9,634 | 255 | import torch.nn as nn
import torch
import torchaudio
import math
import torch.nn.functional as F
import numpy as np
from copy import deepcopy
from bioseq2seq.encoders.encoder import EncoderBase
from bioseq2seq.modules import MultiHeadedAttention
from bioseq2seq.modules.position_ffn import PositionwiseFeedForward, Compl... |
82efab645271b118c64522a6a0b83ec308a15329494ddfca2aa7dbe13bc7efb2 | Python | 9,636 | 291 | import numpy as np
from . import utils
from . import tools
import warnings
warnings.simplefilter("always", UserWarning)
@utils.copy_td
def restrict_to_interval(trial_data, start_point_name=None, end_point_name=None, rel_start=0, rel_end=0, before=None, after=None, epoch_fun=None, warn_per_trial=False, reset_index=T... |
0a28c0a02c02bb9fdc4bdd8a9da39246071c532e1c4a14a8b0db65210d5cc3f9 | Python | 9,637 | 259 | import os
import time
import argparse
import shutil
import pathlib
import torch
from torch.utils.data import DataLoader
from torch.cuda.amp import GradScaler, autocast
import numpy as np
from utils import setup_exp, get_lcr
from loss import MultiTermLossFunction, LossManager
from data_preprocess import a... |
06d906a54ce3aa2512fd3d7493aff8cf1bd29e50cffbd84d93075041fcd55cc6 | Python | 9,641 | 233 | from unittest.mock import Mock, patch
import pytest
from celery.apps.worker import Worker, _shutdown_handler, safe_say
from celery.worker import WorkController, state
class test_Worker_purge:
"""Purging at startup must honour the broker connection retry settings.
``purge_messages`` runs from ``on_start``, ... |
8391fc0621905757571baf71f86e4e1254afff2d02c6339cc1f9ae5d8005affe | Python | 9,641 | 203 | """Smoke tests for quorum queue QoS behavior.
Verifies that tasks execute correctly on quorum queues with QoS settings
that differ from classic queues (no global QoS).
See https://github.com/celery/celery/issues/9929
"""
from __future__ import annotations
import pytest
from pytest_celery import RESULT_TIMEOUT, Celer... |
f6cf6a7fb2fce3a3eea9a8e0c4dc89f8d40fd344a1c0a6bbb6f4da52b74a007b | Python | 9,641 | 275 | """
Bearing-related plotting
"""
from __future__ import annotations
from typing import Any, Optional, Sequence
import numpy as np
from .. import plot, funcs
from ..util import nam
__all__: list[str] = [
"plot_turn_Dbearing",
"plot_turn_Dorient2center",
"plot_chunk_Dorient2source",
]
@funcs.graph("bear... |
3b6e27655906fd9bc40b410a447bbd8a6c1fb019836700f9e31ad37776ecf45d | Python | 9,642 | 272 | #!/usr/bin/env python3
"""Validate href/src targets in the built documentation site.
Run after ``zensical build`` (default ``site/``). Exits with code 1 if any
checked link is invalid.
By default only **local** links (under the site directory) are validated, so
CI does not depend on live docs or third-party HTTP beha... |
cfee9898e32612b8c1f1bb04d2973a2a92aa5103402e568d0af3a007346e5315 | Python | 9,643 | 246 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import os
import random
from itertools import chain as chain
import slowfast.utils.logging as logging
import torch
import torch.utils.data
from slowfast.utils.env import pathmgr
from . import utils as utils
from .build imp... |
c31caff9443d50c5acb192a2a3f82b5a51251258cb3f583a72cba8a181913851 | Python | 9,646 | 330 | """Optimization on the manifold of positive definite matrices"""
import warnings
import numpy as np
from ..datasets import sample_gaussian
from ..geometry.base import (
_symmetrize,
ctranspose,
sqrtm,
invsqrtm,
logm,
ddlogm,
)
def _retraction(point, tangent_vector, metric):
"""Retract t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.