sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ba7f92683e5b316684f4834613d69bed41c0825d63f8c4f6ac842d35d5ba2143
Python
3,815
92
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
426aa7bb65524e58b011703d59d5ff07d4b5b762883a68c950247f20b8b74f55
Python
3,816
126
import torch import pytest from ..otno import OTNO # Fixed variables in_channels = 9 out_channels = 1 hidden_channels = 16 n_modes = [16, 16] lifting_channel_ratio = 3 projection_channel_ratio = 3 n_layers = 4 # data parameters n_s_sqrt = 18 n_target_points = 100 @pytest.mark.parametrize("positional_embedding", [N...
d0e6db83f2523bec2a773507568dde6cd6c254261c4e23763befa4b30615fab1
Python
3,816
94
import unittest from oaklib import get_adapter from oaklib.datamodels.obograph import ( DisjointClassExpressionsAxiom, ExistentialRestrictionExpression, ) from oaklib.datamodels.vocabulary import PART_OF from oaklib.utilities.axioms.disjointness_axiom_analyzer import ( generate_disjoint_class_expressions_a...
a0dbf5bc48525d0c10d90a832f9fb065f5dfc3baaa43f08015345726cd2deb61
Python
3,818
94
from __future__ import print_function import numpy as np import os import matplotlib.pyplot as plt import torch def _get_detections(dataset, retinanet, score_threshold=0.05, max_detections=100, save_path=None): """ Get the detections from the retinanet using the generator. The result is a list of lists such...
dfe25300bb133769a1b4ebebf1cb8a6cdba06f92e11d81042be318bb5464398b
Python
3,818
109
# 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...
e9ba9000d5a27d2d4d7056276a23753f1f4e12f372d06e8b1895dd3ebebc9796
Python
3,819
67
import numpy as np import copy import h5py import sys,os import pandas as pd import scipy.sparse import pickle sys.path.append('/home/thijs/repos/dnp-code/PGM3_correct/source/') # the path where the folder PGM is. sys.path.append('/home/thijs/repos/dnp-code/PGM3_correct/utilities/') # the path where the folder PGM is. ...
bf2658561a187ae6ba74aced58891e52d670ad308a44a20f8f926065cb3c44ac
Python
3,820
105
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
4b3503c1f776b4d3afa6965112579f88e1bcf925a37a7b499d1648633b453825
Python
3,821
83
import json from carla_cosmos_server.auth import TokenStore, bootstrap from conftest import submission, upload def test_token_store_roundtrip(tmp_path): store = TokenStore(tmp_path / "tokens.json") tok = store.create("ci") assert tok.startswith("cc_") tid = tok.split("_")[1] assert store.verify(...
cea0f6085f16ca2bee039a08c6ddc4c2b15f5c333d9564f637721dd598a99223
Python
3,821
132
# -*- coding: utf-8 -*- #Model config. #Training config import json import pathlib INPUT_SHAPE = "input shape" KERNEL_SHAPE = "kernel shape" POOLING_SHAPE = "pooling" LEARNING_RATE = "initial learning rate" SEGMENTATIONS = "segmentations" OPTIMIZER = "optimizer" LOSS_FUNCTION = "loss function" STRIDE = "str...
6757f063515a47b17bfe0a8c45b482a25e6dbf891da2493374795d1cb55485e6
Python
3,822
97
import logging import unittest from oaklib.datamodels.search import SearchConfiguration from oaklib.datamodels.search_datamodel import SearchProperty, SearchTermSyntax from oaklib.datamodels.vocabulary import IS_A, PART_OF from oaklib.implementations.ontobee.ontobee_implementation import OntobeeImplementation from oak...
9175a693dc0bf1043274f47b169aca469d90452c70eb8c3d1bc623fb1291255a
Python
3,823
101
import logging import numpy as np from .batch_sequence import BatchSequence from .random_batch_sequence import RandomBatchSequence from .balanced_random_batch_sequence import BalancedRandomBatchSequence logger = logging.getLogger(__name__) def batch_wrapper(generator, x_shape, y_shape, x_dtype=np.f...
f4a675babf5d9e6035bc6457e7ec348470d4bda1342e90996af4ecf28178e9ea
Python
3,823
133
""" http://pymolwiki.org/index.php/spectrumany (c) 2010 Thomas Holder License: BSD-2-Clause """ from pymol import cmd, stored expression_sc = cmd.Shortcut( [ "count", "resi", "b", "q", "pc", ] ) def spectrumany( expression, color_list, selection="(all)", minimu...
2a338c33ea339f991cf9133be408dd0c007828430e65a16a706a6bf4bb642b3a
Python
3,826
98
# basic imports import os import pickle import numpy as np # framework imports from cobel.agents.sfma import SFMAAgent from cobel.interfaces.gridworld import InterfaceGridworld from cobel.misc.gridworld_tools import make_open_field def single_run(world: dict, number_of_replays: int = 20, batch_size: int = 20, mode: s...
2184d982779de5b49e615a7363b2264f68528be2d429ef59b72db7d322159a6f
Python
3,829
109
""" File: create_extra_cov_matrix.py Created: 2020/10/20 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either ver...
4c2e46e39bbce1da0b3fc2850a9c2fa436b7776764ef8f8813c8da7cef05bfad
Python
3,832
96
""" Some analysis of informational content of TLDR-Auth and TLDR-PR """ import os import csv from collections import Counter, defaultdict INFILE = 'tldr_analyze_nuggets/tldr_auth_pr_gold_nuggets_2020-03-31.csv' # Q1: How many nuggets do TLDRs contain? # A: Interesting, both author and PR have nearly identical di...
6962129e016ba8b0bbc84b85b1e08f49cde03aee36584744d67bce8a43d35187
Python
3,832
107
from typing import List, Union from pathlib import Path import torch from .mesh_datamodule import MeshDataModule from .web_utils import download_from_zenodo_record from neuralop.utils import get_project_root class CarCFDDataset(MeshDataModule): """Processed version of the Car-CFD dataset. CarCFDDataset...
cb49f0aadb4577b006b5785c6f8e0f0e65174f989bd094f6cc47673e4ba35a9e
Python
3,832
106
from datetime import datetime import gzip import wget from time import strftime import os from pathlib import Path import argparse parser = argparse.ArgumentParser(description='Make GO matrices.') parser.add_argument('ordered_gene_list', help='List with ordered gene IDs') parser.add_argument('unipr...
dc4262cde53cafcdcfa7424b2555cd5f0677d897d37806d5e0d4161fe79ee7b4
Python
3,833
109
import numpy as np def linear_(x, params): a, b = params return a*x+b def sigmoid(x, L, x0, k, b): return L/(1+np.exp(-k*(x-x0)))+b def sigmoid_fit(x, y): from scipy.optimize import curve_fit ymin = np.percentile(y, 5) ymax = np.percentile(y, 95) x0 = np.percentile(x, 70) p0 = [yma...
f31003b321f2a4eee0f64f725f36f0a702194cb64fcb5421a288722bab702786
Python
3,833
78
import json, re, string import logging from tqdm import tqdm working_dir = '/home/jknafou/risklick_classification' splits_path = working_dir + '/splits_v3t' index_path = working_dir + '/index_v3' dataset_path = working_dir + '/dataset_v3t_' _RE_COMBINE_WHITESPACE = re.compile(r"\s+") punctuation = string.punctuation ...
1df9b6a1b749a49104d38905f46260395e32fd42acb0b8b6ee73b5a7d0f76ab5
Python
3,834
96
# Copyright 2021-2022 Huawei Technologies Co., Ltd # # 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 agre...
6ee8f69d126ed11bcdbd55d5945d628912117094d8d9b8f1d054954117534934
Python
3,834
122
import sys import networkx as nx import numpy as np import matplotlib.pyplot as plt from graphxai.datasets.BA_shapes.ba_houses import BAHousesRandomGaussFeatures,\ BAHousesRandomOneHotFeatures from graphxai.datasets import BAShapes from graphxai.gnn_models.node_classification.testing import * # Contains GCN 1-3 l...
e1550a5fe90f2b30afd976ac81453d46137a35a53817c9f140f7c9dea2683ff8
Python
3,836
109
import copy import logging import mmcv import random from collections import defaultdict from mmdet.datasets import CocoDataset, RepeatDataset from pycocotools.coco import COCO def build_divide_dataset(cfg, part_1_ratio=0.5, seed=520): """Need to change `coco.getImgIds()` output, i.e., `self.img...
07099ea9ffab72f3fb5c621a545b603581ca73c55d60d4a633b640fa1bdba106
Python
3,837
104
""" evaluator Created by: Martin Sicho On: 29.05.22, 18:12 """ import concurrent from tqdm.auto import tqdm from drugex.parallel.interfaces import ParallelException, ParallelProcessor class ParallelSupplierEvaluator(ParallelProcessor): """ Class implementing parallel evaluation of `MolSupplier` instances on ...
7eee00735b0e33ef152d88e45d30f59e99ff7be9133e32eadab496f3d38500f3
Python
3,838
114
from tqdm import tqdm import numpy as np import torch from torch.utils.data.dataloader import DataLoader import pickle class TrainerConfig: # optimization parameters betas = (0.9, 0.999) grad_norm_clip = 1.0 ckpt_path = None history_path = None num_workers = 0 # for DataLoader def __init_...
eced0ab2200ecf8cfaeebaa7fcedf3046cda5f17b14b1293264738eb9fbc3c3a
Python
3,839
84
import asyncio import subprocess import sys import time import pytest from carla_cosmos.synthetic import av7_clip from carla_cosmos_server.config import default_run_dir from cosmos_workers.common import protocol, video @pytest.fixture def worker(tmp_path): run = default_run_dir(tmp_path) run.mkdir(parents=T...
2340bbf7c91f1fc95181bd703c7b6430598b2a83700468275782378890eb1133
Python
3,840
102
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
3b20127d16244b176929885d723da9900b173d1d4e4cb5c3e9efb402ac8915dd
Python
3,841
120
""" Refer to https://github.com/rosinality/stylegan2-pytorch/blob/master/calc_inception.py """ import argparse import pickle import os import torch from torch import nn from torch.nn import functional as F from torch.utils.data import DataLoader from torchvision import transforms from torchvision.models import in...
599e1245d74d09ac43f4aa0be2eb945eef033640aa2e5a321e872f50f500890e
Python
3,843
125
#!/bin/python import argparse import glob import os import yaml from array_tomography_lib import channel_file, colocalisation, colocalisation_result CHANNEL_NAMES = ["PSD", "ALZ50", "SY38"] CACHE_DIR = ".file_cache" def main(): args = _parse_args() in_dir = args.input out_dir = args.output config_...
0c186ff0652e373354e58c1e3cc1d4334d2a122d5c79ea8bd0735a6530051ef8
Python
3,845
93
import matplotlib matplotlib.use("Agg") from matplotlib import pyplot as plt from sklearn.metrics import roc_curve from sklearn.metrics import roc_auc_score from sklearn.metrics import confusion_matrix from sklearn.metrics import precision_recall_curve from sklearn.metrics import jaccard_similarity_score from sklearn....
4679aa19163570cc052f88bb5efc5ab2f1f6421570bb727e82be887b6a0d10d6
Python
3,847
99
import logging import unittest from oaklib.datamodels.search_datamodel import SearchTermSyntax, SearchProperty from oaklib.implementations.ontobee.ontobee_implementation import OntobeeImplementation from oaklib.datamodels.vocabulary import IS_A, PART_OF from oaklib.datamodels.search import SearchConfiguration from oak...
b2dd9928571c19d24b5ce410838fe3c769971d453844b32d224032751a70f18a
Python
3,847
108
# -*- coding: utf-8 -*- import numpy as np from . import embed from . import utils class _ConventionCausality(object): def __init__(self, embed_dim): assert isinstance(embed_dim, int) and embed_dim > 1, \ 'Embedding dimension must be integer (> 1).' self.embed_dim = embed_dim def...
806f02972cf0991e93cffe2dfb186ddbc17cba5372b234389bcb5066a89ab595
Python
3,850
102
import torch import os import pandas as pd import numpy as np import random import pickle from src.invalidSMILES import get_invalid_smiles from src.preprocess import standardization_pipeline, remove_smiles_duplicates from src.modelling import initialize_model, correct_SMILES if __name__ == "__main__": # set ra...
f246d8a444d4aa4af96bb7934c39e13b5f26950f5a802f1d216de3b7e69e34db
Python
3,850
130
import argparse import torch from torch.nn import functional as F import numpy as np from tqdm import tqdm import lpips from model import Generator def normalize(x): return x / torch.sqrt(x.pow(2).sum(-1, keepdim=True)) def slerp(a, b, t): a = normalize(a) b = normalize(b) d = (a...
b565fa4088be8d1dcdf1c7402dd70cf2bfc19646d14a3c8ab882cffc95e74a8d
Python
3,851
113
# Copyright 2022 Huawei Technologies Co., Ltd # # 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 a...
62c2ed5fc442c0862c9a51ebda6a16b12413c26609642a5cf0441d96b3f5492a
Python
3,853
105
# Copyright 2020 Huawei Technologies Co., Ltd # # 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 a...
6dbe321d5b3134da7b041e32aff73ca40b92b6c05a19fd9fa9162e83cfda87f1
Python
3,854
128
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import Optional import sys import warnings from time import sleep import pandas as pd import requests from Bio import Biopython...
f5c11c47feb760a60efe5b6188fde4e35e389e39100347d4d92ac947e381aefe
Python
3,854
104
import tensorflow as tf import numpy as np def create_divergence_kernels(): """ Create kernels in 3 different direction to calculate central differences The kernels will filter out the x, y, z direction vector Representing the gradients for each direction """ kernel_x = np.zeros((3,...
2c3b6edbfbb4a0d8fda6a7259310435c5a35f998beeba4373839d8de8a428292
Python
3,855
105
import pandas as pd import numpy as np from rl_analysis.util import count_transitions from typing import Optional def get_lagged_features( values: pd.DataFrame, dlight_features: list[str] = [ "signal_reref_dff_norm_rising_range", "signal_reref_dff_norm_rising_slope", "signal_reref_dff_...
dd7fc1e4af93f4d6249fb50e518e05ab29e20bb0e9b8e9eaf334bd4114e2578c
Python
3,855
108
import torch import torch.nn as nn import torch.nn.init as init class DnCNN(nn.Module): def __init__(self, depth=17, n_channels=64, image_channels=1, use_bnorm=True, kernel_size=3): super(DnCNN, self).__init__() kernel_size = 3 padding = 1 layers = [] layers.appen...
1a08afe8390378b108789f40104197dc67c3ab7731d448370047360ad5dfb0cd
Python
3,856
101
""" File: Show_fastica_centriod_stability.py Created: 2020-05-06 Last Changed: 2020-05-06 Author(s): H.H.Wiersma Code to create distribution plot and a mask image used in the research plan Copyright (C) 2019 H.H.Wiersma This program is free software: you can redistribute it and/or modify it under the ...
28c588e5f371b559d4ee5f60a9bb39eeccd3e32c8ee3609fda7ecb694deedb06
Python
3,856
101
import os import traceback import unittest from unittest.mock import MagicMock, patch import requests from oaklib import get_adapter from oaklib.constants import TIMEOUT_SECONDS from oaklib.implementations.ncbi.eutils_implementation import ( EFETCH_URL, REQUEST_INTERVAL, REQUEST_INTERVAL_WITH_KEY, ) EMPT...
8c5b7a9e2a95aaac53eb0fe82c7478d3e10a48983e1d8a170b721fff329337b8
Python
3,859
97
""" A set of utilities for performing loop extrusion simulations. """ class bondUpdater(object): def __init__(self, LEFpositions): """ :param smcTransObject: smc translocator object to work with """ self.LEFpositions = LEFpositions self.curtime = 0 self.allBonds = [...
bacfdd072c654c52f855e081aced35e0573f3b2a5d97719c3709e179ee325513
Python
3,860
113
""" This file defines the core research contribution """ import matplotlib matplotlib.use('Agg') import torch from torch import nn from models.encoders import psp_encoders from models.stylegan2.model import Generator from configs.paths_config import model_paths def get_keys(d, name): if 'state_dict' in d: d = d['...
83bc2f1ae7e4fe4d39b79c95fca6539d6d1203408b273a7e2adf7be6ab733d13
Python
3,861
96
import json from collections import defaultdict import inflect import spacy from tqdm import tqdm if __name__ == "__main__": nlp = spacy.load("en_core_web_sm") inflect_engine = inflect.engine() with open("data/preprocess/2_unknown_2_known.json") as in_file: contexts = json.load(in_file) def g...
8d2f21feef8b7827dac22b2db2c6def1f877d6e06bd11e5278308e5ad4fae6ed
Python
3,861
173
# -*- coding: utf-8 -*- """ Created on Tue Jul 20 21:08:56 2021 @author: N.V """ # -*- coding: utf-8 -*- """ Created on Tue Jul 20 18:47:06 2021 @author: N.V """ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation import os # not...
b49280f5292aa56c40c3d4d8f5783935be3cf699e154d9043f7f74009f1ca78e
Python
3,862
97
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim class PPO(): def __init__(self, actor_critic, clip_param, ppo_epoch, num_mini_batch, value_loss_coef, entropy_coef, ...
f8b8928b37b05ecd9191d7f409cd2ab2b56f028e0e5e7783ede9616fbef6b60c
Python
3,863
129
from numpy import random import math import numpy as np import matplotlib.pyplot as plt import copy import scipy as sp import scipy.optimize from sklearn.decomposition import PCA import seaborn as sns import pandas as pd from sklearn.metrics import roc_auc_score from sklearn.preprocessing import normalize ...
14d184feb888a4fce46c559b5295d94b4f9d185e9a90c86765edd04e8ef9c819
Python
3,864
141
import os import cv2 import torch import numpy as np from PIL import Image from dlib import cnn_face_detection_model_v1 as face_detect_model def center_crop(im, length): w, h = im.size left = w//2 - length//2 right = w//2 + length//2 top = h//2 - length//2 bottom = h//2 + length//2 ...
1b95fcd3984aafd3acbf6bf488edc0664def4a51fa7721402dbc8bb9d70d4ae2
Python
3,866
130
# -*- coding: utf-8 -*- from .core import * from .. import _logging as logging import tensorflow as tf __all__ = [ 'FlattenLayer', 'ReshapeLayer', 'TransposeLayer', ] class FlattenLayer(Layer): """A layer that reshapes high-dimension input into a vector. Then we often apply DenseLayer, RNNLayer...
3b82ccab8ff8c77a89cabc006c53687e015e8b37011629a0b99ee649cdaa7782
Python
3,866
108
from pathlib import Path from typing import Callable, Optional, Tuple import matplotlib.pyplot as plt import numpy as np import tokenizers import torch import torch.nn as nn import torch.nn.functional as F import transformers from accelerate import Accelerator from matplotlib.lines import Line2D from torch.nn.utils.rn...
6ef6bd22f0af75a907f5f262ca57bd1895624613a83886856b5774fc94cef97c
Python
3,867
113
from typing import Tuple, List try: # pardiso (using Intel MKL) is much faster than scipy's solver from .mkl import spsolve_pardiso as _spsolve except OSError: # if mkl isn't installed from scipy.sparse.linalg import spsolve as _spsolve import numpy as np import scipy.sparse as sp import jax.numpy as jnp im...
abb8b076688059dbd48d0a12d758abecf5a64bd84dc99cd8405d475c36aece3b
Python
3,867
97
import pandas as pd import os import inspect import AIS_parameters import AIS_import import numpy as np import re fname = os.path.split( inspect.getfile(inspect.currentframe()) )[1] ## df_vessel_types = None df_vessel_status = None def clean_vessel_type_str(str_): sub_list = ['all ships of this ty...
488021763e94293f287c5e6e6c7590f5e458bac5188b7ca361ca96bb3d27b6d7
Python
3,868
114
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the di...
a5e60dd761fb47524f5239b5bc42b8e2abd041c88a3539a980c3d2d5d8b4d465
Python
3,868
125
# -*- coding: utf-8 -*- """ Creación de un flujo de vídeo simulado Por UDP """ from time import sleep import cv2, socket, traceback, struct, sys, zlib, pickle from sys import argv from getopt import getopt, GetoptError __author__="José Luis Garrido Labrador" def help_(salida=0): print("Ayuda sobre el emisor") ...
797bb97b55bbc07fd83ef2d34b23b3f879186817ddc79cb01100b523eee6f6ed
Python
3,869
125
# -*- coding: utf-8 -*- import unetsl import unetsl.config import pathlib import json class HeadConstants: name = "name" n_labels = "n_labels" bits = "bits" activation = "activation" depth = "depth" resampler = "resampler" offset = "offset" def getDefaultCerberusConfig(): unet = une...
be1eb2c1b7a312da4ce0d7dfa9029ec3799445a4138abc932792dd09a9212ee9
Python
3,869
133
""" .. _burgers_2d_fd_vis : A finite difference solver for Burgers' equation in 2 dimensions =============================================================== An intro to our loss module's finite difference utility demonstrating its use to create a simple numerical solver for Burgers' equation in 2d. """ # %% # .. raw...
df08ce9f3766ea53d019488823243fe42e6e3831c51f8353b5a13554bf606f21
Python
3,870
79
import json, re, string import logging from tqdm import tqdm working_dir = '/home/jknafou/risklick_classification' splits_path = working_dir + '/splits_v3' index_path = working_dir + '/index_v3' dataset_path = working_dir + '/dataset_' _RE_COMBINE_WHITESPACE = re.compile(r"\s+") punctuation = string.punctuation punct...
a275193f8d4728b372f09033dd59743e85f8cac8a10685a99365090f10761245
Python
3,871
170
import matplotlib.pyplot as plt import numpy as np import colorcet as cc CLASS_IND_DICT = { "KC": 0, "KC-1claw": 28, "KC-2claw": 32, "KC-3claw": 92, "KC-4claw": 91, "KC-5claw": 78, "KC-6claw": 61, "APL": 24, "MBIN": 121, "MBIN-DAN": 58, "MBIN-OAN": 5, "MBON": 172, "...
58483182fceb22e31ac2fbbbcb74575ccd82c13e9a065136c724875c479f3426
Python
3,873
97
from __future__ import print_function import sys import os import argparse import torch import torch.nn as nn import torch.backends.cudnn as cudnn import torchvision.transforms as transforms from torch.autograd import Variable from data import VOC_ROOT, VOC_CLASSES as labelmap from PIL import Image from data import VOC...
708c2e4b7bcad661932fe75a7f8ce5cd33a0f358d44dc115ba98735d6dc7abd1
Python
3,875
93
import pandas as pd pd.set_option('display.width', 1000) pd.set_option('display.max_rows', 10000) pd.set_option('display.max_columns', 10000) def round_value(value, binary=False): divisor = 1024. if binary else 1000. if value // divisor ** 4 > 0: return str(round(value / divisor ** 4, 2)) + 'T' ...
2f98619142859ec94295e1c9d880a4482662c4261baaddfd5aeba270addc780e
Python
3,876
126
#!/usr/bin/env python # Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # ===========================================================================...
141615deaef7a1f5b60aee452a2166c01f756e86944381d43037981545feec2a
Python
3,877
118
""" Description: The script we use to prepare the directory/files needed to export a model to the Kipoi model zoo. Output: Saves model.yaml, class names, and model state dictionary weights to a user-specified output directory. Usage: kipoi_export.py <saved-model-pth> <class-names> <config-yaml> <o...
e8546d60c81669b33075001230c983b887a808ce0b0a4dd351d3d0495382a0cf
Python
3,877
78
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
8aaf6c8eb61b729fd8791fa3e35e43504eb092b6caa82b975a2531d01ef93574
Python
3,879
107
from operator import sub import numpy as np import h5py import matplotlib.pyplot as plt def rotate(u, v, w, plane, theta): x = [u, v, w] if plane == 1: ax = (0, 1) rmat = [[1, 0, 0], [0, np.cos(theta), -np.sin(theta)], [0, np.sin(theta), np.cos(theta)]] elif plane == 2: ax = (0, 2...
f7e6b897afb7bcf7a5063f7208614618d1daad15fe80f94cc75cbcd9ebcbe684
Python
3,879
105
import math from functools import reduce import torch from torch import nn import torch.nn.functional as F # helpers def prob_mask_like(t, prob): return torch.zeros_like(t).float().uniform_(0, 1) < prob def mask_with_tokens(t, token_ids): init_no_mask = torch.full_like(t, False, dtype=torch.bool) mask =...
3557edbd902208de230a0d3aa8cdb342127df666663d02e967d5c37fcd713189
Python
3,881
108
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import Tuple, Dict import pandas as pd from tmkit.topology.pdbtm.ToFastaId import toFastaId from tmkit.topology.Phobius import ...
428c21d702ee280424b2d20113079d98dfeb956d97c563211b2fbdad9a69a8f3
Python
3,881
102
""" Created on Thu Oct 26 11:23:47 2017 @author: Utku Ozbulak - github.com/utkuozbulak """ import torch from torch.nn import ReLU from misc_functions import (get_example_params, convert_to_grayscale, save_gradient_images, get_positive...
6462cd70a709d21e5dc1f5b7c6ed6f73d828b225e8e7f001bd4668b30eddaa50
Python
3,881
128
from typing import List import torch from torch.utils.data import Dataset from .base_transforms import Transform from ...training.patching import MultigridPatching2D class MGPatchingTransform(Transform): """Wraps MultigridPatching2D to expose canonical transform .transform() and .inverse_transform() API ...
e6885f5e696ee7be4ad358b0f20a292bfe678885d73eb22ce7b00dc96f5f987c
Python
3,881
110
#!/usr/bin/env python import os import sys import tempfile import textwrap import numpy as np import polychrom.polymerutils as polymerutils if len(sys.argv) < 2: print(textwrap.dedent(""" Usage: show filename [start end pace] show filenum [start end pace] filenum is...
429915ba1483ac04e0c7df68c496c66aa666843fd0976eb5a893f51d1a07e5c5
Python
3,882
106
#! /usr/bin/env python3 ################################ ### Module to read the statistics analysis output files ################################## import numpy as np def ReadFixedEffect(file): """ Read the mean estimates from a file containing the statistical analysis of the peak to peak data. input : ...
4b6f8d1bc23f6788cbd460571b0511bd90e3e2b0725a127d53ad68f726cc4900
Python
3,884
95
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
46b3fd0a26db9dfeb1d080f6cfc96dc2faea7f576fdbc511d05cfc76ac1fec7a
Python
3,885
109
#!/usr/bin/env python """Example extract script To extract all ROI sets in all SIMA datasets: >> python extraction.py /path/to/sima/datasets For help and additional arguments: >> python extraction.py --help """ import os import argparse from sima import ImagingDataset # Never extract ROI sets with labels that con...
75830f26d925c3ac04555ce6c31f13b2f9cdd507a029997200b354c503ae729d
Python
3,885
106
''' @author: orisenbazuru ''' import torch import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence class RNN_Net(nn.Module): def __init__(self, input_dim, hidden_dim, z_dim, device, num_h...
b38643deb594f4cc4a8b9a863611e06a8a9f9034afbc1285deba12c96296a390
Python
3,885
105
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
6d292fa48f131a0e5137c863a155a7c2e2aa208d5347c686fefdaf1e945b965d
Python
3,886
115
# Copyright 2021-2022 Huawei Technologies Co., Ltd # # 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 agre...
cff05efc064e422fd39c2883d7f8bd04ff1171552af360003150dae240c60c26
Python
3,886
104
""" Title ----- Back-propagating dSpikes Description ----------- An important property of biological neurons is that action potentials (APs) initiated in the axon can invade the soma and nearby dendrites and propagate backwards toward the dendritic tips. The transmission efficacy of these back-propagating action poten...
f4e258a49e5a0bf2db6d04fb5359df247aa7db8c6567ea8417d7a7b64c7f7e4f
Python
3,886
111
import os import numpy as np import pandas as pd import feather import scipy.integrate as it from loadFile import * def v2nm(V, calibration): """ This function will convert the piezoscanner voltage signal into distance. A 20x gain is applied due to the presence of a 20x high-voltage amplifier in series wit...
105bdc6673bcfdbcd3580f5c575456029a645e56f63d0b7a4291cb4e0869625d
Python
3,887
118
import torch import torch.nn as nn from torch.nn.parameter import Parameter from torch.autograd import Variable import torch.nn.functional as F from utils import Config config = Config('config/') class GraphAttentionLayer(nn.Module): def __init__(self, requires_grad=True): super(GraphAttentionLayer, self...
75077473f6464774d4862c5834ec1e5eb94aa1ab383bede817d128d3150951d4
Python
3,887
117
# Copyright 2020 Google Research. 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 applicable law...
d945113ca3c016a5f34254e8769a6a6d599e94e7d6c5a8bb198f9ea0e6c6bdbc
Python
3,888
138
import json from os import listdir from pathlib import Path import numpy as np import pymaid from src.pymaid import start_instance def extract_ids(lod): out_list = [] for d in lod: skel_id = d["skeleton_id"] out_list.append(skel_id) return out_list def remove_date(string): datestri...
30d6fa852f9c31ef905073b287722ebeb6eb3591ea50c014706ef7d20e7e035e
Python
3,889
111
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import List, Tuple import numpy as np import pandas as pd class Network: def single( self, interacting_df:...
376164120a49596edcca9ed503b9bb9c7265ab31241c82fa20327681059b6357
Python
3,890
115
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
d3392c7b9892626512cc760a6d2b3f54226b6142822d9d7346e8164ff39c15af
Python
3,890
101
from re import I from itertools import chain import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.inspection import permutation_importance from sklearn.preprocessing import OneHotEncoder, MinMaxScaler from sklearn.pipeline import Pipeline from sklearn.compose import...
e3342999e1c23c52a858ffafc1cdc5ca5e556c3672254c84404e0cedf34d758c
Python
3,890
107
import glob import argparse import gzip import os import multiprocessing import datetime import sys parser = argparse.ArgumentParser(description='Simplify psi matrix') parser.add_argument('psi_dir', help='Directory with psi files') parser.add_argument('outdir', help='outdir to write to') parser.add_argument('--multipr...
c2c4669248b1080cd9e1d229a64d5e0e4094513df88d227356851faaddb16011
Python
3,891
105
""" This is the template script for running PBT with lfads_tf2 modified to be run with the Lorenz dataset. Ref: https://github.com/snel-repo/autolfads-tf2/blob/main/example_scripts/run_pbt.py """ import shutil from pathlib import Path import ray import yaml from lfads_tf2.utils import flatten from ray import tune fro...
0f7e26340e693fed2f5a1e68aad5968acb89059d59308071493f95cf7313d19d
Python
3,893
107
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. import time import carla from . import SmokeTest OUTSIDE_JUNCTION_TRAFFIC_LIGHT_XODR = """<?xml ...
e409c33b450629cbffa11823fd02e9d22036365399d24ff3ec6bab9c6a3f2ff4
Python
3,893
90
import torch from mmdet.core import bbox2roi from ..builder import HEADS, build_head from .standard_roi_head import StandardRoIHead @HEADS.register_module() class MaskScoringRoIHead(StandardRoIHead): """Mask Scoring RoIHead for Mask Scoring RCNN. https://arxiv.org/abs/1903.00241 """ def __init__(se...
c7d2ae355eaa0223522c843dbf0eb4b3ea910f85d55ee279a271992e6f2fdbd5
Python
3,894
105
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
15cea1b6ff00eb1014507d1cbc804a4e0c004917ea95db6e99a5d21df4be99e1
Python
3,896
115
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
57645c507c4c6f89a172d0416e07235842ae8316cb2c8e98b8808c8038a423db
Python
3,896
93
import torch import torch.nn as nn from torch.autograd import Variable import dni class RNNModel(nn.Module): """Container module with an encoder, a recurrent module, and a decoder.""" def __init__(self, rnn_type, ntoken, ninp, nhid, nlayers, dropout=0.5, tie_weights=False, use_dni=False): super(RNNMod...
3930f94c90dbcb8f12287736d7527cbd27f635b4294f664c35fe8961b546f5bf
Python
3,898
112
#!/usr/bin/env python # Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """Example visualization of vehicle doors opening""" import argparse import ...
05fa97cf021d14d651b74719c51599a2cc041999848fa0deba531094b418d000
Python
3,899
105
""" This is the template script for running PBT with lfads_tf2 modified to be run with the mc_maze dataset. Ref: https://github.com/snel-repo/autolfads-tf2/blob/main/example_scripts/run_pbt.py """ import shutil from pathlib import Path import ray import yaml from lfads_tf2.utils import flatten from ray import tune fr...
e21a1c7b37597485949753480378b91f105e95dcf31d96e22340d9f00a669f38
Python
3,900
109
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
5851e2249971971cc51f98268ab2b62e1d3350d28c2b4c044111e4edb8a470d0
Python
3,901
99
import numpy as np import tensorflow as tf from roi_pooling_ops import roi_pooling class RoiPoolingTest(tf.test.TestCase): # TODO(maciek): add python, implementation and test outputs # TODO(maciek): test pool_height != pool_width, height != width def test_roi_pooling_grad(self): # TODO(maciek): ...
81e278bc651745f53bb7c67dc5108b96b6a87d770bbeb32a11b8634551601b0c
Python
3,901
115
# Copyright 2021-2022 Huawei Technologies Co., Ltd # # 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 agre...
133a6fea37c00baf44645175f085e73fc6b1203811919c28ea9810f89797784f
Python
3,902
132
#!/usr/bin/env python import sys import os from distutils.dist import Distribution if 'setuptools' in sys.modules or any( s.startswith('bdist') for s in sys.argv) or any( s.startswith('develop') for s in sys.argv): from setuptools import setup as setup from setuptools import Extension else: #...
b40f0a5c96f202fffd2c8193f08f6ec0d32e5ee2a239b10416a8c6cac28b239a
Python
3,902
133
# encoding: utf-8 import os import sys import time import argparse from collections import OrderedDict, defaultdict import torch import torch.utils.model_zoo as model_zoo import torch.distributed as dist from engine.logger import get_logger logger = get_logger() model_urls = { 'resnet18': 'https://download.pyto...
23f8c5e1c1408450f3bc429ff5548c32dfdee0e7159c288af63555ab4df03586
Python
3,903
138
# Copyright 2017 Google Inc. 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 applicable law or a...
5971632d64a0f8ba30adfd856cb07553994a0cf4e46abc0ca5e2aa6bbca138a0
Python
3,903
98
#!/usr/bin/env python import random import argparse from os.path import basename, splitext import HTSeq import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from scipy.stats import pearsonr parser = argparse.ArgumentParser() parser.add_argument("-c", "--chromsize", metavar="FILE", help="Index fil...
a480d19e118fffc3309f251950ab8aa8ba3825fa334d2e9fc4499d558202f329
Python
3,903
117
import connectome_tools.process_matrix as promat import pandas as pd import glob as gl import numpy as np # load whole brain connectivity matrix matrix = pd.read_csv('data/Gadn-pair-sorted.csv', header=0, index_col=0) # import pair list CSV, manually generated pairs = pd.read_csv('data/bp-pairs-2020-01-28.csv', heade...