sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ee2a3cbc8ff9c9423b49e3e7f352a5df54453835eb6a7cbbbc8e90d511ae5cf2 | Python | 5,152 | 122 | # 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... |
1742385df12889e2e0987ede92c3ebb903076b5cea468cab81a8a6d3b8fd14a1 | Python | 5,158 | 147 | # 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 BitCast(Base):
@staticmethod
def export_bitcast_float32_to_int... |
279066cd30af13059991edfe4d7abeda26bd042cb5037c3a10977657e981cff3 | Python | 5,166 | 119 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import Basset
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt_na... |
9c9397a81a13d90ff77588df98c22bd2a5b9ea430dd5ca890aa61a28a12e4db9 | Python | 5,166 | 134 | # 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... |
da157d956920d5922befd5a46d67395a81be762574c8c98fc3a7d82571eda9ea | Python | 5,166 | 124 | # 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... |
77f9ec7e9594f62384ce588e2b9f5643c9e6b608197b18a317c0899a5adab90c | Python | 5,168 | 144 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Test the Kokkos pair style with compressed DPA4C models that carry a long-range module.
``pair_style deepmd/kk`` evaluates a compressed long-range model through the
device-resident compact canonical lower: it gathers the positions of the
model nodes relative to the origi... |
b918ddd1bcf6c9fcf1c818d7c1d576f0da1ff7b488428f4c4d18c626fb811e7f | Python | 5,168 | 110 | """
@file: net_pred_service.py
Created on 13.10.18
@project: crazy_ara_refactor
@author: queensgambit
# TODO: description for the file
"""
from multiprocessing import connection
from threading import Thread
from time import time
import mxnet as mx
import numpy as np
from DeepCrazyhouse.src.domain.agent.neural_net_api ... |
e8052e77c9fb38f294cbee377c0ad7568af46e432d863b111498e46579c05074 | Python | 5,168 | 160 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 01 11:56:08 2013
@author: chrism
"""
import psychopy.monitors
import psychopy.visual
import numpy as np
from scipy.optimize import curve_fit
import time
from util import make_graphs, gamma_test
# Units in CM, taken from 'old' code
MONITOR_WIDTH = 52
MONITOR_DISTANCE = 1... |
7c781e04b2492fb1a1282a0b5a6f9056a7198c1ea38fc6488a9f0ed69dbde64a | Python | 5,169 | 127 | # 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... |
3bced9c187d79e90563187e7949df6d85b284d8e8421bbc10188e931d3ff8520 | Python | 5,171 | 110 | """
@file: net_pred_service.py
Created on 13.10.18
@project: crazy_ara_refactor
@author: queensgambit
# TODO: description for the file
"""
from multiprocessing import connection
from threading import Thread
from time import time
import mxnet as mx
import numpy as np
from DeepCrazyhouse.src.domain.agent.neural_net_api ... |
10ecc7066073988f9404d07f4e490a011566520ef27e6713be13a56474177d09 | Python | 5,173 | 119 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import Basset
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt_na... |
3a48ca133d7f7e7a86bc6747320a975dc7a39bc4fbebdd3edb4ca5cc7a830984 | Python | 5,177 | 157 | #!/usr/bin/env python
import os,sys
import collections
sys.path.append("/tigress/ejdennis/BrainPipe")
from torch import sigmoid
import tools.conv_net.dataprovider3.dataprovider3 as dp
import forward
import utils
def main(noeval, **args):
#args should be the info you need to specify the params
# for a given... |
7b7b5b3f0edc333cd339a7f679897524fa478346af14478eee934f8662b0641d | Python | 5,177 | 120 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import Basset
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt_na... |
4d0de7cdcdcb4b6d3a7500d05a2ade209f469b4cd8e33ec27cf481d12fcafbb4 | Python | 5,178 | 152 | # 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... |
513eff0ab5ec4b0abcf0b60cbd5c4e3b9bb708755b496089eb6ff1d6b1de41cc | Python | 5,178 | 140 | """
modality_transfer.py
Mimic the modality transfer experiment from Dacke et al. (2019).
References:
Dacke et al. (2019) - Multimodal cue integration in the dung beetle compass
- Transfer of information between different compasses
"""
import json
import numpy as np
import dict_key_definitions as keydefs
from extend... |
3ee992a4e04d28b2f3a6bba3fe11fe25a557f602ece53f7b5df809720a86ff6c | Python | 5,179 | 156 | __all__ = ['draw3Dnx']
import traceback
import networkx as nx
import numpy as np
from plotly.graph_objs import ( Line, Scatter3d, XAxis, YAxis, ZAxis,
Scene, Annotation, Annotations, Marker, Font, Margin, Layout, Figure, Data )
from plotly.offline import init_notebook_mode, iplot, plot
def draw3Dnx(graph=None,
... |
59244b0bfc53dc35f13104a1b2d7de35eee7c09457ec1389ac0bad3be4b5ac0c | Python | 5,182 | 172 | # 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... |
e94b83bdbfd56168a3aa1ee4d404b57c8ea9e782738b91dcd3f8472c32f7f721 | Python | 5,182 | 151 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 29 15:54:37 2022
Last update: 3/4/2023
@author: sudhanshu
Usage: python train.py
Returns: trained model "./xxmy_checkpoint2A_36_CB_coord.pth.tar" alongside Reports of epochs in Reports/
"""
import torch
import torch.optim as optim
from models im... |
da54463f89b9709399e97c6fda585003657f654b43f601d235b2ebb37236af31 | Python | 5,185 | 149 | from functools import wraps
import numpy as np
import torch
from torch import nn
from torch_geometric.data import Batch, DataLoader
from tqdm import tqdm
from molucn.gnn.loss import loss_uncommon_node, loss_uncommon_node_local
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
MSE_LOSS_FN = nn.MSE... |
f5c0ee0f3a31577bc2f4a4be7b19a2840c065b58896bf3ecebb050ef50064a5e | Python | 5,185 | 118 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import DeepSTARR
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt... |
3f5e88c2c00edd2dcb66ba8a01bc91e55507a9f798c57a4763b53a4fd39d1a18 | Python | 5,187 | 126 | import torch
import torch.nn as nn
import torch.nn.functional as F
class EncoderDecoder(nn.Module):
def __init__(self, in_seq_len, out_seq_len, in_feat_len, out_feat_len,static_feat_len,
hidden_size, num_layers, enc_dropout, dec_dropout, arch, device):
super().__init__()
self.enco... |
0dec58cc376b2c1ea7abb4d63f5579dbfdcbaca3e3dc587cfa5b3df2ad92212e | Python | 5,188 | 162 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import os
import tempfile
from copy import deepcopy
import pytest
import torch
import torch.nn.functional as F
from torch.nn.modules import GroupNorm
from torch.nn.modules.batchnorm import _BatchNorm
from mmcls.models.backbones import VisionTransformer
def... |
b4c8458a3bde49dad2bb54d0226dd0dc5e6e2dba74473da6c4a6bb36a36b7573 | Python | 5,188 | 171 | # 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... |
fc9ce6fdf2152e819640ebdf8f40b88b8572b4156ddd3ada167d87042d1f692d | Python | 5,190 | 100 | # Copyright 2007 Zachary Pincus
# This file is part of CellTool.
#
# CellTool is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
"""Align a set of contours to one another or to a specific reference.... |
64cf85e9a4a6807743c2c66de285fe3607ca459af6612e968df89f14dd637236 | Python | 5,191 | 148 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
import re
import sys
from decimal import Decimal
from fractions import Fraction
from typing import TYPE_CHECKING
import atheris
with atheris.instrument_imports():
from onnx import parser... |
a3f2632b82761280bd733686eb990729d9b16c5c382db9a7ab137e49fc366e6f | Python | 5,191 | 119 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import DeepSTARR
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt... |
e111f3b45c8af6d13c1d19ffbe983a6a28554b2f048d8b1c994788d6c694bfc0 | Python | 5,192 | 118 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import DeepSTARR
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt... |
514146506d1b7def13591270511542fb778889b8070499d74cbe39c2b076a265 | Python | 5,195 | 151 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
def _make_ind(dim, shape):
m = np.empty(shape, dtype=np.int64)
ind = [slice(0, shape[i]) for i in range(len(shape))]
new_shape = ... |
545cd2442e39b43f990514e67ed36f0f20f94e5c9dee78c1e0b1650fa9a81a58 | Python | 5,198 | 188 | import os
import multiprocessing as mp
import numpy as np
import copy
from datetime import datetime
import json
import yaml
import numbers
class DotDict(dict):
def __getattr__(self, name):
return self[name]
def load_training_data_from_file(name):
return np.load('{}.npy'.format(name))
def ensure_di... |
5dfb9431cf59f1ac6faab8f16ab4a504d663c73875d4a79a3e811a72b8c92431 | Python | 5,199 | 160 | """Naive thresholding detector."""
import pandas as pd
from sktime.detection.base import BaseDetector
from sktime.detection.utils._arr_to_seg import sparse_pts_to_seg
from sktime.detection.utils._seg_middle import seg_middlepoint
class ThresholdDetector(BaseDetector):
"""Naive detector which detects all points ... |
27d73b7ecee493b44fef136cf759000f25c2c625ceed03593b792c5623c57e86 | Python | 5,200 | 138 | from copy import deepcopy
import sys, os
import torch
import numpy as np
from vp_suite.model_blocks.traj_gru import Activation
from vp_suite.models import EF_TrajGRU as OurEF_TrajGRU
from vp_suite.utils.models import state_dicts_equal
REFERENCE_GIT_URL = "https://github.com/Hzzone/Precipitation-Nowcasting.git"
REPO_... |
771f16521567eaa4d5e6efcdf279b16d752c0df3d4e73cdddaf5b11e83aaee2a | Python | 5,200 | 158 | # 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... |
571fd0c7e05174a62c9087b61f834c3256cce566d1b7bb92ac061a8ca7ef3e89 | Python | 5,202 | 121 | """
This scripts generate figure S7b of the paper.
"""
import pandas as pd
import pickle as pkl
import numpy as np
import os
import glob
import matplotlib.pyplot as plt
import matplotlib as mpl
from tqdm import tqdm
# Plotting
import sciplotlib.polish as splpolish
import sciplotlib.style as splstyle
import src.model... |
01b05947dd3639e2a9ef4d63ec457054dbf6752690f68e15747c874a8c2c5cfe | Python | 5,207 | 163 | import numpy as np
from scipy import linalg
import warnings
def lag_builder(time_min, time_max):
"""Build the lags for the lag_generator function. Basically the indices of
the time lags (including the starting and stopping points) of the data
matrix.
Parameters
----------
time_min : np.int
... |
0aa2106673e393ee6178abc6ed3f0276acb847f17a30fbcfec7906da54c5e17c | Python | 5,207 | 174 | # 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 TensorScatter(Base):
@staticmethod
def export_tensorscatter() ... |
548e5aa476e8ac49ae82e86db7c20c1cd07ce97e09243ee60c7d1556fdfa9e94 | Python | 5,208 | 131 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import shutil
import subprocess
import sys
from pathlib import Path
import pytest
@pytest.mark.skipif(sys.platform == "win32", reason="POSIX cross-sysroot fixture")
@pytest.mark.parametrize... |
d2ba957038432627bb4f3b1e2f668a93beafa23f9851b089e324608fc1debd5c | Python | 5,211 | 119 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import DeepSTARR
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt... |
98af3f2e8613971260b4c0a58a75f8697f3c33aabacf3e07eb54f7590e1f62e9 | Python | 5,213 | 140 | from IPython.core.debugger import set_trace
import numpy as np
import tensorflow as tf
########################################################
"""
Generic class to compute the RHS
"""
class fd_solve():
def __init__(self, args, deriv_obj, grid_obj):
self.args = args
self.deriv_obj = d... |
dc193bde95880b277f7a5755d18a919b90affe20028b0b4e58486b560f99355f | Python | 5,213 | 146 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""
Attention utilities for DPA4/SeZM message passing.
This module implements the destination-wise envelope-gated softmax used by the
SO(2) attention path in the SeZM descriptor.
This module is the dpmodel (array-API) port of
``deepmd.pt.model.descriptor.sezm_nn.attention`... |
d861513fb8a67b8f404a87917ac1f5ce1df0745285d8919fdaf260ba9a017ae1 | Python | 5,214 | 120 | #!/usr/bin/env python
import sys
import os
import math
import subprocess
#import pandas as pd
from os.path import isfile, join, isdir
from kn_common import pipetools,pipedef
from kn_pipeline_class import CPipeError,CPipeStep
import torch
import torch.nn as nn
import torch.nn.functional as F
import hashlib
import niba... |
aa5503a22a8e439f4330460272eacf4ed15901f964fa3eb47984fd65d765fa51 | Python | 5,217 | 164 | import pandas as pd
import pytest
from sktime.benchmarking._benchmarking_dataclasses import FoldResults, ResultObject
from sktime.benchmarking._storage_handlers import (
CSVStorageHandler,
JSONStorageHandler,
# ParquetStorageHandler,
)
from sktime.benchmarking.benchmarks import BenchmarkingResults
RESULT_... |
c45d72aec523ab6411e723bd49e3fb4ea290b2949759e8076b5d30df019c2b63 | Python | 5,218 | 139 | import re
from dataclasses import dataclass, field
from typing import Union
from flair.data import Sentence, Span, Token
@dataclass
class TokenCollection:
"""A utility class for RegexpTagger to hold all tokens for a given Sentence and define some functionality.
Args:
sentence: A Sentence object
... |
7467cb8d974150fa62def55e6361dc22096d815040cb70dd6e5935ca1ff4c2da | Python | 5,220 | 138 | import logging
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Dense, LeakyReLU
from helpers.dir_utils import create_dir
from helpers.tf_utils import is_cuda_available, print_summary
class GAE(object):
_logger = logging.getLogger(__name__)
def __init__(self, n, d, x_dim, seed=... |
a8ad7a7de15ed3d48043a1eeba83afa0119342c9d46e0a1e89f0196ee3bcb8b8 | Python | 5,220 | 40 | from dataset import Dataset
data = Dataset()
# identify diagnoses
data.create_binary_variables("diagnoses", {"dx_Dementia": r"F01|F010|F011|F012|F013|F018|F019|F02|F020|F021|F022|F023|F024|F028|F03|G20|G21|G210|G211|G212|G213|G214|G218|G219|G22|G23|G32|G230|G231|G232|G233|G238|G239"})
data.create_binary_variables("di... |
2837e4e8055c64a8fbe6f414f2379ac5b8e6f4a6428087e32ad3b39ef3f974a1 | Python | 5,222 | 170 | from __future__ import annotations
from collections import defaultdict
from dataclasses import dataclass
import numpy as np
import matplotlib as mpl
from seaborn._marks.base import (
Mark,
Mappable,
MappableBool,
MappableFloat,
MappableColor,
MappableStyle,
resolve_properties,
resolve_... |
b618f8dac7f9a42a30f4b7ef8541e65934abf2729a92bbb07950832aa0175247 | Python | 5,222 | 151 | import numpy as np
import os
from functools import partial
try:
import nibabel as nib
import cifti
except ModuleNotFoundError:
raise Exception('Please install nibabel and cifti in your work station')
def load_brainimg(imgpath, ismask=False):
"""
Load brain image identified by its suffix.
The su... |
432b2fe15809f82a23777f254e58792547d8e88570b6e27f864c1c13a4b2e433 | Python | 5,224 | 139 | """
simple_conflict.py
[Legacy] - This was the precursor to conflict_weight.py.
"""
import json
import numpy as np
import dict_key_definitions as keydefs
from extended_ring_model import *
from dict_key_definitions import rmkeys, decodekeys, simkeys, statskeys, simdatakeys, cwparamkeys
from dict_key_definitions import... |
98b469350988e2d67d29165c0569e3873d47f98fe755f1c2f195eb237785bae2 | Python | 5,228 | 119 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import DeepSTARR
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt... |
89c4292ee7b9babb296314c74fd3f80856f080b187d653248642dc58bf0f6ab3 | Python | 5,232 | 176 | # 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... |
f40aef57f01b9313e189f653c3c0e04cba973eff4d2e7fecaf64d954a7b50b48 | Python | 5,232 | 152 | from os import path
from yacs.config import CfgNode as CN
repo_path = path.dirname(path.dirname(path.dirname(path.realpath(__file__))))
DEFAULT_CONFIG_DIR = path.join(repo_path, "configs")
# -----------------------------------------------------------------------------
# Config definition
# -------------------------... |
cffaf50dc983328c5287e9459546833aa6e8046914337e665a669259b8d2920c | Python | 5,234 | 105 | import numpy as np
from skimage.transform import resize
from scipy.interpolate import interpn
from ..lddmm._lddmm_utilities import _validate_scalar_to_multi
from ..lddmm._lddmm_utilities import _validate_ndarray
from ..lddmm._lddmm_utilities import _validate_resolution
from ..lddmm._lddmm_utilities import _compute_axe... |
03a4833700adbe907195b433d2f47bb3e603c0f62372663ae5c279a73a7dbf82 | Python | 5,235 | 163 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 31 12:14:14 2021
@author: sam
"""
import cv2
import numpy as np
import h5py
import argparse
import glob
from tqdm import tqdm
from scipy import signal, stats, spatial
# put all the avi videos you want in a folder, that is video path.
#You can mak... |
1d8835644dac7c3582fadf5e1119ba5911fe9b8be08d55db60ae0f9ae5a68381 | Python | 5,235 | 147 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Naive aligners, aligning starts/ends."""
import numpy as np
import pandas as pd
from sktime.alignment.base import BaseAligner
class AlignerNaive(BaseAligner):
"""Naive strategies for multiple alignment.
Naive strategies supported by... |
52310f038d6cb54246ecdbc9e9386f15f370a031e81f50d35cd7c47512af176c | Python | 5,235 | 119 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import DeepSTARR
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt... |
a5b9ffe1f1228ecc5163c6305e4d4d0fee835a5954a1b23011da51f73eabdfd8 | Python | 5,241 | 156 | import rdflib
from pyontutils.core import OntGraph
from pyontutils.config import auth
from pyontutils.namespaces import ilxtr, UBERON, CL, NCBITaxon, skos, rdf
from neurondm.core import OntId, log, uPREFIXES
pCL = rdflib.Namespace('http://uri.interlex.org/fakeobo/uris/obo/pCL_')
HGNC = rdflib.Namespace('https://www.ge... |
a558916eec4693e79440c267e58f92b0f3438a654bca180d819c28e36b90e62a | Python | 5,242 | 125 | import random
import numpy as np
import cv2
import lmdb
import torch
import torch.utils.data as data
import data.util as util
class LWGTDataset(data.Dataset):
'''
Read LQ (Low Quality, here is LR) and GT image pairs.
If only GT image is provided, generate LQ image on-the-fly.
The pair is ensured by 's... |
25b6619244605144987a1dfe1be1bf084d011daad47e9bc6a200b0ca5f4b2e7f | Python | 5,246 | 119 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import DeepSTARR
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt... |
8a441bf6e47f6cf4b1080e716acb4d911ffff55fc1ca71d18246724aaa7dd7ab | Python | 5,247 | 142 | #=======================================================================================================================
#Copyright
#=======================================================================================================================
# Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick ... |
48a246f4fb31c7008b850f196bb91773129ff94626907d95d158cd55eac0e4ce | Python | 5,248 | 126 | import pandas as pd
import numpy as np
from bids import BIDSLayout
def array2df(array):
i, j = np.triu_indices(array.shape[0], k=1)
if not (array == array.transpose()).all():
ii = i.copy()
jj = j.copy()
i = np.hstack([ii, jj])
j = np.hstack([jj, ii])
df = pd.DataFrame(data={... |
adfa8591038d2f28963d5605344831987f26eb5ec0d5826f0c797cd68815dea5 | Python | 5,248 | 107 | import atom3d.util.voxelize as vox
class GraphTransform(object):
def __init__(self, atom_key, label_key):
self.atom_key = atom_key
self.label_key = label_key
def __call__(self, item):
# transform protein and/or pocket to PTG graphs
item = prot_graph_transform(item, atom_key... |
e928d2ff6d61b5139e75933b223e8269719bc96de39f28189819b1746c75121f | Python | 5,251 | 219 | #!/usr/bin/env python
import click
import numpy as np
import os
import pandas as pd
import re
import sys
import torch
from tqdm import tqdm
bar_format = "{percentage:3.0f}%|{bar:20}{r_bar}"
from explainn.models.networks import PWM
# Local imports
sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), os.pardi... |
9b5606188084de7e36491b08bc9c0e9c3bb760dc532b432b5a03d57ee7e3e706 | Python | 5,252 | 136 | # 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... |
ac5e26e0ef95673dfa4c91eeb548ec2da2679c4320826cc4bcebeb844bf667c0 | Python | 5,252 | 175 | """
Compute soma and dendrite areas and ratios
This module is part of *vcnmodel*.
Support::
NIH grants:
DC R01 DC015901 (Spirou, Manis, Ellisman),
DC R01 DC004551 (Manis, 2013-2019, Early development)
DC R01 DC019053 (Manis, 2020-2025, Later development)
Copyright 2017-2022 Paul B. Manis
Distributed... |
1697a11c59d0325c6fe9e12546b6a7c77e1c1e29b63f783ac6ffb6b8c970bbfe | Python | 5,256 | 162 | """Geometry operations with molecules"""
import math
import numpy as np
DIM_DICT = {'x': 0, 'y': 1, 'z': 2} # Axis translation
def pbc_norm(point1, point2, box_size):
"""This functions determines if two points belong to the same box using the
minimum image convention in a box of n dimensions.
Args:
... |
3bcd26a717227de16881934ec3bcf42ef2ddbf2db148742eb3c630d749e687b5 | Python | 5,256 | 170 | import argparse
from molucn.path import COLOR_PATH, DATA_PATH, LOG_PATH, MODEL_PATH, RESULT_PATH
# Parse train only at the beginning in train_gnn.py
# Shared parse for explain.py and train_gnn.py
def overall_parser():
"""Generates a parser for the arguments of the train_gnn.py, main.py, main_rf.py scripts."""
... |
e62d95a9e0ba4a6973ca03b237029476140dea08933363e1bcf77ecbccac7f2b | Python | 5,258 | 144 | from ast import ExtSlice
from email.policy import default
import numpy as np
import os
import random
import torch
from sklearn.utils import class_weight
from src.data import create_dataloader, create_joint_dataloader
from src.scripts import *
from src.configs import *
from src.constants import *
from src.modules impor... |
d9529a40256441bd429da42f81bad6c320813f7f022ad66591e680ce5a46091c | Python | 5,260 | 124 | # 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... |
55d3256fe29a4b5ea4b30caf4dc5c3701044e0d8b35cae0f036a4fcbf745c265 | Python | 5,261 | 157 | import inspect
import json
import logging
import os
import sys
from dataclasses import dataclass, field
import torch
from transformers import HfArgumentParser
import flair
from flair import set_seed
from flair.embeddings import TransformerWordEmbeddings
from flair.models import SequenceTagger
from flair.trainers impo... |
d7686fa0488046bc80295e8c0b5b19b2003256e9c91be165e9839b4a267d2583 | Python | 5,262 | 133 |
"""
Script to plot example training trajectory on the same data generation as cnn_fit_test.py
"""
import model
import numpy as np
import matplotlib.pyplot as pl
import utilities
import seaborn as sns
from scipy.signal import convolve
import matplotlib as mpl
import os
if __name__ == '__main__':
# the following ... |
e9926a6787c86aa3d617ad36983a16b5b6073a56d05d6adc9e4a4b5e0f5c2774 | Python | 5,262 | 184 | """
random_walk.py
Tests random walk learning with varied walk distribution (increasing
the angular velocity experienced) or varied learning time.
"""
import numpy as np
import matplotlib.pyplot as plt
from extended_ring_model import *
from dict_key_definitions import rmkeys, decodekeys
def generate_timeseries(durat... |
88fc9c472affba79a60ea1a29b9f9ee3580a99688d0dfcdd0717e6aa2e61234a | Python | 5,264 | 122 | import os
import glob
import dxpy
import dx_utils
BIONANO_ROOT = '/Solve3.4_06042019a/'
SCRIPTS_DIR = os.path.join(BIONANO_ROOT, 'PIPELINE', 'Pipeline')
HYBRID_DIR = os.path.join(BIONANO_ROOT, 'HybridScaffold', '06042019')
TOOLS_DIR = os.path.join(BIONANO_ROOT, 'RefAligner', '8949.9232rel')
os.environ['PATH'] = HYB... |
df157cbe81595f5db5240f98b0f4f32d7e70979e9fb2f895ff44c667b8307b81 | Python | 5,265 | 136 | # Takuya Ito
# 11/29/2018
# Balloon-Windkessel model for hemodynamic response modeling
# Equations and default parameters taken from:
# Friston KJ, Harrison L, Penny W (2003) Dynamic causal modelling. Neuroimage.
import numpy as np
def balloonWindkessel(z, sampling_rate, alpha=0.32, kappa=0.65, gamma=0.41, tau=0.98... |
dd91a8f7462297398fd269cc0d5bfacb316faad7344cc883f6d5d09f5fc9b17d | Python | 5,266 | 147 | #!/usr/bin/env python
# aws_s3_to_s3 0.0.1 test suite
# Generated by dx-app-wizard.
import json
import os
import time
import unittest
import dxpy
import dxpy.app_builder
from subprocess import check_output, check_call, CalledProcessError
from dxpy.exceptions import DXAPIError
import dxpy.executable_builder # work a... |
260605fcf547e5fed40c8aecd86313788bab50d37ce0d4219dbc842e96ce94c0 | Python | 5,270 | 178 | # 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 Slice(Base):
@staticmethod
def export_slice() -> None:
... |
f29d664fa78ff6b2a0183249418d8bf905aea7aac9c487a8f675489fe8111034 | Python | 5,272 | 151 | # 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 QLinearMatMul(Base):
@staticmethod
def export_int() -> None:
... |
fe338041c8089b2bb14a3a266d101b00857c87dd759ec9e83dc81a8448ad7209 | Python | 5,273 | 148 | import io
import logging
import json
import numpy as np
import os
import torch
from PIL import Image
from torch.autograd import Variable
from torchvision import transforms
import torch.nn.functional as F
logger = logging.getLogger(__name__)
class OutlierHandler(object):
"""
Outlier handler class for binary ... |
53cef2f08d86a6357e03180c5659cd3e17415aaa45e1f367a42652df691f4062 | Python | 5,274 | 151 | # 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... |
d9d6d763f572b69330b3586ee5995c1cfec357b11bfebcacb3f3f897fa25f618 | Python | 5,283 | 128 | ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: Yaoyao Liu
## Tianjin University
## liuyaoyao@tju.edu.cn
## Copyright (c) 2019
##
## This source code is licensed under the MIT-style license found in the
## LICENSE file in the root directory of this source tree
##++++++++++++++... |
1010c42fd8d89295122c315e5e8a5aa0d0b6000a5e3e918d4e873fc8df0297fa | Python | 5,287 | 152 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import logging
import numpy as np
import os
import sys
import rdkit
from rdkit import Chem
import random
import csv
from gln.common.cmd_args import cmd_args
from gln.data_process.data_info import DataInfo, load... |
6ff4e884a7ce7714507c44bf0a932bc2a97d4f53c11354123e5525abd94bf5a2 | Python | 5,289 | 128 | """
Read the data collected in the benchmarking test
William Nourse
August 26th, 2021
Wen Moon?
"""
import pickle
import numpy as np
import matplotlib.pyplot as plt
"""
########################################################################################################################
ALL COMPONENTS
"""
# this ca... |
06b5156b8e8fbe9738236e520a711161b1580dbffe2f4372d654bf2ebdb4f6bb | Python | 5,292 | 140 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
from onnx.reference.ops.op_col2im import col2im_naive_implementation
class ConvTranspose(OpRun):
def _run(
self,
X,
... |
431fa4af57f447ff358cc83a2e5429db70d635f5fe800056b317e62d7fec95d0 | Python | 5,292 | 160 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter
import matplotlib.colors as colors
import seaborn as sns
def eigenvalues(EWs, ax=None, bins=50, N=None, B=None,
spectra_method='SCREE', ylim=None,
color=sns.color_palette()[0]):
... |
a607406a1f91139fbcb0405eda0753a5346f7aef736c3e9d4b464cfea9e01724 | Python | 5,292 | 124 | # 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
#
import logging
from collections import namedtuple
from ampligraph.utils.file_ut... |
33af86cc37166e4752c6f4b9187de9482cd5bd3b84d127a2b28ce8bdd0eb4090 | Python | 5,293 | 162 | # 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
from onnx.defs import AI_ONNX_PREVIEW_TRAINING_DOMAIN
def apply_momentum(r, ... |
6f16791723bf550c743097b445281531a9b7b88df6f3c157b32061ec567541e7 | Python | 5,293 | 138 | # 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... |
3450c61e958efa3af4a8c783795403ed9d767a8be02f9b112a9bd6aedc959d4d | Python | 5,296 | 143 | """Functions for graphs handling and visualization purposes."""
import numpy as np
from networkx import Graph, get_node_attributes, kamada_kawai_layout, draw_networkx
import torch
import torch_geometric
from torch_geometric.data import Data
import matplotlib.pyplot as plt
import networkx as nx
from sklearn.preprocessi... |
a70beae6ab44e1eb7dac7f9a867fd0d13cf0b64b33b396c4dd46e3e1f60b4503 | Python | 5,302 | 128 | # 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
#
# ... |
c62acfc02cad09d6e4a5d1009ccca3b626b349c46c7f33ceaf72180023c609db | Python | 5,303 | 187 | # 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 ReduceProd(Base):
@staticmethod
def export_do_not_keepdims() -... |
d642ee14f35825f984da17e0876e99825aad829b891ea0de95efc0c1f704427e | Python | 5,305 | 160 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import TYPE_CHECKING, Any
import ml_dtypes
import numpy as np
from onnx import TensorProto
from onnx.reference.op_run import OpRun
if TYPE_CHECKING:
from collections.abc import Sequen... |
a451319e92cb83e39ee0d010f73c8550ff27cf3069e0c9ba5387ff8fdc60781f | Python | 5,307 | 127 | #!/usr/bin/env python
"""
Takes in a dataset and generates a version that is only 10% as large, in terms of proteins, as the original.
The resulting genome assembly fasta file will be as small as possible.
"""
# This block imports fasta-parser as fasta
import os
import sys
this_path = os.path.dirname(os.path.abspath(... |
7b4369e402e3fefd66b7cbdd42f32b6ecc2d02f6ea8c81494e0c3dd45e572d5f | Python | 5,308 | 125 | import numpy as np
import pandas as pd
from figures.clean_data import plot_symmetry_score
from figures.util import main_regions, produce_figure, produce_plot_data, get_subplots, fig_config, plot_scatter, \
plot_annotations, density_scatter
def plot_observed_vs_technical(data):
region_counts = pd.DataFrame({'... |
6fdfc7d639f7638acced3c6d92faf3b0c9307c7a837c3693087cc200a9e4a2b9 | Python | 5,309 | 153 | # Copyright (c) OpenMMLab. All rights reserved.
import platform
import random
from functools import partial
import numpy as np
import torch
from mmcv.parallel import collate
from mmcv.runner import get_dist_info
from mmcv.utils import Registry, build_from_cfg, digit_version
from torch.utils.data import DataLoader
if ... |
897231b6d34ac1a99383f1998776aa5bc018eb821c47becd812e156b51bc9b67 | Python | 5,311 | 172 | import numpy as np
import pytest
from numpy.testing import assert_array_equal
from seaborn import algorithms as algo
@pytest.fixture
def random():
np.random.seed(sum(map(ord, "test_algorithms")))
def test_bootstrap(random):
"""Test that bootstrapping gives the right answer in dumb cases."""
a_ones = n... |
3502844bf2c33accea12c9ff342fa0f7dfff3781dbc0def6b4c53910da013317 | Python | 5,315 | 166 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: Tveten, johannvk, fkiraly
"""Stateless base class for interval scorers.
class name: BaseIntervalScorer
Unlike the original skchange version, this base class is **stateless**:
- ``evalua... |
cf5e1a3d9d853b0615b531689f73a8b82d4ca9c78bf7d78aaab16ac22bfd8047 | Python | 5,316 | 139 | """
View component of the MVC pattern for pciSeq diagnostics.
This module is responsible for presenting data to the user through a Streamlit dashboard.
It maintains the original visualization style while working with the new MVC structure.
"""
import streamlit as st
import pandas as pd
from io import StringIO
import ... |
f170b415f7f4a29eae37f804502f04db6d40f1cfcc41e2dff6b9ef662d20aa56 | Python | 5,318 | 150 | """Interface for MrSEQL classifier."""
__authors__ = ["lnthach", "heerme"] # fkiraly for the wrapper
from sktime.classification._delegate import _DelegatedClassifier
class MrSEQL(_DelegatedClassifier):
"""MrSEQL = Multiple Representations Sequence Learning classification model.
Direct Interface to MrSEQLC... |
4eef71f7dd06c980f7b25f62ea85a4ef8dc1d7ae451f68bc65f50dc94d51af5c | Python | 5,321 | 119 | # -*- coding: utf-8 -*-
#/usr/bin/python2
'''
Adapted from kyubyong park, June 2017.
kbpark.linguist@gmail.com.
https://www.github.com/kyubyong/transformer
'''
import tensorflow as tf
# Apply multihead attention to a 3d tensor with shape [batch_size, seq_length, n_hidden].
# Attention size = n_hidden should be a mul... |
69ed7e1baaa6b1b81a96d6fc6a14c0171e7f135685e4bc24b4956bb1eb17a773 | Python | 5,321 | 164 | import numpy as np
#%%
def calc_host_effect(center, f_he, features):
'''Calculate the temporal resources available to each microbial strain.
The resources are calculated as a function of the distance between
the microbial features and the host state'''
# center: current host state
# f_he:... |
76bac109f1e84fe1cc9872a8069f3bde6b55a3d7dc935268310e307cf3ee5a5d | Python | 5,321 | 158 | import pytest
import siibra
from siibra import MapType
from siibra.volumes import Map
from siibra.volumes.volume import Subvolume
import numpy as np
maps_to_compress = [
siibra.get_map("2.9", "mni152"), # contains fragments
siibra.get_map("difumo 64", "mni152", MapType.STATISTICAL), # contains subvolumes
]... |
c81d963ae343d261989e5fda497a24019f2418e8cfdefd5c99975fa8387ac33d | Python | 5,323 | 155 | """ Report manager utility """
from __future__ import print_function
import time
from datetime import datetime
import onmt
from onmt.utils.logging import logger
def build_report_manager(opt, gpu_rank):
if opt.tensorboard and gpu_rank == 0:
from torch.utils.tensorboard import SummaryWriter
tensor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.