sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9fe11e1291c938e731e36e888005bb77d8072dc5b3cbc62996327e8e9d13036d | Python | 2,708 | 85 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
__all__ = [
"load_op",
"FlexAttention",
]
import textwrap
from typing import Any
from onnx.reference.op_run import OpFunction, OpRun
from onnx.reference.ops._helpers import build_registered_ope... |
0bbacfd904c93f24f3fc49d196074558f55a0dcc09b334e59b5ca51c1c9d24e1 | Python | 2,709 | 78 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
6f75a37ffc8e92088c188fd06fc27f703262b9ad3bfdf3bbbdcc5e0773cb7985 | Python | 2,710 | 71 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
6ea61937e2a39ab3a27405d550d62df30106b479724e0862b7f362d3b9798959 | Python | 2,712 | 91 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
ecbf7d404332ff943cc3b1c2c8c8e1d7dc04900b9d68e733a0c2b481da62f0f8 | Python | 2,712 | 76 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
c9635fe084227251a539c883c1fa675b05cf6df34d03ba3aca09c70ba53004e4 | Python | 2,713 | 119 | import numpy as np
from numba import jit, njit
"""
Some methods were adapted from https://github.com/FilippoBovo/robustats/blob/master/c/robustats.c
"""
@jit(nopython=True)
def swap_2d(x, n2, i, j):
for k in range(0, n2):
temp = x[i][k];
x[i][k] = x[j][k];
x[j][k] = temp;
return x
@jit(nopython=True)
def par... |
af38d504f9079c5401e989274686838614421b7a6730e26a58a19faeee8d2bc3 | Python | 2,715 | 66 | """
A dictionary of all datasets in Monash Forecasting Repository.
Dictionary keys are dataset names, values are dataset record number.
"""
tsf_all = {
"m1_yearly_dataset": 4656193,
"m1_quarterly_dataset": 4656154,
"m1_monthly_dataset": 4656159,
"m3_yearly_dataset": 4656222,
"m3_quarterly_dataset"... |
3b0928177d9194b0e0c50733edafe979bfa049999f98f3c702f3fbfa6c827d57 | Python | 2,716 | 53 | import os
import scipy.io
import sys
import time
sys.path.insert(1, "/Users/hyung/Research23_Network_Analysis/mBIN/Python/NewFTD/")
from LoadDataFTD import loaddataFTD
from PathCovFTD import pathCovFTD
from ThicknessCovFTD import thicknessCovFTD
from ThicknessAtPath import thicknessAtPath
# Change these directories t... |
30f724ac5d7de2ab0a57b922354a014f3325d1f3f1f815448848afb5a908b759 | Python | 2,718 | 78 | #!/usr/bin/env python3
import pandas as pd
import sys
init = "random_sim_init_plottable.txt"
data = "random_sim_final_plottable_COW.txt.head"
import matplotlib.cm as cm
from matplotlib import pyplot as plt
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
initdf = pd.r... |
7e582e114a8010565815b3210ae1775014ac85d9541af8ad3c6a2a590ead9522 | Python | 2,721 | 81 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
a24e13317f07e201e8b19d54c13ba6aec18771279701754ba451461bb73a8809 | Python | 2,723 | 80 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
b23105940e3c390577d742c5d08c37cb9f3441fa8acd5d29179a235de15a7acd | Python | 2,723 | 80 | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 15 16:44:04 2018
@author: zahramansoor
"""
import matplotlib.pyplot as plt, os
import h5py, numpy as np
from scipy.stats import linregress
def save_stats_h5(fname):
'''Function to extract test loss and training loss values from h5 files saved in training.
'''
... |
8febffc96500cf1c6046b0e3d20e8d677e86fd8333d9ace47d3294ffd1b072b7 | Python | 2,724 | 88 | '''
main.py
@author: Nicholas Browning
'''
import numpy as np
import argparse
import openbabel
import time
import json
from src.gaapi import generators
from src import JobConfig
import evaluators as evals
import printResidueInfo as pri
import evaluators as evals
from src.gaapi import Individual
def mainLoop(setti... |
8f680a2757b8b41c2c963d2c7917f9b33b55820e21f001ee2f7824f884f6ea39 | Python | 2,725 | 105 | """ update ontology definitions
Usage:
defs [options]
Options:
-u --update push updates to google sheet
-d --debug enable various debug options
"""
import rdflib
from ttlser import natsort
from pyontutils import clifun as clif
from pyontutils.core import OntGraph
from pyontutils.sheets import Shee... |
be552c5ebb277c0742f2b595b3c5f1b9e057fd6e17ad643526c61ecc6214d27b | Python | 2,725 | 69 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Tests for the backend-neutral DPA4 edge-cache acceleration seams."""
import numpy as np
from deepmd.dpmodel.descriptor.dpa4_nn.edge_cache import (
_edge_cache_from_arrays,
edge_cache_to_dtype,
)
def test_fused_builders_replace_reference_and_initialize_step_cac... |
c2cc89f6e98aee177fe8ddbade557bcacbc1de3aec4755c2cac0886369143e07 | Python | 2,725 | 74 | import sklearn.model_selection
import numpy as np
from sklearn.model_selection import ShuffleSplit, StratifiedShuffleSplit, cross_val_score, StratifiedKFold
def normal(X, labels, test_size):
"""Split a dataset into training and test parts.
Args:
X (numpy.ndarray): 2D features matrix
labels: ... |
7bcfefb55a1161c49dce52d81383e9ed8185355ea1453ad225737178ab41afe9 | Python | 2,726 | 109 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import sys
import warnings
import onnx
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
# -- Project information -----------------------------------------------------
author ... |
90595af0ec1129320f4225edd3101208a881103c2d5ebe1d20e51ea3ef7fb44f | Python | 2,726 | 63 | # Currently meant only for CellDensityTest
# Will be made generic soon
import numpy as np
from tabulate import tabulate
#==============================================================================
class mu_std_table:
"""
Displays data in table inside text file
Note: can be extended in future to provide... |
ff963df30159eca80d7ffd11c6f856a17b39cedcc5a9c214ccbde951fbc94f80 | Python | 2,726 | 86 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
b73210f433db0a8db2f7a4deefd823ef65e942730fef823b8942406cdad963a7 | Python | 2,727 | 61 | import logging
import time
from typing import List
import grpc
from minio import Minio
from mprl.utility_services.cloud_storage import DEFAULT_LOCAL_SAVE_PATH
from mprl.utility_services.protobuf.population_server_pb2 import Confirmation, PolicyInfo
from mprl.utility_services.worker.base_interface import BaseClientMan... |
dc519b04c2070b9dcbf7a645c84fe7e343912f2e309d5f846f64f8f120a680e8 | Python | 2,730 | 76 | """
@file: PGNRecordDataset.py
Created on 25.09.18
@project: crazy_ara_refactor
@author: queensgambit
Utility class to load the rec dataset in the training loop of the CNN
"""
import os
import zlib
from mxnet.gluon.data.dataset import recordio, Dataset
import numpy as np
from DeepCrazyhouse.configs.main_config import ... |
f72b168132af0c5db6d44adb7b5697c36d7720f9979969fddd47e4808f36f970 | Python | 2,730 | 81 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from ..builder import HEADS
from .cls_head import ClsHead
@HEADS.register_module()
class LinearClsHead(ClsHead):
"""Linear classifier head.
Args:
num_classes (int): Number of categories excluding th... |
99d189708655230a0999b8ffee63892e981d72f04f75bdb6bda5357acfd405cb | Python | 2,731 | 102 | import os
import sys
import numpy as np
from sklearn.cluster import KMeans
import numpy as np
from sklearn.cluster import KMeans
import glob
from torch_geometric.data import InMemoryDataset, DataLoader
from torch_geometric import data as DATA
import torch
from rdkit import Chem
from rdkit.Chem import MolFromSmiles
imp... |
6e3ce09c966b3e93e2e446dff2c1785e41ceefd2c0ddeafd32d45584cf0ad5bb | Python | 2,732 | 77 | import os
from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path
from typing import List
from setuptools import find_packages, setup
# paths and variables
here = Path(__file__).parent
docs = here / "docs"
long_description = (here / 'README.md').read_text()
def _load_py_module(f... |
9a329dfd804107ad5cd7fd6aecb4087213bcafed4a99c1fa182e13de25cdbe63 | Python | 2,733 | 92 | """
@file: input_representation.py
Created on 13.02.20
@project: CrazyAra
@author: queensgambit
Input representation for the chess board state which is passed to the neural network
(folder is name "classical_chess" to avoid name clash with python chess library)
"""
import DeepCrazyhouse.src.domain.variants.input_repr... |
b6abf3232d26b2f233ae3d121843cd79a119a11272c61d45d822d60f7b3cf101 | Python | 2,733 | 91 | # -*- coding: utf-8 -*-
#
# Copyright © 2013 Charles E. Vejnar
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://www.mozilla.org/MPL/2.0/.
#
"""Interface with the `Samtools <https://www.ht... |
e0e96387c0bdfcebacdf9ac353b4f5f834c5171c39c2766d0c15cb94d98ea5e5 | Python | 2,734 | 78 | """
Let's build an example spiking network which showcases connections with spiking transmission delay
William Nourse
December 10th 2021
"""
import numpy as np
import matplotlib.pyplot as plt
from sns_toolbox.networks import Network
from sns_toolbox.neurons import SpikingNeuron
from sns_toolbox.connections import Spi... |
a5da1062262cbc78665f93c3264a2cf62e846d166a188678325f6aea6e040ea2 | Python | 2,736 | 81 | # coding=utf-8
# Copyright (C) 2021. Huawei Technologies Co., Ltd. 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
#
# ... |
0c437b916b01748e3e43c56ffba078fe3048c3de67df1c5b3412ccdb7e99e8c1 | Python | 2,737 | 95 | import numpy as np
from brian2 import *
# import matplotlib.pyplot as plt
import time
import pickle
import brian2cuda
set_device("cuda_standalone", build_on_run=False)
# Personal stuff to send an email once data collection is finished
import sys
sys.path.extend(['/home/will'])
from email_utils import send_email
"""
%... |
53256dbb2025978713f81a89a9acc1e1d46d70c68a3919bd98ad656e06a01938 | Python | 2,737 | 57 | import sys
import matplotlib.pyplot as plt
import matplotlib
from functools import reduce
from os.path import splitext
import pickle
import numpy as np
from parameterSetup import ParameterSetup
from evaluationCriteria import labels2ID, getEpisodeLengths
from sequentialPrediction import classifySequentially
from writePr... |
66cf7b65950272f94187ecf2113f5af9251087af54c3b3a7509b63ddc1e97e81 | Python | 2,737 | 67 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
de0886fd701aa3205c2ff482c3c8c3effc597c3cddebb6420955680a0a12a394 | Python | 2,739 | 49 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 20 19:23:13 2018
@author: tpisano
"""
from tools.utils.io import makedir, chunkit, load_np, load_dictionary, listdirfull
import numpy as np, os
from tools.utils.io import make_memmap_from_tiff_list
from skimage.util import view_as_windows
from skim... |
b3b41234f4f0819844e90fae31a8e6aaa7061b9913bbeb4f244467c56a6efa12 | Python | 2,742 | 102 | from timeflux.helpers.port import match_events
def match_keys(port, key):
"""Find the given key in an event DataFrame
Args:
port (Port): The event port.
key (str): The key string to look for in the data column.
Returns:
DataFrame: The df of matched events, or `None` if there is no... |
6a7c4b2bbbf94c6d6b4005bfc7db35df645cc28e4fa489b57fe0f9e5b9062083 | Python | 2,743 | 80 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
59e7ab5b453cca4ed8faf99f8beb77380144ce9a460238005b6e92fd1e8cea5d | Python | 2,744 | 88 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
165f7825888e6d06264b426c53db534c655ae1ccb78b283bfd9b68a0cc768a6c | Python | 2,746 | 79 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
391b30024ac53ce3c1ce441a6fdbb3aaff0f86c2c1b36aa6ac7e53bfec4d6b99 | Python | 2,746 | 73 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 14 17:59:22 2017
@author: wanglab
"""
import tqdm
from concurrent.futures import ProcessPoolExecutor, as_completed
def parallel_process(array, function, n_jobs=16, use_kwargs=False, front_num=3):
"""
A parallel version of the map funct... |
94a17a2d3460335bc9f08d10f70f35ee1ae9551a102013fa3a8ea94d716ccef8 | Python | 2,746 | 83 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
b57b519a5e393d4a902705f7b78ee6e354624764ca03a21fd35c60e7b8e1596d | Python | 2,746 | 78 | # Copyright 2024 The TensorFlow 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 applica... |
396ec27419689504d719f240cb534b4283a36f570265a20a94ba9daad025751b | Python | 2,747 | 90 | from __future__ import print_function
import numpy as np
import time
from .augment import Augment
from .flip import FlipRotate
from .perturb import Blur3D
__all__ = ['Track']
class Track(Augment):
def __init__(self, width=120, margin=20, sigma=(15,10,3), thresh=0,
skip=0, **kwargs):
se... |
95c905dc9de97d740555790daae990b6873a931ed60f48feabf1ff4569b3b18f | Python | 2,747 | 116 | """
Parameter exploration using parallel simulations
OBSELETE 2019
"""
from __future__ import print_function
__author__ = 'pbmanis'
import multiprocessing
import time
import model_run
import itertools
import pickle
import numpy as np
celltype = 'Stellate'
model_type = 'XM13'
start_time = time.time()
def run_model... |
97f021420fd75f97af60812554589aa90accef4f85dff394608a8db663e6eafa | Python | 2,747 | 103 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class ConvInteger(Base):
@staticmethod
def export_without_padding() ... |
a9f061d763db71b05ec9475ba5955c73e48312021d2ea68da823b3cdff4d9b94 | Python | 2,747 | 90 | """
@file: _GameState.py
Created on 14.10.18
@project: crazy_ara_refactor
@author: queensgambit
Please describe what the content of this file is about
"""
from abc import ABC, abstractmethod
import chess.variant
class AbsGameState(ABC):
"""Abstract class for the GameState child class"""
def __init__(self, ... |
c882477646942fb2206c87304ee206a3717944fb96e19040ef51b2b182cdd3c5 | Python | 2,747 | 81 | import siibra
import pytest
from typing import List
from siibra.features.feature import CompoundFeature
from siibra.features.connectivity.regional_connectivity import RegionalConnectivity
from zipfile import ZipFile
import os
all_conn_instances = [
f
for Cls in siibra.features.feature.Feature._SUBCLASSES[Regio... |
d7c2d0a1a480cf7a2a72d11124f6bf91460114361e8bc54547548805d08dc84b | Python | 2,747 | 88 | import pickle
import numpy as np
def get_data(config, set, verbose=1):
if verbose > 0 :
print('Reading data')
dir_path = f'data/tl_train/{config.tl_data_category}/{config.tl_data}/set{set}/'
with open(dir_path + 'test_seq.pkl', "rb") as fp:
test_seq = pickle.load(fp)
... |
186b73231b5b5bcbccc8aa6f60d07fd94af7f3e79bdd3deedf17c9474e7a4cd9 | Python | 2,748 | 90 | """
@file: _GameState.py
Created on 14.10.18
@project: crazy_ara_refactor
@author: queensgambit
Please describe what the content of this file is about
"""
from abc import ABC, abstractmethod
import chess.variant
class AbsGameState(ABC):
"""Abstract class for the GameState child class"""
def __init__(self, ... |
76cff1004cd00ed692c325dab5850bdcba0bd24298c05d7e236ea53bb2ffbee7 | Python | 2,748 | 76 | import torch
import torch.nn as nn
class CharbonnierLoss(nn.Module):
"""Charbonnier Loss (L1)"""
def __init__(self, eps=1e-6):
super(CharbonnierLoss, self).__init__()
self.eps = eps
def forward(self, x, y):
diff = x - y
loss = torch.sum(torch.sqrt(diff * diff + self.eps))... |
bdd0c483af6c953c83f8e92ce758c8d41879aafc9b830147f7a73b744df04fe0 | Python | 2,748 | 74 | """M4 forecasting competition catalogues by period."""
from sktime.catalogues.base import BaseCatalogue
class _BaseM4CompetitionCatalogue(BaseCatalogue):
"""Base catalogue for M4 forecasting competition benchmarks.
This base class defines the common structure, forecasters, and evaluation
protocol used t... |
eaa7bc12409c1aa68febdd5c9a20620406ce20d80e99a798ab3d1f3661e6ed15 | Python | 2,748 | 87 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import tempfile
import pytest
import onnx
_TEST_MODEL = """\
<
ir_version: 8,
opset_import: ["" : 17, "local" : 1]
>
agraph (float[N] X) => (float[N] Y) {
Y = local.foo (X)
}
<o... |
04e4234562b38acd9c3954ab5a06bcc3430ebe945de499f547b7f8dbf96c22d6 | Python | 2,749 | 75 | #-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com), Milton Miller <miltonm@us.ibm.com>
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest
from ... |
1cd587b44a389634024f3e75ff15f61631994310b38c04318b8a29d92bb395f4 | Python | 2,751 | 60 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import pytest
import onnx.version_converter
from onnx import TensorProto, checker, helper
class TestVersionConverter:
@pytest.mark.parametrize("target_version", [13, 14, 15])
def test_preserv... |
84b2d6e33cdc92cddc9b1f001ca1b524f48496a874fd30c1051832fbbd2fc87c | Python | 2,751 | 92 | # Data Technqiues
str_default = "default"
str_atacseq = "atacseq"
str_dbitseq = "dbitseq"
str_dlpfc = "dlpfc"
str_patchseq = "patchseq"
# Model Configs
str_input = "input"
str_output = "output"
str_hiddens = "hiddens"
str_use_biases = "use_biases"
str_dropouts = "dropouts"
str_use_batch_norms = "use_batch... |
b2c0f2e0d07d2695e5b2740557c131d67052b4fff4e0c872b938e98bfa0f0f40 | Python | 2,751 | 71 | #-------------------------------------------------------------------------------
# Tests the functionality of get_symbol_by_name
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest
from elfto... |
0ccf81bef35dbd3f74368cbfd0c7c29c9a41001ed2925a1955b721e9ac755684 | Python | 2,753 | 65 | # Copyright 2019 The TensorFlow 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 applica... |
ecfc876eb829eafa00901d545a7c71298d24f5b39e97aa0017adb5a92a0d544f | Python | 2,753 | 92 | from datetime import timedelta
from timeit import time
import pyarrow as pa
import numpy as np
import numpy.ma as ma
from scipy import sparse
import mole
def stopwatch(method):
def timed(*args, **kw):
ts = time.perf_counter()
result = method(*args, **kw)
te = time.perf_counter()
... |
b0820e140cd3ed492e385002f358186a7df14de60cf55bcca8a7b8de47f784b3 | Python | 2,754 | 81 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 24 22:07:30 2016
@author: tpisano
Function to allow for different paths to the same server. For working on different servers/computers.
Alternative would be to softlink paths of different computers to have the same paths as cluster. I.e. /jukebox/ for both computer and... |
f3f6061d739859ec05ea0c9ef44b971bae20be8d346aa0916eda8fe0761ea7ba | Python | 2,754 | 71 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
31996dab167f774f3d8d4795dac30497f9c3a9f60699365b9e012df7bd3549ba | Python | 2,756 | 141 | """Tests for time series k-medoids."""
import numpy as np
import pytest
from sklearn import metrics
from sktime.clustering.k_medoids import TimeSeriesKMedoids
from sktime.datasets import load_basic_motions
from sktime.tests.test_switch import run_test_for_class
expected_results = {
"medoids": [
0,
... |
4d567f827b19a389a1173fb4910583467ebbcf081870b54dd97168610b46b974 | Python | 2,758 | 82 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Small, backend-independent checkpoints of the next training batches.
Data sources own their cursors and deterministic sampler state. This module
adds task names and the shared data-source RNG, not decoded data or permutations.
"""
from collections.abc import (
Itera... |
5820270b50a50108490ee76e6360952551423ae9578407110cddca4ea4d9447e | Python | 2,758 | 90 | """ Summary
Not all papers that have been selected by the 1_create_dataset.py script
have a meaningful content/reference section extracted by the second script.
In this third step, all such papers are removed from the datset. Note that
this also means that even if an author originally had >=N papers in the
dataset, thi... |
a8b39cc731c3b11c23ec3f2507bcde843dad4669793d39ff31cc823d9ff98b70 | Python | 2,759 | 99 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
e1fe0e3858d4d1bfe58da3394c1c1457157ec90ddc6fa865ed8fcc0dca88ca87 | Python | 2,760 | 64 | import logging
# PyTorch modules
import torch
from torch.utils.data import DataLoader
# Cormorant modules and functions
from cormorant.engine import Engine
from cormorant.engine import init_logger, init_cuda
from cormorant.engine import init_optimizer, init_scheduler
from cormorant.models.autotest import cormorant_test... |
310e0b71b0d143e2c2351adb48c6606080427ca4a36273d31f561c64bfa3d325 | Python | 2,761 | 93 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
e3649fc888093aad231faf854c3840acdc87636a0ce2cece918079088e11372c | Python | 2,761 | 81 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
9ee57e6c97c53ce46ff285336421cdb0d60309c078674120b71239c7eed42fee | Python | 2,763 | 71 | from __future__ import division
import os
import sys
import pandas as pd
#################################
args = sys.argv[1:]
if len(args) > 0:
path = args[0]
if path != 'test':
if not path.endswith('/'):
path += '/'
path += 'output/'
track_stat = pd.DataFrame()
... |
c11d0b5fef196e774b1d895fa2b4f7c2f49e1b6707c73b3f85fb17e5ebab984b | Python | 2,764 | 77 | import numpy as np
import matplotlib as mpl
from matplotlib import pyplot as plt
import pandas as pd
mpl.rcParams.update({
'pdf.fonttype': 42,
'ps.fonttype': 42})
def shank_plot(data, sample, columns, vranges=None, show_region=True, show_title=False, savename=None, margin=8, arrow_size=15, figsize="auto"):
... |
a2fcf1ee00efce011d9d7e4a317e23add55c1895c19fa3cf3815fba03069e3a2 | Python | 2,765 | 74 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
67446c32b03a0b8a698103ed9d678a07f57a9f0aae1836b0df45e48fd199cce6 | Python | 2,766 | 100 | import random
import torch
from spikingjelly.clock_driven import functional
from network_3d.poolingNet_cat_1res import NeuronPool_Separable_Pool3d
from tqdm import tqdm
from data.dsec_dataset_lite_stereo_21x9 import DSECDatasetLite
from eval.vector_loss_functions import *
import math
# Enable ... |
a7b68d597dd73db6c43a515dec1f8802567a5cbb64901c09b1522a8734bff363 | Python | 2,766 | 86 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
2627900a86b941e5ea3d829fd5df392350ed632f5740e44cc61aa6b155910dae | Python | 2,767 | 85 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from molucn.utils.utils import (
get_common_nodes,
get_positions,
get_substituent_info,
get_substituents,
)
def loss_uncommon_node(
data_i: Tensor, data_j: Tensor, model: nn.Module, reduc... |
ed99b5b677bcbfb27806e035d5d73fb7b3bd573c72399581476a1ad7dd1a21c2 | Python | 2,767 | 91 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Unsqueeze(Base):
@staticmethod
def export_unsqueeze_one_axis()... |
67890304d19950361b621f35f180ba3286483ff0f66ebf66f245b24e7cd1bd74 | Python | 2,768 | 80 | import sys
import socket
import struct
import numpy as np
from datetime import datetime, timedelta
from functools import reduce
import random
# sends mock signal to online.py by connectin to networkServer
args = sys.argv
if len(args) > 1:
HOST = args[1]
else:
HOST = '192.168.0.3' # The server's... |
ffbc49748294810a235e826a4383e0e25f92f7c74787e83d5f56888e9dcb7f27 | Python | 2,769 | 76 | import os
import pickle
from torchvision import datasets
from .loader import pil_loader
from .transforms import data_transforms, simple_transform
from .dataset import DatasetFromDict, CustomizedImageFolder
from utils.func import mean_and_std, print_dataset_info, is_main
def generate_dataset(cfg):
if... |
e21b7b56467e3b3c8238681e8ca36ffbe3333f913ae80f0c691e10b3aec8887a | Python | 2,772 | 113 | """bcblib.imaging -- NIfTI image utilities organised by domain.
This subpackage provides FSL-equivalent NIfTI utilities for header
inspection, orientation, statistics, manipulation, format conversion,
and voxel-wise maths.
Public API is re-exported here so that ``from bcblib.imaging import load_nifti``
works. The ca... |
3fce0b9ab9b5a7f6c4899631f2657fd5658584390cfcee8e841ff334fe44c21c | Python | 2,773 | 66 | """Functions related to SCOP classes of structures."""
import os
import pandas as pd
SCOP_CLA_LATEST_FILE = 'atom3d/data/metadata/scop-cla-latest.txt'
PDB_CHAIN_SCOP2_UNIPROT_FILE = 'atom3d/data/metadata/pdb_chain_scop2_uniprot.csv'
PDB_CHAIN_SCOP2B_SF_UNIPROT_FILE = 'atom3d/data/metadata/pdb_chain_scop2b_sf_uniprot... |
f0c8a543411befc9d5a1965d9a321a6d80e69b0bb254c57945c9ddbb0ca87d73 | Python | 2,773 | 92 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
def logsoftmax(x: np.ndarray, axis: int = -1) -> np.ndarray:
x_max = np.... |
73412a66b99a42c2a42a067bdf5c0573de755ace32e242892e1ad91a7f360b62 | Python | 2,778 | 95 | #!/usr/bin/env python
import click
from functools import partial
from multiprocessing import Pool
import os
import pandas as pd
import subprocess as sp
from tqdm import tqdm
bar_format = "{percentage:3.0f}%|{bar:20}{r_bar}"
# Globals
scripts_dir = os.path.dirname(os.path.realpath(__file__))
CONTEXT_SETTINGS = {
... |
af7fee2a30f8b349cf8585356472d706e7fb901440d377ced6c8641d0f72f44d | Python | 2,779 | 71 | """Compute cyclepoint features for individual cycles."""
import pandas as pd
import numpy as np
from bycycle.utils.checks import check_param_range
from bycycle.cyclepoints import find_extrema, find_zerox
###################################################################################################
#############... |
464234ed72233207c7217b5310a5fca7a209d15ec765a144fa5b8aef0f0a91c5 | Python | 2,780 | 76 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
f18e4161a11bc95732bd01c577cbe98373081afd5b4112b02fec51a0e1df2e11 | Python | 2,780 | 107 | from __future__ import annotations
def int_to_bin(number: int, width: int = 32) -> bytes:
r"""
Convert an integer into its binary representation in a bytes object.
Width is the amount of bits to generate. If width is larger than the actual
amount of bits required to represent number in binary, sign-ex... |
fcbbd9dc06d28cd1f39c2884c4072b1a1791ee480aa6860c74b2cbf0064fabcc | Python | 2,780 | 101 | """Conversion utilities for ParaDime.
The :mod:`paradime.utils.convert` module implements various conversion
functions for tensors-like objects and index lists.
"""
import functools
from typing import Union
import numpy as np
import torch
from paradime.types import TensorLike
def to_numpy(X: Union[TensorLike, lis... |
2bfa0dd2bb14ff8ee41b8a1c6a1aaf54880cc471df1fa95996dc4f25fd72f8d1 | Python | 2,781 | 84 | from operator import attrgetter
import inspect
import subprocess
import os
import sys
from functools import partial
REVISION_CMD = 'git rev-parse --short HEAD'
def _get_git_revision():
try:
revision = subprocess.check_output(REVISION_CMD.split()).strip()
except (subprocess.CalledProcessError, OSError... |
9760853c8bf20f026649044aac53415688196697c44bc4f8f4462695365d1cf4 | Python | 2,783 | 76 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
b3a9160ebedcd7bb0d2bb45fa6ff1de13c71c03dbb7c50cefc330befc008c720 | Python | 2,783 | 100 | #!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Generate a minimal native-spin DPA4C graph ``.pt2`` for LAMMPS ``dpa4spin``.
Unlike ``gen_dpa4c_spin.py``, this archive carries no fparam, aparam, or
charge/spin condition so ``pair_style dpa4spin`` can load it without extra
keywords. Used by ``sou... |
f1a791e96fbc250e0d08f49fb09a9151047b31e06d26a01fc00e00dc16230b5d | Python | 2,783 | 73 | # Copyright (c) OpenMMLab. All rights reserved
from mmcv.runner import IterBasedRunner
from mmcv.runner.hooks import HOOKS, Hook
from mmcv.utils import is_seq_of
@HOOKS.register_module()
class ClassNumCheckHook(Hook):
def _check_head(self, runner, dataset):
"""Check whether the `num_classes` in head matc... |
c2dc5456b7d8fe67a81a467d345a492dfb073e2a0fa39a81926b7aee1700e228 | Python | 2,784 | 89 | # Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved.
#
# This file is Licensed under the Apache License, Version 2.0.
# A copy of the Licence is available in LICENCE, or at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
from .AbstractScoringLayer import register_layer
from .ComplEx import ComplEx
... |
88af3267fef14c355432b3e3a66b9fb2e9b8fdb7a1bb920ad2eeab0261c08ad7 | Python | 2,787 | 82 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from torch.nn.modules import GroupNorm
from torch.nn.modules.batchnorm import _BatchNorm
from mmcls.models.utils import InvertedResidual, SELayer
def is_norm(modules):
"""Check if is one of the norms."""
if isinstance(modules, (GroupN... |
ea1a97b57b137eb1a07cf5d5251c95a5adde10de5f06cdc89dce63654621e4da | Python | 2,787 | 75 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import CNN
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
output_dir = '../results/chips... |
1f0c5147dce2a7a247863a5ae8b0e62809db4922e885ebea8ed51468b7262529 | Python | 2,788 | 43 | import unittest
import numpy as np
import pycocotools.mask as mask_util
def _encode(x):
return mask_util.encode(np.asfortranarray(x, np.uint8))
class TestToBBox(unittest.TestCase):
def testToBboxFullImage(self):
mask = np.array([[0, 1], [1, 1]])
bbox = mask_util.toBbox(_encode(mask))
s... |
c14e1be748b502402603e85b423f7c54925a89d61d5c584e993541a9c5f78491 | Python | 2,789 | 97 | """Utilities for detection tasks."""
import numpy as np
import pandas as pd
def arr_to_seg(arr):
"""Convert 1D array-like of integers to segmentation data frame.
Returns a DataFrame with two columns:
- ilocs: IntervalIndex with start and end of constant blocks of integers.
- labels: The value in th... |
061f936f078b20596b0c80b6b7245f56f56a0db247405915ae91c350ad41a33f | Python | 2,790 | 55 | # %%
# (launch a manager with a fresh payoff table and then run this)
from mprl.utility_services.worker.learner import LearnerManagerInterface
from mprl.utility_services.cloud_storage import connect_storage_client, maybe_download_object
from mprl.utility_services.payoff_table import PayoffTable, PolicySpec
import ti... |
1d8e71ddf447e1e5a5af4b2030884e62b44673fac54e5c38acd04a564f3e09ab | Python | 2,790 | 88 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 25 17:36:06 2021
@author: sam
"""
import os
import cv2
import numpy as np
import h5py
import argparse
# import glob
# from tqdm import tqdm
# from natsort import natsorted
# put all the avi videos you want in a folder, that is video path.
#You c... |
0c68beabe64ae1bbc55bc4e48995c76d106a41ec5ae1a0c313f0b1f8ec75ece3 | Python | 2,791 | 66 | # Copyright 2023 The TensorFlow 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 applica... |
a6511f35e1e8453815e8f935cbf8d09aea180cda9a28afcbecdc91ab2d06115f | Python | 2,792 | 73 | # Copyright 2022 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
9abfb33132285e1853879658e993c63e292c2f34cdfb5277eb0f42d8f70eb4d8 | Python | 2,793 | 99 | """Cluster plotting tools."""
__author__ = ["chrisholder", "TonyBagnall"]
__all__ = ["plot_cluster_algorithm"]
import numpy as np
import pandas as pd
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.datatypes import convert_to
def _plot(cluster_values, center, axes):
for cluster_serie... |
c1da8997038bafb9e769817843291d8469703864f4ee7683f0a60ed2980eb023 | Python | 2,793 | 79 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
04ff41c2b476bc3f196e6fd9bd3cff594716ed116bc36111e297f424163180fd | Python | 2,794 | 74 | from elephant.spike_train_correlation import correlation_coefficient
from elephant.conversion import BinnedSpikeTrain
import neo
import numpy as np
from quantities import ms
from networkunit.tests.two_sample_test import two_sample_test
from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains
from ne... |
61a7d12f188019516e4c7e6c7a117dd749fbcaf197e0c2e1483c4d75c06c4fd4 | Python | 2,796 | 71 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
f9a6714000ee334d6b8e75844037bc76c6491f2b81dd72dd09ae8f473db8467a | Python | 2,796 | 83 | # Copyright 2022 Diagnostic Image Analysis Group, Radboudumc, Nijmegen, 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... |
e4a9c2dd97505011f9852cecc611f1b65860b9813589fa3def46fb4484767452 | Python | 2,797 | 90 | #Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#This program is free software;
#you can redistribute it and/or modify
#it under the terms of the MIT License.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.