sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e2a917214f9c2b46585749e3c9a73a06e5b163e880de5b09aff30a43e1211ef8 | Python | 14,736 | 349 | # 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... |
5f7ea6e41cbac2c67985f1ef24d11b419f68557fefdfc40ceb287513220b251d | Python | 14,740 | 381 | """P2 backward projection, label, accessor, and invariant tests."""
from __future__ import annotations
import re
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.validation.invariants import MetadataInvariantError, check_metadata_invariants
class _TwoPassModel(nn.Module):
... |
8bfdc21d872fe6a0fb5a824df3389faee52a131ee18275da4980c9afc0633d11 | Python | 14,742 | 364 | # 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... |
962801566b3d656213a8857fa63e8196b75bae6df6ab92d36b981c70ffa25abe | Python | 14,742 | 327 | import torch
from icecream import ic
import random
import numpy as np
from kinematics import get_init_xyz
import torch.nn as nn
from util_module import ComputeAllAtomCoords
from util import *
from inpainting_util import MSAFeaturize_fixbb, TemplFeaturizeFixbb, lddt_unbin
from kinematics import xyz_to_t2d
def mask_in... |
ce0c0caf8c69abd413107cbf761421c3f7f26ced42b2ea2a8ba128661e5017e2 | Python | 14,743 | 446 | """.. _lightly-simsiam-tutorial-4:
Tutorial 4: Train SimSiam on Satellite Images
==============================================
In this tutorial we will train a SimSiam model in old-school PyTorch style on a
set of satellite images of Italy. We will showcase how the generated embeddings
can be used for exploration an... |
4fcb232280804e0a2b1520a98dd8eed02dc39e5fd1da162a53784929172aee0a | Python | 14,746 | 365 | import os
import numpy as np
import pytest
from mirp import extract_features_and_images
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
@pytest.mark.ci
def test_square_transformation_filter():
data = extract_features_and_images(
write_features=False,
export_features=True,
write_i... |
e43084f3f71c9fa54be59ad5247c42b858aba97b8d53b852f0feacc439582051 | Python | 14,751 | 380 | import os
import shutil
import tempfile
from typing import List, Optional, Tuple
import numpy as np
import pytest
import torchvision
from PIL.Image import Image
from lightly.data import LightlyDataset
from lightly.data._utils import check_images
from lightly.transforms.torchvision_v2_compatibility import torchvision_... |
990609b1fd8d7a20e6540eb0275aff3071eed83a4410f73ee3376019159fe8c1 | Python | 14,756 | 433 | """
fach.py
Generate fatty acid composition heatmaps from a table of area values obtained by
untargeted lipidomics.
"""
import argparse
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pathlib
import random
import re
import seaborn as sns
from tqdm.auto import tqdm
def parse_lipid_annot... |
bb8ec99bf6cc01816fe4ab4e7f50ea5868e1b339360b0cd5ccfaf1f4fb16fc8a | Python | 14,757 | 395 | """Provider mechanics (ecosystem MEMO section 5, build item B3).
Consent law v1, executed: DISCOVERY IS METADATA-ONLY (the provider sentinel
module never imports before explicit activation), activation is explicit and
distribution-scoped, ``TORCHLENS_PLUGINS=none`` beats everything, and every
refusal carries its stabl... |
57eea17beed6282900a3b8bcd683de9ddf621012265f2251068c8b0da9efdf72 | Python | 14,760 | 371 | # FAITHFUL PORT of isjakewong/MIRACLE @ main (original framework: PyTorch + RDKit)
# https://raw.githubusercontent.com/isjakewong/MIRACLE/main/MIRACLE/models/mpn.py
# https://raw.githubusercontent.com/isjakewong/MIRACLE/main/MIRACLE/models/DDIModel.py
# https://raw.githubusercontent.com/isjakewong/MIRACLE/main/MIRACLE/... |
f67b2a1673f15b545c76f5fed45faa479776679686aabab64ff91036a719fe04 | Python | 14,760 | 254 | __author__ = 'Aaron Gudmundson'
__email__ = 'agudmund@uci.edu'
from scipy.optimize import minimize, curve_fit
import matplotlib.pyplot as plt # Create Figures
import scipy.ndimage as ndimage # Image Manipulation
import scipy.linalg as linalg
import scipy.sparse as sparse ... |
524212001fade198d172260721a6f1feccbf69c332cafdbe596e1775603225f0 | Python | 14,761 | 411 | import os
import numpy as np
import pytest
import torch
import torch.multiprocessing as mp
from absl.testing import parameterized
from torch._dynamo.utils import counters
from keras.src import backend
from keras.src import layers
from keras.src import metrics
from keras.src import models
from keras.src import optimiz... |
83228706ddd90cc22d20b60c3f6622ee1d4a67649d5d28227ca42624a0f8cd8c | Python | 14,768 | 383 | """
Tests for the frames_freeze feature in PointTracker.
Tests both modes:
- relaxation_during_freeze_frames=True: OF delta zeroed, mesh+relaxation still apply
- relaxation_during_freeze_frames=False: points fully frozen (exact copy of previous)
"""
import sys
import os
import numpy as np
import torch
import cv2
im... |
5cd2e5d1147592b4acfd87a94674c72a31cdec80416153cf0d21d5d730331837 | Python | 14,771 | 375 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
@author: Pramod Bharadwaj Chandrashekar, Li Liu
@email: pchandrashe3@wisc.edu, liliu@asu.edu
"""
import copy
import sys
import os
import random
import pickle as pk
import numpy as np
import pandas as pd
import tensorflow as tf
import scipy.stats as ss
from sklearn.mod... |
b441578853fe77ec8926003d0c9ecf8bf61cb817e039ec22a6b81840d93c1ea4 | Python | 14,772 | 415 | """Regression locks for three utility/validation-runner bugs.
Covers (audit IDs from the private maintainer task list):
1. **FUNC-CALL-LOC-LEAK** — ``FuncCallLocation`` must not retain a strong
reference to the captured frame's function object when source loading is
enabled, while still honoring the lazy source... |
fee52f3e5702b0231059c96dc9b6a784083ccccb582b503e3a8a92126deb2be4 | Python | 14,773 | 479 | from functools import lru_cache
from typing import Generator
import numpy as np
from mirp._images.generic_image import GenericImage
from mirp._masks.base_mask import BaseMask
from mirp._features.base_feature import Feature
from mirp.settings.feature_parameters import FeatureExtractionSettingsClass
class DataStatist... |
2844989a506d65562ab5836ee887af744583acfa40c2d129c86b28ab914cf385 | Python | 14,776 | 483 | import builtins
import contextlib
import functools
import warnings
import numpy as np
from keras.src import tree
from keras.src.backend.common import KerasVariable
from keras.src.backend.common import standardize_dtype
from keras.src.backend.common.backend_utils import slice_along_axis
from keras.src.backend.common.d... |
759c8f3a1014f2bd72083a47ed9b6709c0f14c352d0247bfcfd498aaec0b8b1f | Python | 14,779 | 398 | import torch
from torch import nn
import torch.nn.functional as F
from inspect import signature
from typing import Type, Dict, Union, Callable, List, Any
from ._utils import get_output_size, get_conv1dblock_output_len
from . import _layers as layers
class Tower(nn.Module):
"""A tower of blocks.
This is model... |
7dec8ef21c9fed5f2b296e79831de1264a4e0328b8fbf629e297551a6a3c55dc | Python | 14,779 | 439 | """Golden differential tests for capture-pipeline Stage-0 characterization."""
from __future__ import annotations
import copy
import hashlib
import json
import os
import subprocess
import sys
from pathlib import Path
from typing import Any
import pytest
from ._characterize import CASES, CaseSpec
_ROOT = Path(__fil... |
bd0bc3c5c3de219abab4624efa393e59e26699864f0d2795269fedbd4498b3b2 | Python | 14,780 | 418 | from __future__ import print_function
import tensorflow as tf
#import keras
# from keras.optimizers import Adam
# from keras.callbacks import ModelCheckpoint
# from keras import backend as K
# Use tensorflow. here, cannot use .tf
from tensorflow.keras.layers import Add
from tensorflow.keras.optimizers import Adam
fr... |
4173a5a5de97e4f6819c8c84e4db0a6e978c660c8299b5faffcde6567cf184a0 | Python | 14,784 | 334 | """Round-49 secB_1 immunizer -- gate/reconstruction coupled through ONE substitution predicate.
The load-time forged-flag lossy gate and the sparse reconstruction path used DIFFERENT faithfulness
criteria: reconstruction substitutes a PLAIN ``dict`` / ``tuple`` (dropping the recorded type + any
``__new__``-computed st... |
49c1eb3fbf51bf7f17f24d9fb415080f832e4f8e9a1c6950c64ef47c96c904b8 | Python | 14,784 | 370 | import torch
import torch.nn as nn
import torch.nn.functional as F
from operator import itemgetter
use_gpu = torch.cuda.is_available()
import numpy as np
device = "cpu"
if use_gpu:
device = "cuda"
class FC_2_Layer(torch.nn.Module):
def __init__(self, number_of_inputs, neuron_l1, neuron_l2, drop_rate):
... |
ba4eadaae83b20eab794d72349cf63798208e2d0b52b67c20859153efaf63c07 | Python | 14,787 | 433 | """Deep Q Network."""
import argparse
from collections import OrderedDict
from typing import Dict, List, Optional, Tuple
import numpy as np
import torch
from pytorch_lightning import LightningModule, Trainer, seed_everything
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.plugins import ... |
1f4273e0ea01fa39485f05e4278c66960040af2aa12720a1b615451225f3e960 | Python | 14,794 | 355 | import argparse
import random
from mxnet import gluon, image,autograd
from mxnet.gluon.data.vision import transforms
from mxnet.gluon.data import DataLoader
from mxnet.gluon import nn
import mxnet.ndarray as nd
import mxnet as mx
from mxboard import SummaryWriter
import os
from mxnet.gluon.model_zoo import vision
clas... |
e39a38369ab1e9c7429f9b9849f6d44dd2c97db6fd569d88a61bfd16746c0fdf | Python | 14,800 | 475 | """Phase 6 saved-DAG replay engine tests."""
from __future__ import annotations
import importlib
from collections.abc import Callable
from typing import Any, cast
import pytest
import torch
import torchlens as tl
from torchlens.intervention.errors import (
ControlFlowDivergenceWarning,
MultiMatchWarning,
... |
d01eb17a9ea5bd1a19946400e88d28ecc7c32296b1cd47e0f171c4565d51402a | Python | 14,813 | 348 | """F06 B9: the epsilon-LRP litmus recipe + the SiteStash mechanism (D30-D32).
The recipe below is the CLEANROOM docs recipe from
``docs/recipes/lrp_epsilon_litmus.md`` transcribed verbatim (keep the two in
lockstep) -- written from the published equations, never from LGPL code.
TorchLens ships only the pairing mechani... |
48c027a61a7df228a65f4c82aa8bce2b98f9ba2abd0210c6dce275ffbd68c89e | Python | 14,816 | 393 | import time, os, sys
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
import numpy as np
sys.path.insert(0,"../")
import functions_common
import argparse
### read parameters
parser = argparse.ArgumentParser(description='Run cellpose macrophage segmentation.')
parser.add_argument('param',... |
32b2d20dcdbabb62ebb3d256d7b82a78f309da73b13f6f279912a4eb6f5677c2 | Python | 14,817 | 375 | from sklearn.metrics import mean_absolute_error
from sklearn.linear_model import Ridge
from os import path, remove
import numpy as np
from mne.decoding import SPoC
import pickle as pkl
from .constants import COV_METHOD, SPOC_COMPONENTS, BANDS, RT_MAD_FACTOR
import shap
import matplotlib.pyplot as plt
from scip... |
635b117ccebd61d9f307a71dad96eddc124d041ebe155ded34e00e973fc8c01a | Python | 14,821 | 408 | from sklearn.metrics import confusion_matrix
from tensorflow import keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.keras.callbacks import ModelCheckpoint
import numpy as np
import pandas as pd
import mat... |
630f3568e965434d72e2b399171e82ac3b2cb690321e044027200d4d9ab497ef | Python | 14,834 | 474 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import json
import wormbrain as wormb
import pkg_resources
import os
import pickle
import fdlc
filename_matches = "matches.txt"
def pairwise_distance(A,B,returnAll=False,squared=False,thresholdDz=0.0):
'''
Calculates th... |
a1680bf576ae5aa2838157a6798ed8c617d637007df172863112462fbbea76a7 | Python | 14,834 | 322 | import os
from os.path import join as pjoin
import tempfile
import subprocess
import resource
import time
import urllib
import re
import urllib.request
import numpy as np
from tqdm.auto import tqdm
# # PeptideLocator
# PEPTIDE_LOCATOR_CMD = None # TODO
# PEPTIDE_LOCATOR_BIN_DIR = pjoin(BIN_DIR, "PeptideLocator")
# PEP... |
5588267ca6a1f78c2b35cd26174a33465e8c439ba2e67c8c724e3430516103c4 | Python | 14,838 | 400 | import ipywidgets as widgets
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from matplotlib import cm
from IPython.display import display, clear_output
from gates import ros_inf, get_ros
from mitochondria import Mito
import figure_properties as fp
from utils import Q_nak, R... |
f25ba20ed476fc8e8a4443913efeca434953103b9a29927880a49ac0911b626e | Python | 14,838 | 294 | # 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... |
5cba806ac56c56c39e8ac21fc12f1d0ee0df7675605aa56faa9d45023bcb0537 | Python | 14,840 | 450 | import os
import re
import numpy as np
from carbontracker import exceptions
from typing import Dict, Union, List
def parse_all_logs(log_dir):
"""
Parse all logs in directory.
Args:
log_dir (str): Directory of logs
Returns:
(dict[]): List of log entries of shape
{
... |
b6a4fcc441b0db3f58712c62f34bb128b4d7ab9db509819581ee407efac7cb78 | Python | 14,842 | 338 | '''
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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 requir... |
093c312854cea7c86c085b011f3ac0a65b807d5a5652f4ec1423cd3b2683b7ab | Python | 14,844 | 276 | # -*- coding: utf-8 -*-
from utils import (
read_data,
input_setup,
imsave,
merge,
gradient,
lrelu,
weights_spectral_norm,
l2_norm
)
import time
import os
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
class CGAN(object):
def __init__(self,
sess,
... |
f2b2121b73cbe9ecdbfcdf0dbc4c66a9cdbce9e21b4cbc8a3e38f297f55372dc | Python | 14,844 | 413 | import math
import os
import re
import warnings
import numpy as np
from . import arrayfun, config
from . import libcudawrapper as libcu
from .util import imread
try:
from numba import jit
except ImportError:
def jit(**_):
def deco(f):
return f
return deco
# #THIS ONE WORKS BES... |
c78c7788d5d4da4cb7b1d4646765343786dac59461346537dce24d32114ec0cc | Python | 14,845 | 402 | """MLX live replay-validation oracle tests."""
from __future__ import annotations
import pytest
pytestmark = pytest.mark.backend_mlx
mlx = pytest.importorskip("mlx")
import mlx.core as mx # noqa: E402
import mlx.nn as nn # noqa: E402
import torchlens as tl # noqa: E402
from torchlens.backends.mlx import MLXBack... |
501fdb7bd63159745afb73b91ed2fd8d696b7d99c3bce6abeab4c3d6458a8314 | Python | 14,847 | 459 | import random
from typing import List, Tuple, Union
import numpy as np
from colormath.color_conversions import Lab_to_XYZ, XYZ_to_Luv, convert_color
from colormath.color_objects import LabColor, XYZColor, sRGBColor
from pyciede2000 import ciede2000
from scipy.spatial import ConvexHull
from skimage import color
try:
... |
24a34ffc7a2f07f4dae4a0573b70fb1b00e268f7d57cf3cf35f918322fc5ffea | Python | 14,854 | 354 | # FAITHFUL PORT of google-deepmind/ferminet @ main (original framework: JAX)
# Files: ferminet/networks.py, ferminet/network_blocks.py, ferminet/envelopes.py,
# ferminet/jastrows.py
#
# FermiNet (Pfau, Spencer, Matthews, Foulkes 2020 -- "Ab-Initio Solution of the
# Many-Electron Schrodinger Equation with Deep Ne... |
5fae1a97c2804b26bbd77a68ebe6ce8238c0a688f666a8331adb833cd3946cf5 | Python | 14,855 | 413 | import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
import pandas as pd
from misc.utils import center_pad_to_shape, cropping_center
from .utils import crop_to_shape, dice_loss, mse_loss, msge_loss, xentropy_loss, panoptic_quality
from collections import OrderedDict
####
def... |
e8e9d2d4a8ccc874fa58e50c10941b8bbcd09d950ca397d2f419394fb83690ef | Python | 14,856 | 376 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Test MneExperiment using mne-python sample data"""
from pathlib import Path
from os.path import join, exists
import pytest
import shutil
from warnings import catch_warnings, filterwarnings
import numpy as np
from numpy.testing import assert_almost_equal, asse... |
966b60c738f9f6c903adc3dea02d20b4cf0b699d210e8d3ac2218aa10095c7ac | Python | 14,859 | 473 | """Series of networks used Based on implementations found here:"""
import math
from typing import Tuple
import numpy as np
import torch
from torch import FloatTensor, Tensor, nn
from torch.distributions import Categorical, Normal
from torch.nn import functional as F
from pl_bolts.models.rl.common.distributions import... |
2bd6d8a1a71b389468a7198124333aa7c7774499b24bef29e05635cfff3f0183 | Python | 14,861 | 496 | """Geodesics for SPD/HPD matrices."""
from array_api_compat import array_namespace as get_namespace
from ._backend import diag_indices, tril_indices
from ._check import check_function, check_matrix_pair
from .base import ctranspose, _eigvalsh, sqrtm, invsqrtm, powm, logm, expm
def _check_alpha(alpha, X, axis=(-2, -... |
14ff72020f25f02d7dea0ed41d9261d0e5d415c713e4779d1fa274f98a1129e4 | Python | 14,864 | 435 | # --- 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 Map(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path_str = ... |
f56b3f1d505a53f031e578bb187a181eed5e83ff300ca0d5eb54f9df70656ae6 | Python | 14,864 | 285 | #结论:当模型进行ensemble的时候性能会明显提升。
import json
import numpy as np
import os, sys
import random
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import to... |
31e927461c95d56af4a9f2df515cf56e8e1523dbb6e404db1b325ce4777d5be4 | Python | 14,874 | 410 | from sklearn.metrics import confusion_matrix
from tensorflow import keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.keras.callbacks import ModelCheckpoint
import numpy as np
import pandas as pd
import mat... |
84f363f044e1c75197047fbc1ca7341d367fe329dad563b49208291a60b25c72 | Python | 14,876 | 318 | """
Component Combinations
======================
Explore different approaches combining model components.
"""
# sphinx_gallery_thumbnail_number = 3
import numpy as np
import matplotlib.pyplot as plt
from specparam import SpectralModel
from specparam.plts import plot_spectra
from specparam.utils.array import unlo... |
491598c9fb6e8f4c31870fbce7b7ecab8ffc78c348ae663f9240bba27ca69e8f | Python | 14,884 | 415 | """Watch v1 renderers, derived quantiles, and payload conversion (F25 item 7).
Byte-determinism, honesty marks (presence gaps, nonfinite badges, N-of-M
footers, coarsening ticks), typed refusals, and the cairosvg round-trip
(the SVG root must declare xmlns:xlink -- the round-3 gate finding) over
BOTH a real collector ... |
ccca02de53bb8e20131f05a12e0dbadf72cac1f2f1d994ebd683b14952c512c0 | Python | 14,890 | 434 | """Phase 4 capture-unification retroactive-save regression tests."""
from __future__ import annotations
import warnings
from collections import defaultdict, namedtuple
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.backends.torch._tl import get_tensor_la... |
773f6cb8f09f7c4742413b77adb13349dc11f1bad3dd1ef238261de16f180dcc | Python | 14,892 | 375 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Continuous normalizing flow layer for PyTorch.
"""
# =========================================================... |
7c436817c0b9f970b07fa862bfec893e6f224e869fadc425b187e817bc046bbc | Python | 14,896 | 427 | import numpy as np
import numpy.typing as npt
import pandas as pd
from numba import njit, prange
from numba.core import types
from numba.typed import Dict, List
from scipy.spatial.distance import canberra
from sklearn.preprocessing import MinMaxScaler
from .base import get_lrs_scores
def nonzero_quantile(expr, q, me... |
48c6d6f258b5d5ad3d1b4864ba0f7bd793c209937092b2bbb893611e7b401ee5 | Python | 14,897 | 369 | # --- 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 Marker(_BaseTraceHierarchyType):
_parent_path_str = "box"
_path_str = "bo... |
884e7b2016796ed367440a5da07bf33b87913f0da35d28b96938b00726192301 | Python | 14,901 | 394 | import os
from xml.etree import ElementTree as ET
import argparse
from itertools import chain
from collections import defaultdict
import operator
import numpy as np
import pandas as pd
import networkx as nx
import plotly as py
import plotly.graph_objs as go
############################################################... |
8acb2b18705c4282061ff2003b7f23a6db4864abf066f4b055a800b8cdb15f0c | Python | 14,911 | 428 | from __future__ import annotations
import pytest
from pybind11_tests import kwargs_and_defaults as m
def test_function_signatures(doc):
assert doc(m.kw_func0) == "kw_func0(arg0: int, arg1: int) -> str"
assert doc(m.kw_func1) == "kw_func1(x: int, y: int) -> str"
assert doc(m.kw_func2) == "kw_func2(x: int... |
16a276487d7d0cb2c90a2f451ad482939b9faaaaa1453e43a1fcc7b73a187337 | Python | 14,916 | 413 | # Copyright (c) 2025, Tri Dao.
from typing import Optional
from dataclasses import dataclass
import cutlass.cute as cute
from cutlass import Boolean, Int32, const_expr
from cutlass._mlir.dialects import nvvm
from cutlass.cutlass_dsl import if_generate, dsl_user_op
from cutlass.pipeline import PipelineState
from cutla... |
8a4acc4d8e96159e647a243f8ebe359ee602b7e747ead7907021be5b6804a28d | Python | 14,919 | 489 | """Command-line interface tests."""
import os
import sys
from glob import glob
from unittest.mock import patch
import numpy as np
import pandas as pd
import pytest
from nipype import logging
from xcp_d.cli import combineqc, run
from xcp_d.cli.parser import parse_args
from xcp_d.cli.workflow import build_boilerplate,... |
611c1f0672456ca29cf1edceda0ed51b9f6b49d86c61c667ea60c0c8337afcaa | Python | 14,920 | 349 | # Copyright (c) 2020 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... |
0104e2057f3a75b6e8578d351369500f07f64a70173684fdc3d544ac5122f1c0 | Python | 14,921 | 363 | # the class for storage representation, not exposed to the user
from __future__ import annotations
import os
from collections.abc import Sequence
from typing import Any, cast
import transformnd as tnd
import zarr
from ome_zarr_models.v06.coordinate_transforms import (
AnyTransform,
CoordinateSystem,
)
from om... |
4f24e764d4c4d4806b7db4562e4e374fea5ab9013d0b61c812dd433158ebe91e | Python | 14,924 | 369 | # --- 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 Marker(_BaseTraceHierarchyType):
_parent_path_str = "violin"
_path_str = ... |
cab8e6550f6254e8af8530820ff1d3deb4dbe08037f36380e609983eeb5908d9 | Python | 14,929 | 358 | import json
import sys
FOURSPACES = " "
input_json_path = sys.argv[1]
params = json.load(open(input_json_path, "r"))
def write_images():
filter_images = params["images"]["filter_images"]
_str = "\nImages:[module_num:1|svn_version:\\'Unknown\\'|variable_revision_number:2|show_window:False|n... |
0744cc0b100689e1c5f38e555504de3aab55690380d75d4ccdbbe2ec00ee536d | Python | 14,931 | 454 | """Characterization net for torch capture behavior before B10 driver reroutes."""
from __future__ import annotations
import importlib
import warnings
from typing import Any, cast
import pytest
import torch
from torch import nn
import torchlens as tl
import torchlens._state as torchlens_state
from torchlens.data_cla... |
d8fcbbe7df731507d32745ce13d2768e2b5301f37541e4914dc738ff4c4876d4 | Python | 14,931 | 361 | from functools import partial
from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
from torch import nn, Tensor
import torch.nn.functional as F
from torchvision.ops.misc import ConvNormActivation
from torch.hub import load_state_dict_from_url
import urllib.parse
from models.dymn.dy_block import Dyn... |
2c3eab548f30afac7542c33b7a29652726037cbe9f1e97ee9594f8cce03e9227 | Python | 14,935 | 342 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
d8c2157e4d5ef3e16d41557647c98de8f1bd5842f3861e74e4f6752cd05a14e1 | Python | 14,937 | 324 | """Pruned ResNetV1bs, implemented in Gluon."""
from __future__ import division
import json
import os
from mxnet.context import cpu
from mxnet.gluon import nn
from mxnet import ndarray
from ..resnetv1b import ResNetV1b
from ..resnetv1b import BasicBlockV1b
from ..resnetv1b import BottleneckV1b
__all__ = ['resnet18_v1b... |
76a28024d6454c61f9d7aba8f2c9b36094b2b386185fa5bb7e1c2d8298fa0b26 | Python | 14,939 | 443 | from collections.abc import Iterable
import numpy as np
import pandas as pd
import scipy.spatial as spatial
from anndata import AnnData
from numba import jit, njit, prange
from numba.typed import List
from stlearn.tl.cci.het_helpers import (
get_between_spot_edge_array,
get_neighbourhoods,
init_edge_list,... |
831a7dcb47d7004b8c79e142da2441250f25b9a325bf102b4b1c018cec86b6b7 | Python | 14,940 | 450 | """Implementation of utility functions that can be applied to spaces.
These functions mostly take care of flattening and unflattening elements of spaces
to facilitate their usage in learning code.
"""
import operator as op
from collections import OrderedDict
from functools import reduce, singledispatch
from typing im... |
d8659a1ad69f387dca3638fba7b680609162c5165eaa089b6b861665d60780e7 | Python | 14,941 | 383 | """HDF5 utilities: hierarchical traversal, group I/O, and bulk-close helpers.
Convenience wrappers around :mod:`h5py` for the face-rhythm project. Nothing
here is CUDA- or video-specific; the module is safe to import anywhere.
"""
import gc
import h5py
import numpy as np
def close_all_h5():
"""
Closes every... |
a4f89dbded6132c997cd2c3609d6c485f65a2248b7e3f3a061e79a0e72f1c5aa | Python | 14,946 | 460 | # --- 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 Scene(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path_str ... |
b0547ff92e0b338e52f4b8f6af9ee049850a4640cbb8781a2db6a82a6cf12996 | Python | 14,948 | 326 | import os
from typing import (
Any,
)
from webob.compat import cgi_FieldStorage
from galaxy.exceptions import (
ObjectNotFound,
RequestParameterInvalidException,
)
from galaxy.managers.context import ProvidesHistoryContext
from galaxy.schema.schema import GenerateTourResponse
from galaxy.schema.tours impo... |
10996bb384a60046b332147163bde667eb21a02d33caf43d2a85b6a21a643af7 | Python | 14,950 | 275 | import os
import matplotlib.pyplot as plt
import ipdb
import numpy as np
import pandas as pd
import numpy
from tqdm import tqdm
def file_name(file_dir):
for root, dirs, files in os.walk(file_dir):
return files # 当前路径下所有非目录子文件,列表
def copyfiles(traindata="train"):
if traindata == "train":
case... |
574d23f1a38be481b16ef434a31e21845f6f7a962ec1d930d436c2b2f1c49e37 | Python | 14,951 | 354 | # from __future__ import annotations
# from typing import TYPE_CHECKING
# if TYPE_CHECKING:
# from data import ConfEnsembleDataset
# the previous lines are to avoid cyclic dependencies
# between ConfEnsembleDataset and DataSplit
import os
import numpy as np
import pandas as pd
# from data import ConfEnsembleData... |
1d38faa58f47e7ef9c6180bad68beea219c0c094e4546c7ff2210ecc80de3636 | Python | 14,952 | 387 | import pickle
from unittest.mock import Mock, call, patch
import pytest
from celery import states
from celery.backends import azureblockblob
from celery.backends.azureblockblob import AzureBlockBlobBackend
from celery.exceptions import ImproperlyConfigured
from celery.result import AsyncResult
MODULE_TO_MOCK = "cele... |
26fa7cc311b841f8409ad93933d3a3a52b068150c6f15fc3cd0c107e7a9aaf9d | Python | 14,955 | 385 | from __future__ import annotations
import collections.abc as c
import hashlib
import typing as t
from collections.abc import MutableMapping
from datetime import datetime
from datetime import UTC
from itsdangerous import BadSignature
from itsdangerous import URLSafeTimedSerializer
from werkzeug.datastructures import C... |
2faec97f928af91a6232f7f09fac6f1fa647c73f6458c2619bb4b9c3c0902b03 | Python | 14,956 | 428 | """
The molecule dataset for finetuning.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/data/data.py
"""
import random
from argparse import Namespace
from typing import Callable, List, Union
import numpy as np
import torch
from rdkit import Chem
from torch.utils.data.data... |
1909a7843c039b828a980591f09f7089b49c977520fcdc3154d85d85d4f487e4 | Python | 14,960 | 376 | # Copyright (c) 2025, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri Dao.
import os
import random
import pytest
import torch
from torch._subclasses.fake_tensor import FakeTensorMode
import flash_attn.cute.interface as interface
from flash_attn.cute.cache_utils import JITCache
from flash_a... |
f717ea1f5235a32890d9480f43f3fee8dafb5116e10eaade844b1ee9988b76ef | Python | 14,961 | 309 | import argparse
import os
from collections import defaultdict
import numpy as np
import pandas as pd
import pylab as pb
import tqdm
from datetimerange import DateTimeRange
from mne.preprocessing import ICA
from scipy.stats import pearsonr, scoreatpercentile
from sklearn import linear_model
from sklearn.exceptions impo... |
05ae183f6ceb1d81102e1fc3fe55098a62203f69ce99538548ef796029256d13 | Python | 14,969 | 337 | """Administrator-defined extra user preferences, configured in ``user_preferences_extra_conf.yml``.
Values not kept in the vault are stored as one JSON object in the user's
``extra_user_preferences`` preference, keyed ``<section>|<input>``. File source
templates read them by that key, so the storage format is fixed; o... |
7d03a707741ea1f02b695746d3de25c65af8f3709b1d8f46a1da364db2db1eb1 | Python | 14,969 | 403 | import os
import subprocess
from unittest import mock
import pytest
from codecarbon.core import powermetrics as powermetrics_module
from codecarbon.core.powermetrics import ApplePowermetrics, is_powermetrics_available
class FakeProcess:
def __init__(self, stderr="", returncode=0):
self._stderr = stderr
... |
d132046b2d9f5a16426dbe6bb67bba0053ba64aec8ba971b990cd39a7661f7e8 | Python | 14,969 | 356 | '''
Analyse and visualise metrics produced by SpatioTemporal Indexing Clustering (NASTIC and segNASTIC)
Tristan Wallis, Sophie Hou
'''
last_changed = 20210802
import PySimpleGUI as sg
sg.theme('DARKGREY11')
popup = sg.Window("Initialising...",[[sg.T("NASTIC Wrangler initialising\nLots of modules...",font=("Arial bold"... |
ba8de100bfd040efe45fc2ce7cfd99a35927a000c65dac931c06d387ac3e04fe | Python | 14,971 | 430 | """
> :warning: **DEPRECATED**: This will be removed in version 1.0.0. Check [nwbmatic](https://github.com/pynapple-org/nwbmatic) or [neuroconv](https://github.com/catalystneuro/neuroconv) instead.
Class and functions for loading data processed with the Neurosuite (Klusters, Neuroscope, NDmanager)
@author: Guillaume ... |
84deb5c9dde4deb4934f4c1d22312ad6dc22354b70302568a9e912b300484fa3 | Python | 14,979 | 404 | """Program used to start a Celery worker instance."""
import os
import sys
import click
from click import ParamType
from click.types import StringParamType
from celery import concurrency
from celery.bin.base import (COMMA_SEPARATED_LIST, LOG_LEVEL, CeleryDaemonCommand, CeleryOption,
hand... |
219dddf33f8de7a3b37096a00b1b0fc3d9d156028b956235c6a9ee4da067ca66 | Python | 14,982 | 369 | """
@package ssw_wrap
@brief Simple python wrapper for SSW align library
To use the dynamic library libssw.so you may need to modify the LD_LIBRARY_PATH environment
variable to include the library directory (export LD_LIBRARY_PATH=$PWD) or for definitive
inclusion of the lib edit /etc/ld.so.conf and add the path or the... |
67fa936aeea89e3d68dfda8e4acbefe5d6cfcfded5554cdeece37c899b46691d | Python | 14,984 | 370 | import json
import logging
from collections.abc import (
Callable,
Iterable,
)
from typing import (
Any,
TYPE_CHECKING,
)
from urllib.parse import (
urlsplit,
urlunsplit,
)
from sqlalchemy import (
Column,
create_engine,
delete,
insert,
Integer,
MetaData,
select,
... |
c9ad7c30ce4b95e98be7462f461ae631f13a4ae6f8912398725cc1adba4a3cb9 | Python | 14,990 | 263 | # adapted from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/datasets/builtin_meta.py
# All coco categories, together with their nice-looking visualization colors
# It's from https://github.com/cocodataset/panopticapi/blob/master/panoptic_coco_categories.json
COCO_CATEGORIES = [
{"color... |
ba421c261c90da95c6d2750ddc68cd99145b74d93751b63325192317ebf7aa4b | Python | 14,991 | 501 | import os
import glob
import numpy as np
import pandas as pd
import seaborn as sns
import scipy.stats as stats
import statsmodels.api as sm
from statsmodels.formula.api import ols
import matplotlib.pyplot as plt
def make_run_ids_dict(experiment_dir):
print('run_ids_dict was automatically constructed.')
run_i... |
8c36eff2b8b6032d9073662c243af034ce30f9e5c59c2a5fe414f8f28b4d1b0f | Python | 14,996 | 399 | import keras
from keras.src import backend
from keras.src import tree
from keras.src.api_export import keras_export
from keras.src.saving import serialization_lib
from keras.src.utils import tracking
def _convert_loss_to_function(loss_item):
"""Convert a loss string identifier to a loss function.
Arguments:
... |
313b5e4850fadc7f23dc22a3e0df02a7cc2317d7441c1ac7a73bc0a494b4f992 | Python | 14,997 | 431 | """Sprint A2 semantic output decode tests."""
from __future__ import annotations
import subprocess
import sys
import warnings
from pathlib import Path
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens import autoroute
from torchlens.autoroute._builtin_outpu... |
332720a9fafb97cce42b71f788f54315b5f66bdf6178a45b609744e4d387a312 | Python | 15,008 | 416 | import numpy as np
import pytest
from absl.testing import parameterized
from keras.src import layers
from keras.src import models
from keras.src import ops
from keras.src import testing
from keras.src.quantizers import strategy_registry
from keras.src.quantizers.calibration_run import _stack_calibration_batch
from ker... |
48d802a976d2846b5e20162f2d8a28a98f24eaceafad545a1b79105071bb93c0 | Python | 15,008 | 385 | """Pass-qualified replay re-keying on multi-pass (recurrent) models.
Pins the 2026-08-17 decision: the replay engine operates on pass-qualified
op labels internally (cone traversal, overlay, hook targets, pending
commits), a bare label naming a multi-pass layer refuses typed with a
teaching message, single-pass bare-l... |
dbdd0acee421064459ff3fcf338a26df258ff3807f3fd7b027d22e9e38e00a29 | Python | 15,008 | 403 | """Tigramite causal discovery for time series."""
# Author: Tom Hochsprung <tom.hochsprung@dlr.de>, Jakob Runge <jakob@jakob-runge.com>
#
# License: GNU General Public License v3.0
import numpy as np
import warnings
from scipy.stats import chi2, normaltest
from sklearn.linear_model import LinearRegression, LogisticR... |
e3a45ae9aeac916cfc1e240c1f39a15f88c2e992c1bcf459c77588e711ed9353 | Python | 15,011 | 419 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import logging
import numpy as np
import torch
from . import (
ava_helper as ava_helper,
cv2_transform as cv2_transform,
transform as transform,
utils as utils,
)
from .build import DATASET_REGISTRY
logger... |
d1acfeb8df62c51908ed76a382dbf60b684825c6f5d146cf71d7998cbfb2117a | Python | 15,018 | 374 | """
pup_analysis_plots.py
This script contains functions to plot results ofpupil analyses on
specific sessions (pup_analys.py) from dictionaries.
Authors: Colleen Gillon
Date: October, 2018
Note: this code uses python 3.7.
"""
import copy
import warnings
from pathlib import Path
import numpy as np
from util im... |
db41ef83f4c5525e3a56188d2d8f4910cb27e55e69afd350f6adcc1359dc087f | Python | 15,026 | 355 | # SOURCE: vendored from Ber666/ToolkenGPT @ main (commit 5a5d4121bad0fd198f43d76320ddead091edf350)
# https://raw.githubusercontent.com/Ber666/ToolkenGPT/main/llama/model.py
#
# Hao et al. 2023 (NeurIPS 2023 oral) "ToolkenGPT: Augmenting Frozen Language Models
# with Massive Tools via Tool Embeddings" -- a LLaMA-archite... |
8b931809ed546d25f4e27d3f7df8d4c1493b0ffa322d8789cb041471208b9646 | Python | 15,032 | 393 | """An untraced module output credits only the dispatch that built it.
When a module returns a tensor with no live label, module exit synthesizes a
functionless boundary Op and marks the module-forward token capture-accounted.
That credit covers the opaque construction of the exact boundary tensors, so the
dispatch cen... |
d6e19a17f4824be8192b5d1d3f8f8a0e83852b1c0a8e30d4e9c46377c5cd83b0 | Python | 15,039 | 391 | from typing import Dict, List, Literal, Optional, Tuple, Union
import anndata
import numpy as np
import pandas as pd
import scipy.sparse as sp
from anndata import AnnData
from pyvista import PolyData
from scipy.sparse import csr_matrix, diags, issparse, lil_matrix, spmatrix
from scipy.spatial import ConvexHull, Delaun... |
b55160aedd050b523d660b2cad42526649f50e13626def9c673b39e49ec6f0a5 | Python | 15,043 | 316 | from os.path import join
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import os
from library.comput_utils import circgaufunc, get_tspdiff
from library.script_wrappers import best_worst_analysis, find_nidx_along_traj
from library.shared_vars import sim_results_dir, plots_dir
from library.u... |
7c198db7add0e2281461cdfc9f00e91a93738abb848541b599774081a3b253de | Python | 15,044 | 374 | from __future__ import annotations
import copy
import logging
import os
import time
from typing import Optional
import numpy as np
import pandas as pd
from bream4.device_interfaces.devices.base_device import BaseDeviceInterface
from bream4.toolkit.procedure_components.metrics_watcher import CurrentMetricsWatcher
fro... |
abf8956bfcb0f1f92f5ec27fd72acc8abbb6b91980890e70284f95926052a1ed | Python | 15,044 | 415 | #!/usr/bin/env python
import datetime
from typing import Any
import requests
from .base import NotificationAnalyzer
class MattermostNotificationService(NotificationAnalyzer):
"""
Mattermost notification service for Ethoscope system alerts.
Handles sending Mattermost notifications for device events lik... |
f49908e05ca103ff3f30921e2f9f337f2a764cecf971ab02c4d1fdc4d91f5333 | Python | 15,046 | 320 | """A set of functions for passively checking environment implementations."""
import inspect
from functools import partial
from typing import Callable
import numpy as np
from gym import Space, error, logger, spaces
def _check_box_observation_space(observation_space: spaces.Box):
"""Checks that a :class:`Box` obs... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.