sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8d66e5aa4b550cbbd45417818f7c224f387ce22ec40f5319c99701eb8c8ca2c7
Python
8,814
214
import math import torch import torch.nn as nn import torch.nn.functional as F class ConvBlock(nn.Module): def __init__(self, in_planes, out_planes, stride=1): super(ConvBlock, self).__init__() self.conv = nn.Conv2d(in_planes, out_planes, 3, stride=stride, padding=1, bias=False) self.bn = n...
5ece0ac8719faa2b1ea383ec3a05bb7cb23e48ca932f124518cd83f924cee552
Python
8,815
272
""" Refer to https://github.com/rosinality/stylegan2-pytorch/blob/master/lpips/networks_basic.py Refer to https://github.com/richzhang/PerceptualSimilarity/blob/master/lpips/lpips.py """ from __future__ import absolute_import import sys import torch import torch.nn as nn import torch.nn.init as init from torch....
22bf951fedb8e5993b2252b8c6137015c46404521d949fcb27c101740b7fe4cc
Python
8,816
232
# 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...
1e875efc651c9fa6df9ab08b6307685441ca140ac23dfa903dfb1c1c8ee69bc7
Python
8,819
210
import tqdm import ipdb import argparse, sys; sys.path.append('../..') import random as rand import torch from metrics import * from graphxai.explainers import * from graphxai.datasets import load_ShapeGGen from graphxai.datasets.shape_graph import ShapeGGen from graphxai.utils.performance.load_exp import exp_exists f...
b5511cd93e0b3b94f5d64fc62438f231dbd23cd9b7d1574383422e4fc7b06e04
Python
8,819
212
# 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...
cf75314370de85298d60f249f05dec18ac3f4eec5a40b79033f0930a72d73b56
Python
8,821
208
# 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...
8a8a0bf24c20683768d57d9be664c4bb52b18dfb62d1088f7ac6f2a32424e294
Python
8,822
319
""" Copyright (c) 2003 Robert L. Campbell Copyright (c) 2010 Thomas Holder Copyright (c) 2013 Suguru Asai Original by RLC, with extensive modifications and improvements by TH. Atom B-factor data generated by ptraj (amber) is supported by SA. Please read below for instructions contains the functions data2b_atom(m...
88ce28365d5dcdf6534ca635a9817710e2f2299958ae995e1d8422f77f3be9f2
Python
8,823
224
# 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...
663d77e83b3058df585e24964f095a9dd8365c55fa16375df330fa366493cc64
Python
8,829
224
from collections import defaultdict from enum import Enum from typing import Any, Dict, List, Optional, Union from pydantic import BaseModel from oaklib.datamodels.obograph import ( ExistentialRestrictionExpression, LogicalDefinitionAxiom, ) from oaklib.datamodels.vocabulary import IS_A from oaklib.interfaces...
707265bb1e12bb8c9d29d1ddcd08fc68ead6e794d11d33fd108e3ab686bc7217
Python
8,831
277
#//============================================================= #//Copyright (c) 2011 G. Gogoshin #//Distributed under MIT-style license. #//(see LICENSE.txt or visit http://opensource.org/licenses/MIT) #//============================================================= # This file defines dependence/independence model...
617308e72b98d500978f164f1c17c768691a3d4352834dd31deaa872c6e0c06b
Python
8,833
262
""" Plot histograms of the cortical temperatures measured during testing in each behavior during cooling The intake data for each behavior should come from the analysis level of the dataset (i.e. the one taken into R for statistics, and in which the major preprocessing has already been done) Version History: -...
71f9867dcec8ed1209df9d4e8772bb260b2057f62a95497dadea35779b19bcbe
Python
8,833
222
#!/usr/bin/env python3 ####################################################################### ####################################################################### ## Created on June 29th 2018 to annotate merged peaks ####################################################################### ##########################...
8f4c2bea4fc179fece6774dd85ba74f669467b3f64ada53997ee2ad2eeb10e5b
Python
8,833
214
""" File: inter_eqtl_zscore_bars.py Created: 2020/03/16 Last Changed: 2020/06/03 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, ...
fb28417b50c7dd71d9cb39971a002b10e1e7bfc4e87d98b24a78e4c20b40adc4
Python
8,835
236
# -*- coding: utf-8 -*- """ Created on Mon Dec 6 23:35:24 2021 @author: Fuyuki Asano """ import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as ticker import sys import os from scipy import signal import csv import math import statistics import scipy #mac #p...
4ffddf3a71529f52a7d7ca422120b106a0b8f8c366c4c9e1839fcc2cf83ddbfb
Python
8,836
219
"""Launch or adopt a carla-cosmos server. Two flavours: * :func:`ensure_server` — the production path: find a container started by us (Docker labels), or ``docker run`` the image with the state directory mounted, then wait for readiness and read the initial token from ``<state>/initial_token.txt``. * :class:`Mo...
e1a3b839b6ce28b02709b38c2293e2963888ada45c17c5d2f95d65ad72db511f
Python
8,840
273
import argparse import cv2 import numpy as np import os import torch import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torchvision.transforms as transforms import torchvision from model.unsupervised_model import Model as orgModel from model.kpt_detector ...
c9b29b4d11bdd1ccf97f9063039ed8fab03b5c5ded7f078feeca002691fb356b
Python
8,841
224
#################################################################################################### # 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 ...
6535d7db121dc2ef5c2ccee6e4f907cd098184c60888bfc7c3e08857e33b445d
Python
8,842
238
# 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...
de1d9f43d64503e12725bbc9ea4d8b49b7a442ec249601d167a1d4f028996c3e
Python
8,843
232
# A modification version from chainercv repository. # (See https://github.com/chainer/chainercv/blob/master/chainercv/evaluations/eval_detection_voc.py) from __future__ import division import os from collections import defaultdict import numpy as np from maskrcnn_benchmark.structures.bounding_box import BoxList from m...
92e2ddbd00b98801b7c91a74ae466533ec8d7953d4aafb417c7b32031d75e591
Python
8,845
226
#!/usr/bin/env python3 # # Copyright (c) 2018 Hyeshik Chang # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modi...
3e6f065804e9ef33b133dca3ffd6b8e0ba5ad81b1c93617ecdee8d6e4cb8dac1
Python
8,855
250
# 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...
ee6a4f1810e7dc4377e59af96f1871b620de5cb8daba733259dcc91a4c70fcc8
Python
8,859
323
# %% [markdown] # ## import os import warnings import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.transforms as transforms import numpy as np import pandas as pd import seaborn as sns from joblib import Parallel, delayed from scipy.stats import poisson from sklearn.exceptions import Convergence...
930febde061fb466ee13f468666fe8920d01ba2a19707432a95a187b3e2dd7ef
Python
8,870
238
# coding = utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import gzip import os import re import json import tarfile import ConfigParser from six.moves import urllib from tensorflow.python.platform import gfile import tensorflow as tf import numpy a...
7f29c3d84f45d5efcf27de9fb0685871153e0f47848ae1e4cb952c7a1bbf25dd
Python
8,873
270
"""Visualization functions for phys2bids package.""" import logging import os import matplotlib.pyplot as plt import numpy as np LGR = logging.getLogger(__name__) SET_DPI = 100 FIGSIZE = (18, 10) def plot_trigger( time, trigger, fileprefix, tr, thr, num_timepoints_expected, filename, ...
7fc43528e965feea75f5ee2d2b3c0eec9d5a44a46fe66faff81fdb42411a7a7e
Python
8,878
216
"""The data layer used during training to train a Fast R-CNN network. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch.utils.data as data from PIL import Image import torch from model.utils.config import cfg from roi_data_layer.minibatch i...
62c06349fb20e1c7b687e1cf2bfc3050a3a8e389a42151b0149967409b97216e
Python
8,881
237
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers class Sampling(layers.Layer): def __init__(self, name='sampling'): super(Sampling, self).__init__(name=name) def call(self, inputs): z_mean, z_log_var = inputs epsilon = tf.random.normal( ...
7d80e100c0596abceff494fd4ab1450433ddb390b54418f9de0e8d7cac4f4853
Python
8,881
251
import math import os import sys import numpy as np import pytest from pytest import raises from phys2bids import io @pytest.fixture(scope="function") def loaded_acq_file(samefreq_short_txt_file): chtrig = 2 header_acq, channels_acq = io.read_header_and_channels(samefreq_short_txt_file) # just a few qu...
c990348da813e93d67ca0eab74e4eac7411ff50c0724d27e18312fa108546325
Python
8,887
228
# 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...
d338987751cf989367c520797ac06b1ebc8d53e3a89c0a45750f9363ef9036f8
Python
8,888
222
#!/usr/bin/env python3 """ File: correlate_ct_fractions_to_pcs.py Created: 2021/02/02 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 S...
3033634b399251a44d4e3f0858237a6973e045173b52ac37f07bfef05e75b29c
Python
8,890
243
import gradio as gr from .compute import run_model from .logger import setup_logger, read_logs from .utils import load_ct_to_numpy # setup logging LOGGER = setup_logger() class WebUI: def __init__( self, model_name: str = None, cwd: str = "/home/user/app/", share: int = 1, )...
3d55aa30dc40207724ddc0b5a220f9b6f1a95a7ccc16731cc00a78763755686d
Python
8,891
318
from math import prod import pytest import torch import torch.nn.functional as F from tensorly import tenalg from neuralop.models import FNO tenalg.set_backend("einsum") @pytest.mark.parametrize("n_dim", [1, 2, 3, 4]) @pytest.mark.parametrize("fno_block_precision", ["full"]) @pytest.mark.parametrize("stabilizer", ...
6418658b69b06011eb3e69b4d05f932853759b53071ee510336ef720d62a735e
Python
8,894
247
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import json import numpy as np from logging import getLogger from .model import update_predictions, flip_attributes from .util...
0098eb243a711ba09fa0c3ec37ba7ec170cf8cae2d3c35f0f8aa16e1b7903848
Python
8,895
266
import torch import torch.nn as nn import torch.nn.functional as F class TranslationModel(nn.Module): def __init__(self, vocab, config): super().__init__() self.vocabulary = vocab if hasattr(config, "use_tanh"): self.use_tanh = config.use_tanh else: self.us...
b7592f08607bda706f9518985ca15de47b2ee8be7de3bc8ff14a377c1fcf4b79
Python
8,895
239
import time import itertools import scipy import scipy.stats import numpy as np import math from PIL import Image as PIL_Image from keras.preprocessing import image from keras.models import load_model from recurrent_rsa.rsa_utils.image_and_text_utils import index_to_char, char_to_index from recurrent_rsa.rsa_utils.conf...
ec02d7755846c611a9ecf65bfce959ba2976fd71ce76e30720dbf3313c0c85f5
Python
8,895
224
import random, sys from typing import Union, List import os from networkx.classes.function import to_undirected import networkx as nx import ipdb import torch import numpy as np import matplotlib.pyplot as plt import torch.nn.functional as F from numpy import ndarray from torch_geometric.utils import to_networkx from t...
36b136b7eef0e2a930d009080ddef6e9eaa7b823d1a5c0d89638a78bc27ef31f
Python
8,903
253
import logging import numpy as np import torch from torch.nn import functional as F from scvi import _CONSTANTS from scvi._compat import Literal from scvi.core.data_loaders import AnnotationDataLoader from scvi.data._anndata import get_from_registry from .inference import UnsupervisedTrainer from .trainer import Tra...
c05ae96958f54010caa8fc76f830614d8dcab1fd86c0f279f57f54a5c3e36eaa
Python
8,903
247
# 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...
afd5095260d259e941a120a06214f7c6dc16c3c5b33bfa6febe2c540e51810c4
Python
8,908
266
# Copyright 2023 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...
b258c9ea90ec2749cecff8b0ca1cbf8d07dd7dc916adc288f7dcaa290344e7d7
Python
8,910
160
import os, sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing import h5py from tqdm import tqdm from functools import partial import numpy as np from scipy.spatial.distance import euclidean...
e1ba787d817933131db14a6fa87cb3198248103e52446cb183da39ffa087c41d
Python
8,910
273
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import os import numpy as np from numpy.testing import assert_array_equal import pytest from eelbrain import Dataset, Factor, Var from eelbrain._exceptions import DefinitionError from eelbrain.pipeline import * from eelbrain.testing import assert_dataobj_equal,...
e788da1edc9185edc4b29dcbe7dd6fb803bf72954174868451e01e0ab8ca82e0
Python
8,911
182
#! /usr/bin/env python3 """7-camera world-scenario demo: capture with the NVIDIA AV rig, export the ClipGT scene package, submit it to Transfer 2.5 auto/multiview (``hdmap_bbox``) and, optionally, the front camera to Cosmos 3 as a ``wsm`` control. python av7_world_scenario.py --port 2000 --seconds 3 --out ./clips ...
48e08bcefb5871953689bbeb6142c1bdf5a418ec209d6a754c025c10f32959a3
Python
8,914
211
import mne import numpy as np import matplotlib.pyplot as plt import os from mne.preprocessing import ICA from autoreject import get_rejection_threshold from autoreject import (AutoReject, set_matplotlib_defaults) ## logging info ### import logging from datetime import datetime logname = './logs/' + d...
5a20414cfca161e9bbb68ab01f07a5fd73b020ee2d881687e6e70500461b3f44
Python
8,916
269
import argparse import torchvision.datasets as datasets import torchvision.transforms as transforms import torch.optim as optim import pickle import datetime from netClasses import * from netFunctions import * from plotFunctions import * parser = argparse.ArgumentParser(description='Updates of Equilibriu...
ad0989d9ea6c3528911cdd7022744824bc849b041836a525a200fb7ced8ab00a
Python
8,920
185
"""Build the reviewed optical-detail revision from the detail master. Reflector proportions follow the local original-generation headlight photograph. These surfaces approximate visible construction; they are not optical CAD. """ import bpy import bmesh import json import math import os import numpy as np from pathlib...
94c2aab19a8f6ebc6b8c2f5ca790064dee9e42720ff425435d1ed2f15e86039f
Python
8,924
244
import torch import torch.nn as nn from mol_tree import Vocab, MolTree, MolTreeNode from nnutils import create_var, GRU from chemutils import enum_assemble import copy MAX_NB = 8 MAX_DECODE_LEN = 100 class Motif_Generation_dfs(nn.Module): def __init__(self, vocab, hidden_size, device): super(Motif_Gener...
29fc6418f26b041d65943c057fbcf5bf32a9cc71d2b3882e550ae41758c06306
Python
8,925
296
""" This module provides the `Sequence` class. This class is the abstract base class for biological sequence collections (e.g. genomes). """ from abc import ABCMeta from abc import abstractmethod import numpy as np from ._sequence import _fast_sequence_to_encoding def sequence_to_encoding(sequence, base_to_index, ...
addd72837ed25549c88a8e559247b07bd44ef7f3d14a95577fa5f5260d692111
Python
8,925
303
""" Training an FNO on Darcy-Flow ============================= We train a Fourier Neural Operator (FNO) on our small :ref:`Darcy-Flow example <sphx_glr_auto_examples_data_plot_darcy_flow.py>`. This tutorial demonstrates the complete workflow of training a neural operator: 1. Loading and preprocessing the Darcy-Flow ...
942cafb524386dec805d3b92eba474f07ae423626da0b8c09ed495044d156eec
Python
8,927
240
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from layers import * from data import voc, coco, tt100k, tt100k45 import os class SSD(nn.Module): """Single Shot Multibox Architecture The network is composed of a base VGG network followed by the added ...
75b4467729593791e3292df9d991ccfc28276647e40d1152ad2dad4fb6640881
Python
8,928
250
import torch import numpy as np from scipy.special import expit from scipy.integrate import odeint class Network(torch.nn.Module): def __init__(self, items_n, h1_size, w1_weight_std, w2_weight_std, non_linearity=torch.relu_, readouts=1): """Two-layer neural network to calculate the pairwise relationships ...
66a127937548bfddb9da77b5fb120f4c543fd981441a9980f4c9e1f044348dd3
Python
8,933
194
# 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...
76f2bcd0b86af16ae81ef942fa83a0cc9345caf775819e5e916279a4f49ae0b4
Python
8,945
209
# 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...
0e3bc84d95c21ce493b7e43a215452b4f027b48d7dadab2c23f49bf53f5c1009
Python
8,946
290
#%% Load from operator import itemgetter import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import seaborn as sns from graspy.cluster import KMeansCluster from graspy.embed import LaplacianSpectralEmbed, OmnibusEmbed from graspy.models import DCSBMEstimator from graspy.plot im...
f520fe73c3cfa495dfe4c1979b6b84f374dd489ac1ed4cb2ed4af8ca70c35f6f
Python
8,951
259
#!/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>. """ Configure and inspect an instance of CARLA Simulator. For further detail...
df4c9928b3927ea90c2a1fad362559f980708206383887e2bb59a629bcd62ff2
Python
8,952
213
import os import multiprocessing from joblib import Parallel, delayed from gpuparallel import GPUParallel from gpuparallel import delayed as GPUdelayed import numpy as np import mne import torch from torch.nn import Linear, ReLU, Conv2d, MaxPool3d, Module import torch.nn.functional as F from RV.model.utils.smoothi...
606f1fb90a205f6122f3cfb5b149c9a8ae1f96447437827db1283757d32bd329
Python
8,955
273
""" function plot_unpaired_data_for_Magnum INPUT: - csv file containing behavioral data with cross-referenced temperature values for each trial OUTPUT: - Figure with two axes showing: 1. Bar plot of overall performance ( correct) for each noise condition in cooled and control testing, with individual session ...
6315f06d37d2db75ad0e3984ce2295c0419485e7c5cbe8e57619c67a62abfdb1
Python
8,955
231
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Variational Animal Motion Embedding 1.0-alpha Toolbox © K. Luxem & P. Bauer, Department of Cellular Neuroscience Leibniz Institute for Neurobiology, Magdeburg, Germany https://github.com/LINCellularNeuroscience/VAME Licensed under GNU General Public License v3.0 """ ...
2c7eb7a94202fba7cd6a1f5a1b09cc0f39e2ef60c542e93d3a1243f147f1b5b6
Python
8,959
158
import os, sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing import h5py from tqdm import tqdm from functools import partial import numpy as np from scipy.spatial.distance import euclidean ...
2f54751d5c6e3bbbfb3efc4835eb038743b5e165cc286fe59accb4bdab8e08cc
Python
8,960
198
# 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...
7aefccf85d71d94caaa5649b537a50a060a834b49490fed8f958429d22cf501f
Python
8,960
228
import torch from torch_geometric.data import Data, Batch class BatchMasking(Data): r"""A plain old python object modeling a batch of graphs as one big (dicconnected) graph. With :class:`torch_geometric.data.Data` being the base class, all its methods can also be used here. In addition, single graphs c...
84760a3eda562fdb6d5721fa39d888d4f71c7ae959334cb5db9f10fdd78932e1
Python
8,969
271
from ase.md.langevin import Langevin from ase import units from ase.md.velocitydistribution import MaxwellBoltzmannDistribution from ase.io import read, write, Trajectory import numpy as np import torch import sys import glob import toml import argparse from pathlib import Path import logging from PaiNN.data import A...
a11337b1b028197b7917ab256a7e25c2309ce1a64634ef714dd8bcc6737f4147
Python
8,969
242
import argparse import glob import os parser = argparse.ArgumentParser(description='Generate featureCounts files.') parser.add_argument('cram_base_directory', help='Directory with cramFiles') parser.add_argument('jobs_directory', help='Directory to write jobs to') parser.add_argument('output_directory', help='Outputdi...
e2baef50d5c4cad51517d9283c3bf021910840b10afc19b4f09ae1ec323aa395
Python
8,969
223
# Model validation metrics from pathlib import Path import matplotlib.pyplot as plt import numpy as np import torch from . import general def fitness(x): # Model fitness as a weighted combination of metrics w = [0.0, 0.0, 0.1, 0.9] # weights for [P, R, mAP@0.5, mAP@0.5:0.95] return (x[:, :4] * w).sum(...
df784318c6f7f3b57552bf81630c81670bbe5dee6c7ec492b7cf44d8d2537c25
Python
8,970
221
import os from os.path import join import numpy as np import pandas as pd from collections import OrderedDict from itertools import chain from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import ShuffleSplit from sklearn.model_selectio...
c307532a15ad3607abf70c6adebd18993bd6c512ce721262505a9ee939e06aae
Python
8,972
176
""" Copyright Dejan Kostyszyn 2019 This method trains the network. """ import ReadData as rd import numpy as np from matplotlib import colors import torch, os, nrrd, time from model.UNet import UNet import matplotlib.pyplot as plt from options.test_options import TestOptions import utils, csv, sys from os.path import...
1cefbf9359722c5c5f12bf0a50762546eeb48d240214ed2ccf1b68d6055337ea
Python
8,973
278
import torch.nn as nn import torch.nn.functional as F from utils.function import FakeQuantize import math def calcScaleZeroPoint(min_val, max_val, num_bits=8): qmin = 0. qmax = 2. ** num_bits - 1. scale = float((max_val - min_val) / (qmax - qmin)) zero_point = qmax - max_val / scale ...
fe35748eeae55dc0a8d6a46b8727c3fb667655ca21187ba0908986e1ddb0d1bf
Python
8,975
252
""" File: settings.py Created: 2020/06/29 Last Changed: 2021/11/22 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 versio...
8615f12979c2bc1ef9ca7b999b2f065477846825d55b4197884674e1739fa4ad
Python
8,978
221
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # 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...
44970b38e67bce15e8f5cafa0270d46c5d145b55e4c3377c81c3761721b1b801
Python
8,979
175
# Copyright 2020-21 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...
67734c5f444b456874d518b405512283dae462d77adf4fc9c11166cf93b27ef9
Python
8,982
228
#!/usr/bin/env python3 """ @ Lina Teichmann INPUTS: call from command line with following inputs: -bids_dir OUTPUTS: - plot showing percentage of data we lost after preprocessing - plot showing the time-resolved euclidean x/y coordinates from the central fixation - plot showing the ...
f81b991e3cb3d653670ced5aeb3fa93213108bb8d2e523117e9bdf2671abbde6
Python
8,985
242
from math import sqrt import torch from tqdm import tqdm import matplotlib.pyplot as plt import networkx as nx from torch_geometric.nn import MessagePassing from torch_geometric.data import Data from torch_geometric.utils import k_hop_subgraph, to_networkx sys.path.append("..") EPS = 1e-15 class GNNExplainer(torch....
a6049d494658b4f7d52a242da934866089edf561565c0bcabb97108a58a7fc29
Python
8,988
278
# Based off code from: https://github.com/google-research/reverse-engineering-neural-networks/blob/master/renn/rnn/fixed_points.py import torch from torch import nn import torch.nn.functional as F import numpy as np import copy from scipy.spatial import distance class fixedPointNetwork(nn.Module): """ Cre...
3b58bcfb3657506e2d4b779978af672141e2c38870a6faca99c532e48f97c562
Python
8,990
243
import logging import time from dataclasses import dataclass from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple import requests_cache from oaklib.datamodels import obograph from oaklib.datamodels.association import Association from oaklib.datamodels.search import SearchConfiguration fro...
a8dce281f3a679e7ed908bfea9325be684d011a8dd6d2b7f41a7550764fe7cc4
Python
8,993
227
import torch from torch import nn import torch.nn.functional as F from .channel_mlp import LinearChannelMLP from .segment_csr import segment_csr class IntegralTransform(nn.Module): """Integral Kernel Transform (GNO). It computes one of the following: (a) \\int_{A(x)} k(x, y) dy (b) \\int...
8a591cd698020231a30f4709ffbfca371a27ef69c0f09de882eae206ee7a48ed
Python
8,994
221
import os from os.path import join import numpy as np import pandas as pd from collections import OrderedDict from itertools import chain from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import ShuffleSplit from sklearn.model_selectio...
adbb6614ad51d0364d19f750f50c14dbb8b51c145dc88ae86d2af4403a09d965
Python
8,995
233
import argparse import os import numpy as np import pandas as pd import vtk from collections import defaultdict from vtk.util.numpy_support import vtk_to_numpy, numpy_to_vtk import pymetis from glob import glob # Seed for reproducibility np.random.seed(42) def read_vtk_mesh(file_path): reader = vtk.vtkPolyDataRea...
f5814111e603add64a3476441a848e137160b705eb76b2604143fe0f0ea4e5eb
Python
9,000
176
# 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...
7f27f396450337732b6748aaefbeb335ef0f83b33da7ba197cede25a8e838c6b
Python
9,001
219
from __future__ import absolute_import # -------------------------------------------------------- # Faster R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick and Sean Bell # -------------------------------------------------------- # ---------------...
fd6cc42a35005720f22b890a4fdeed54bea2dd8396e36edad2eccf1140e9ae1b
Python
9,006
282
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 2 14:32:25 2021 @author: antonio """ import warnings import itertools def warning_on_one_line(message, category, filename, lineno, file=None, line=None): return '%s:%s: %s: %s\n' % (filename, lineno, category.__name__, message) warnings.forma...
74f94a4a08d5746b11f765610d922f1a1c27303a7cd3886e10f55e7a3a3f2f07
Python
9,007
209
# 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...
ca4fa9819eea9f75b1bec06c0743f947c2d0d5b9160dc1f71c14b451ffafa3dc
Python
9,012
242
# 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...
339df828874e65fc35f96e37d430959bb49ef36fec1ce592d56766e0399eab8e
Python
9,014
243
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np class FastSal(nn.Module): def __init__(self, classes=2, aux=False, pretrained='MobileNetV2_pretrain.pth'): super(FastSal, self).__init__() self.context_path = MobileNetV2(pretrained) if pretrained is not ...
bd8344cfc19de32679bdedf6238b2fbf595b666d1eb8a1ec993e94e090fae8ef
Python
9,016
342
import argparse import gzip import tabix import math def main(): parser = argparse.ArgumentParser(description='LiftOver utils.') parser.add_argument('--mode', choices=['gwastobed', 'liftovergwas','updatetrityperpos','updatetrityperrsid'], help="Type of program to run", required=True) parser.add_argument('--in...
4e3d447fab1524bd17b13646a8f5a7b2b03f156956dc73fa17c99cd525426a80
Python
9,023
240
import os try: # for Python2 import Tkinter as tk import tkFileDialog except ImportError: # for Python3 import tkinter as tk from tkinter import filedialog as tkFileDialog import webbrowser from bruker2nifti.converter import Bruker2Nifti from bruker2nifti.__init__ import __version__ as versio...
22c7800515db33d94e9f08a920255ce2c6e38c126dc495e9fd00c3901b95ed29
Python
9,024
294
import numpy as np import imageio import PIL.Image as pilimg import tensorlayer as tl __all__ = [ 'get_img3d_fn', 'rearrange3d_fn', 'get_and_rearrange3d', 'get_img2d_fn', 'get_lf_extra', 'lf_extract_fn', 'write3d', 'normalize_percentile', 'normalize', 'normalize_constant', ...
29573d94de13008cf104eaa120f949a94f1af7c314f3d93d42e17a39b088957d
Python
9,025
239
#################################################################################################### # 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 ...
5354b7b354c421799336cf3b8644577d0b87f5e4fff631ea72cc6abc70bd948b
Python
9,027
315
import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import seaborn as sns from graspologic.plot import heatmap from mpl_toolkits.axes_grid1 import make_axes_locatable from seaborn.utils import relative_luminance from pathlib import Path from .theme import set_theme from .utils import bound_text...
e9fcb249334a1d7e4d424db85f125d633b4d05f98856f727b830aceca8241b35
Python
9,031
385
# %% [markdown] # ## import os import time import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import scipy import seaborn as sns from graspy.match import GraphMatch from graspy.plot import heatmap from graspy.simulations import sbm from src.data import load_metagraph from src.graph import pre...
e28de2ed617f1f0e04b276caac149d19dd92fed95d1f4f46976194cf4e68b39d
Python
9,032
211
''' Definitions of geometrical objects. ''' import numpy as np from mesh.operate import transform def ellipsoid_create(name, position=(0, 0, 0), lengths=(1, 1, 1), axe1=(1, 0, 0), axe2=(0, 1, 0), velocity=(0, 0, 0), ...
f7a7abde133f8c3c92fb067188e6d73e8cdd9169a862cf1a21f387d76a4b2432
Python
9,032
218
#!/usr/bin/env python3 # Copyright 2020 Maxim Korenevsky (STC-innovations Ltd) # Apache 2.0. import argparse import os import numpy as np from sklearn.cluster import k_means import kaldi_io import scipy from sklearn.cluster import SpectralClustering ''' Spectral Clustering based on binarization and automatic th...
36320ade6fce2295c36c9e5d3cb01c7f7a8a6655d46287380d5e94e7dea07842
Python
9,034
229
""" Normalization Layers ==================== This tutorial demonstrates normalization layers designed for neural operators. Normalization is crucial for: - Stabilizing training dynamics - Accelerating convergence - Improving generalization - Handling different data distributions The tutorial covers `InstanceNorm`, ...
979924cdf642bea68e3ee01ec33f725f9f9d2b779f91806b9818d3500b7d078b
Python
9,035
211
# Copyright 2020-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...
be5be9233058ad728f21bdb69547262b86a5f146aeab657dc4681bf8b172ecc4
Python
9,035
191
# This file is part of me-features-to-mol-ID-mapping. # # # Copyright © 2021-2022 Blue Brain Project/EPFL # # # This program is free software: you can redistribute it and/or modify # it under the terms of the APACHE-2 License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANT...
da7e1ea3d99e7605719a968217f447ccbc79c6a054458005d57bc9d79f88048d
Python
9,036
261
import datetime import numpy as np import os import re import shutil from utils.SGCN.common import names def path(parts): return os.path.join(*parts) def mkdir(p, overwrite=False): if os.path.exists(p) and overwrite: shutil.rmtree(p) if not os.path.exists(p): os.makedirs(p) def parse_...
d726945f2403ed5127634594958b43f667748bf8515ba9a2665af4b3fb78a7b1
Python
9,037
264
import os import copy import numpy as np import pandas as pd import math import random import matplotlib.colors as colors from sklearn.model_selection import train_test_split from sklearn.decomposition import PCA from siVAE.data import data_handler as dh from siVAE.util import reduce_dimensions fro...
568ac22639556523abb2dd42d359afe894063bf2591682dcf18432f169f3fb88
Python
9,040
264
import os,gc import copy import numpy as np import pandas as pd import math import random import matplotlib.colors as colors from sklearn.model_selection import train_test_split from sklearn.decomposition import PCA from siVAE.data import data_handler as dh from siVAE.util import reduce_dimensions ...
684edd50cba29b09a70ff7617ce2107a3fdba9e0adab19bb246d2748f6247485
Python
9,041
225
import numpy as np from ase.data import atomic_numbers from scipy import linalg from sklearn.metrics.pairwise import euclidean_distances, cosine_distances def div_mat(mat, n): split_mat = [] div_1, mod_1 = divmod(mat.shape[0], n) div_2, mod_2 = divmod(mod_1, div_1) for i in range(mod_2): split_...
a0cb6da3fb9795c6333625487a788287afad8fbfa52865d6cba29b8d7141700d
Python
9,046
280
''' @author: Mahbub Ul Alam (mahbub@dsv.su.se) @version: 1.0+ @copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se) @license : MIT License ''' import numpy as np import pickle from torch.utils.data import WeightedRandomSampler, DataLoader, TensorDataset import pandas as pd import torch def load_train_...
acc114fb04cc08208523e69b4e34e3895f1c33d0d85fc9e33f02fe6ae2d0d596
Python
9,048
222
#==============================================================================# # Author: Dominik Müller # # Copyright: 2020 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
f73fc1ad3d76fac3765f454d1774f6fa5558c2609a3ed6225c382148e1480c99
Python
9,051
208
# Ranger deep learning optimizer - RAdam + Lookahead + Gradient Centralization, combined into one optimizer. # https://github.com/lessw2020/Ranger-Deep-Learning-Optimizer # and/or # https://github.com/lessw2020/Best-Deep-Learning-Optimizers # Ranger has been used to capture 12 records on the FastAI leaderboard. # Th...
9fd444a9528735d8492eecd8b2c65b6e1ab87dbe4e7c188e51cf11d1faaa582a
Python
9,056
292
import pandas as pd from os import mkdir, path from shutil import move from pathlib import Path from datetime import date import sys from SVRecords import SVGrouper, SVAnnotator def make_exon_gene_set(protein_coding_genes): df = pd.read_csv(protein_coding_genes, sep="\t") return set(df[df.columns[5]]) def ...