sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2724646e5fd58ec0a012493ec6a7bf38ca9a53dbe7ff34b80f4a5b2892b5adbd | Python | 15,785 | 380 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 22 22:22:33 2022
@author: tungdang
"""
import pandas as pd
import numpy as np
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from collections.abc import Mapping, Sequence, Iterable
from functools import partial, reduce... |
836cde2c64f63f5d2671f659aa4ba27692a799d4e003c23507b22ca050bc6441 | Python | 15,792 | 408 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from copy import deepcopy
from typing import Callable, List, Optional, Tuple, Union
import torch
import torch.distributions.transforms as torch_tf
from t... |
21e8548b50b587e95eb5debae5b0f36572b2a4e2256f2e494cc15389421e22f1 | Python | 15,796 | 285 |
random_seed = 234
from utils.rnd import set_random_seeds
set_random_seeds(random_seed = random_seed)
from pipeline.crossvalidation_pipeline import CrossvalidationPipeline
from pipeline.one_split import OneSplitPipeline
from utils.logs import set_logging
import logging
import datetime
import imp
import os
import sys
... |
7017a400e512ff7b71475fa917d69dcc4ec34bf74581addd3be953bcb93e83dd | Python | 15,796 | 318 | import tensorflow as tf
import numpy as np
import jax.numpy as jnp
from einshape import jax_einshape as einshape
tf.config.set_visible_devices([], device_type='GPU')
def serialize_element(equation, cond_k, cond_v, qoi_k, qoi_v):
'''
equation: string describing the equation
cond_k: condition key, 3D, (nu... |
2cf189f38eddf686f718db3e9037b61931f9194ee7d6228fe2c478ba08df1c1a | Python | 15,823 | 467 | import sys
import argparse
import numpy as np
import os
import pickle
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
from scipy.spatial.distance import pdist, squareform
# from model.Model_amp import *
# from model.Model_acp import *
from Model import Model
from math import pi
import pandas as pd
def load_amp(dir):
am... |
efcfc7ce7788aafc17578a7a3ee118cd41511f4f40611af8ae5fb8baf1f06de1 | Python | 15,855 | 390 | # ----------------------------------------------------------------------- #
# Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. #
# #
# Software Name: Fast Autonomous Scanning Toolkit (FAST) #
# By: Argonne Na... |
eb745a2f6400c9b8e216304a65edb579356c6e9d1522d0432180f86d4dbcefce | Python | 15,857 | 387 | #!/usr/bin/env python
import unittest
from os import path
import pandas as pd
import hashlib
import gzip
from picrust2.util import (write_fasta,
read_fasta,
write_phylip,
read_phylip,
three_df_index_overlap_sort... |
74681f4d797a209c41b2c595b198723ce41ce0d373bcb52615b6b0d6f191dee2 | Python | 15,861 | 360 | from phase_to_rate.neural_coding import load_spikes_DMK, rate_n_phase
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import matplotlib as mpl
import shelve
# parameters
phase_bin = 360
time_bin = 250
dur_ms = 2000
phase_bin_pi = phase_bin/180
spatial_bin = (time_bin/1000)... |
10a6995d85bff3584cb97853562a666a7852fe5cbb823661eb5a9b30906dfaed | Python | 15,877 | 411 | from __future__ import annotations
import copy
import pickle as pkl
from itertools import combinations
from typing import ItemsView, Iterable, Iterator, KeysView, List, Union, ValuesView, Dict
import h5py
import numpy as np
import pandas as pd
import torch
from h5py import File
from scipy.spatial.distance import pdis... |
74399e9985176c800a5570aee3c4dc40afaed099381e9379fbe1fac3c6f6dc68 | Python | 15,881 | 360 | from phase_to_rate.neural_coding import load_spikes_DMK, rate_n_phase
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import matplotlib as mpl
import shelve
# parameters
phase_bin = 360
time_bin = 250
dur_ms = 2000
phase_bin_pi = phase_bin/180
spatial_bin = (time_bin/1000)... |
fd0223cdfb3b518e340e87902601ce0f1238579f707d684d462bb6022b8d1099 | Python | 15,886 | 441 | import torch
import torch.distributed as dist
from torchvision import transforms as tvtrans
import os
import os.path as osp
import time
import timeit
import copy
import json
import pickle
import PIL.Image
import numpy as np
from datetime import datetime
from easydict import EasyDict as edict
from collections import Ord... |
b3abdee767ff4ee80616e01223e165a930f64cad2906988961baa79eea91718e | Python | 15,898 | 272 | import subprocess
import time
import numpy as np
import nrrd
from tifffile import imwrite
import sys
from skimage.io import imread
import os
import shutil
import imagej
import json
# TODO: clean up ice clients
#https://stackoverflow.com/questions/41462415/python-communicator-not-destroyed-during-global-destruction
# ... |
8f96d70614d4fb26458594dbc91059711e6b9674c49868822cfc27d0072099c0 | Python | 15,899 | 423 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
import warnings
from typing import Callable, Dict, List, Tuple, Union
import torch
from scipy.stats import kstest, uniform
from torch import Tensor
from ... |
cf342ed29ce59547c751bb9e83f63bdb6f5784d8e0f0c36714dc9a365305d45b | Python | 15,904 | 435 | from inspect import isfunction
import math
import torch
import torch.nn.functional as F
from torch import nn, einsum
from einops import rearrange, repeat
from .diffusion_utils import checkpoint
def exists(val):
return val is not None
def uniq(arr):
return{el: True for el in arr}.keys()
def default(val, d... |
5276ee07c20bffc16f80c976b08359549c139dad2b478eef48d5913e6ff9b1e0 | Python | 15,907 | 505 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
import inspect
from dataclasses import fields
import pytest
import torch
from sbi.inference import FMPE, NLE, NPE, NPSE, NRE
from sbi.inference.posterio... |
fb926d1cc7e8e7e4ca2e60417799f6ad9fa16359f3b1ffd4e5bf3643a28c27d7 | Python | 15,927 | 574 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source... |
f3755b29d13f897d0af4bfba70822b066559583203e84852ac27f97e74d28d4d | Python | 15,942 | 316 | ####################################################################################
# Decode Orders and Algorithms
####################################################################################
from math import log
import random
import numpy as np
import torch
import itertools
from .utils import AMINO_ACID_ORD... |
f57d1b0090e1cd62b59678626b284e8b39807c76d11c31608021e45d9f77f4ca | Python | 15,942 | 335 | ############################################
# imports
############################################
import os
import shutil
import unittest
from oligo_designer_toolsuite.database import OligoDatabase
from oligo_designer_toolsuite.oligo_property_calculator import (
DetectOligoProperty,
DGSecondaryStructureProp... |
52fde7fabadcadc48e5f5f1a6a561e889eef55c38054faccaad596e1e6d1ab20 | Python | 15,948 | 427 | """Calculates the Frechet Inception Distance (FID) to evalulate GANs
The FID metric calculates the distance between two distributions of images.
Typically, we have summary statistics (mean & covariance matrix) of one
of these distributions, while the 2nd distribution is given by a GAN.
When run as a stand-alone progr... |
673895f938518f630298774dfd4636d612193d260e74917cc12761a6d11ba252 | Python | 15,949 | 389 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from copy import deepcopy
from dataclasses import asdict
from typing import Any, Dict, Literal, Optional, Self, Sequence, Tuple, Union
from torch import ... |
01a5e478e3c485a19317b136857a7fb4a498a2116b8a6dc9dde878f773ece707 | Python | 15,960 | 434 | import spacy
import en_core_web_sm as enmodel
# import sqldbutils as dutil
import utils
from os.path import join, exists, isfile
from os import listdir
import sys
import sentence_pattern as sp
import joblib as jl
import json
import numpy as np
from sklearn import cluster
from sklearn.metrics.pairwise import euclidean_d... |
a9386a3d7bc2885b832fd47a9f3c142567d4b8879a21f79ad17d5683d355ceac | Python | 15,978 | 459 | import os
import string
import sys
from p4.var import var
from p4.p4exceptions import P4Error
############################################################################
#
# Token generation stuff.
#
# safeNextTok() # checks for None, and dies
# nextTok() # may return None
#
# Handling comments:
# ... |
aad61bc33d0ee204b0c7848fa002fc5700b56fd5a6eac9c5557e109361af321b | Python | 15,982 | 392 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import mmcv
import numpy as np
import torch
from ..builder import BBOX_CODERS
from .base_bbox_coder import BaseBBoxCoder
@BBOX_CODERS.register_module()
class DeltaXYWHBBoxCoder(BaseBBoxCoder):
"""Delta XYWH BBox coder.
Following the practice i... |
e6bdcb52f4a31ebb85243540444ea32ca27c2b959a5e726e89640bae520104f5 | Python | 15,993 | 402 | from typing import Union, Tuple, Optional, Any
from typing_extensions import Literal
import numpy as np
import eagerpy as ep
import logging
from ..devutils import flatten
from ..devutils import atleast_kd
from ..types import Bounds
from ..models import Model
from ..criteria import Criterion
from ..distances import... |
88f577baa78b3f118b91e53c2c955938e737e3b49159bc15f7ed825d2323d42b | Python | 16,014 | 471 | import sys
import argparse
import numpy as np
import os
import pickle
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
from scipy.spatial.distance import pdist, squareform
# from model.Model_amp import *
# from model.Model_acp import *
from Model import Model
from math import pi
import pandas as pd
def load_amp(dir):
am... |
c466b5919635c94a86badd14843e9aecf807327ef7e01278ad3110cd26b82f70 | Python | 16,015 | 459 | import os
import sys
import math
import string
import p4.func
from p4.p4exceptions import P4Error
from p4.var import var
import numpy
class Numbers(object):
"""Simple 1-dimensional data handling. Emphasis on 'simple'.
Feed this a list of floats, or the name of a file containing
floats. If it is a file... |
9043c8db85bd35817158723cbd7e784060a874ee9ec3a26e17fc48fa4f540dd8 | Python | 16,017 | 508 | #!/usr/bin/env python
import logging
import json
import sys
import time
from typing import Union
from multiprocessing import cpu_count
from Bio.Align import MultipleSeqAlignment
from .args_processing import process_args
from .exceptions import InvalidInputFileFormat, StopCodonValidationError
from .files import (
... |
8ae00c66e57e80370978b4aaf733ecbe8c420562d06b9432f5a2caaa431d7cc6 | Python | 16,025 | 315 | import copy
import logging
import time
import torch
import wandb
import numpy as np
from torch import nn
from .utils import transform_list_to_tensor, Saver, EvaluationMetricsKeeper
class FedSegAggregator(object):
def __init__(self, worker_num, device, model, args, model_trainer, train_data_global, test_data_glob... |
38dbae7ad985ac2efcdfc56ec4c59be6308711bc3224031aff3f56078465084c | Python | 16,061 | 431 | # Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
from typing import Optional, Tuple
import torch
from torch import Tensor, nn
from torchmdnet.models.utils import (
... |
b8a0d98e54c529de6da680291170bb59430cac70a3dd17a5287b2abb7b6499bd | Python | 16,066 | 339 | '''
* Copyright (c) 2022, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
* By Junnan Li
'''
from models.med import BertConfig, BertModel, BertLMHeadModel
from transfor... |
569b0d41dcffdbe7a717d250462184f96ba43029b3b9336982796b8dbcac12a8 | Python | 16,067 | 321 | import logging
import os
import numpy as np
import torch
import torch.nn.functional as F
import torch.utils.data as data
import torchvision.transforms as transforms
from .datasets import ImageFolderTruncated
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# generate the non-IID dis... |
2b7d188f4c5d0047880e40b2c1291b6effc71ae88ae5a3c73852b3ad850754d0 | Python | 16,069 | 498 | import os
import pickle
import copy
import json
from collections import defaultdict
import numpy as np
import random
import torch
from torch_geometric.data import Data, Dataset
from torch_geometric.transforms import Compose
from torch_geometric.utils import to_networkx
from torch_scatter import scatter
#from torch.ut... |
313e6eee1731161cb663dddf5c6970801e697284f2dc38d49c8b91d74dd78776 | Python | 16,070 | 472 | # -*- coding: utf-8 -*-
"""
Code for implementing cross-validation of similarity network fusion. Useful for
determining the "optimal" number of clusters in a dataset within a
cross-validated, data-driven framework.
"""
import numpy as np
from scipy.spatial.distance import cdist
from sklearn.cluster import spectral_clu... |
c01f5fa50c00e445dacd2bd3abe52ca17a7c01a528711eb13a2d96b53c93c6f0 | Python | 16,086 | 433 | import argparse
import json
import os
import pathlib
from operator import itemgetter
import numpy as np
import torch
from PIL import Image
from pytorch_model_summary import summary
from torch import nn, optim
from torchvision import transforms
from ..models.crnn import CRNN
from .ctc import ctcBeamSearch
from .datase... |
dc3543c27f50fc7ca7a40df3ec9493d23800d2dba4d5ee50a6c0c168efb68c9e | Python | 16,096 | 299 | import jax
import jax.numpy as jnp
import numpy as np
import pickle
import haiku as hk
import utils
from dataloader import Data
from einshape import jax_einshape as einshape
from absl import logging
import jax.tree_util as tree
from flax.core import FrozenDict
def update_dict(params1, params2):
assert type(params... |
28ba93d4f3db3442ab27d6bda3537ff6f8183e524ea955a3d80d91931b0e5135 | Python | 16,163 | 436 | # -----------------------------------------------------------------------------
# Adapted from https://github.com/anibali/h36m-fetch
# Original license: Copyright (c) Aiden Nibali, under the Apache License.
# -----------------------------------------------------------------------------
import argparse
import os
import... |
0c5eeaac44c0d7ad9f4f650971e4be787ea55bdfdcbfd10226b4ea449dc38e9e | Python | 16,177 | 365 |
import numpy as np
import copy
from .util import TriuToSymm, BMatArr
FINITEDIFF = 1e-8
class _MatElem(object): # abstract
# Returns full matrix
def Matrix(self):
matrix = []
for ind1, atom1 in enumerate(self._atomList):
diagBlock = self._diag.Block(atom1)
zeroBlockWidt... |
01390ce31a03101e18217555818be2a368f4953ea8b39f25a157ac84144bb64b | Python | 16,183 | 498 | # Copyright (c) OpenMMLab. All rights reserved.
"""Tests the Assigner objects.
CommandLine:
pytest tests/test_utils/test_assigner.py
xdoctest tests/test_utils/test_assigner.py zero
"""
import torch
from mmdet.core.bbox.assigners import (ApproxMaxIoUAssigner,
CenterRegion... |
c123f47809f1c8ccb727b872c2a1ac37cc7d2c7977377d70a26aec2f2c3f6bfe | Python | 16,183 | 408 | from torch.utils.data import Dataset
from sklearn.model_selection import KFold
import random
import glob
import pandas as pd
import numpy as np
import csv
import re
import torch
import nibabel as nib
import json
import logging
import datetime
from icecream import ic
from lifelines import KaplanMeierFitter
from sksurv.n... |
aa9c04f89c85595eb0d7102218b5fd518b7d429f614b5fc8c565e767f6cdd4de | Python | 16,192 | 421 | # -*- coding: utf-8 -*-
'''
* Software License Agreement (AGPL-3 License)
*
* OpenViBE
* Copyright (C) Inria, 2006-2019
*
* Authors
*
* 2019, Yannis Bendi-Ouis <yannis.bendiouis@gmail.com>
* 2019, Jimmy Leblanc <jimmy.leblanc01@gmail.com>
*
* This program is free software: you can redistribute it and/or mod... |
506b0566caff859ed774d36cead21e92e5cc7d387b4890671ee8e53d17c8107b | Python | 16,200 | 398 | #coding: utf-8
from time import time
from tqdm import tqdm
import os
import numpy as np
import pickle
import copy
import rdkit
from rdkit import Chem
import torch
from torch_geometric.data import DataLoader
from torch_scatter import scatter_add
from confgf import utils, dataset
class DefaultRunner(object):
def... |
b3d958b1a99836b990365a56b2510ceac4127677e9917d9692a20c6e8a80fa27 | Python | 16,200 | 456 | # Copyright (C) 2022-2025 ETH Zurich, Marc Lehner and other DASH contributors.
from __future__ import annotations
from typing import Dict, List
import numpy as np
import pandas as pd
from copy import deepcopy, copy
from serenityff.charge.tree.atom_features import AtomFeatures
class Node:
def __init__(
... |
2b3fa1ac6ee3be077054e22b91b5e0a1e8016022fe45db3a4b2b8a5da65af65c | Python | 16,201 | 441 | from functools import wraps, partial
import time
import haiku as hk
import optax
import jax
import jax.numpy as jnp
import matplotlib.pyplot as plt
import io
import tensorflow as tf
import jax.tree_util as tree
import os
import json
import pytz
from datetime import datetime, timedelta
import re
import numpy as np
impor... |
fe1ac2ec3bd4bed07c69ab822de25f961788700c46005750da386cd1d8953ebf | Python | 16,207 | 537 | import torch.utils.data as data
from PIL import Image
import os
import os.path
import random
def _make_dataset(dir):
"""
Creates a 2D list of all the frames in N clips containing
M frames each.
2D List Structure:
[[frame00, frame01,...frameM] <-- clip0
[frame00, frame01,...frameM] <-- clip... |
96842c7ab2a7ff91163ad484ad24957bd2edb75842b0d37f693dd768fa80cf93 | Python | 16,239 | 484 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os.path as osp
import tempfile
import mmcv
import numpy as np
import pytest
from numpy.testing import assert_array_almost_equal
from mmpose.core import SimpleCamera
from mmpose.datasets.pipelines import Compose
H36M_JOINT_IDX = [14, 2, 1, 0, 3, 4, 5,... |
46129382590269ccf51c803b457022944fb1cdb42b1351843b945f236ee14f3e | Python | 16,246 | 394 | from phase_to_rate.neural_coding import load_spikes_DMK, rate_n_phase, load_spikes
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import matplotlib as mpl
import sys
from copy import deepcopy
# parameters
phase_bin = 360
time_bin = 250
dur_ms = 2000
cycle_ms = 100
phase_b... |
b1883881e0acce0d8eb2d10a6559afe2ba3ccff5563ccf3cebd6182a7721a896 | Python | 16,256 | 424 | import numpy as np
import matplotlib.pyplot as plt
import pdb
from numba import jit
class Tempotron:
"""
A class representing a tempotron, as described in
Gutig & Sompolinsky (2006).
The (subthreshold) membrane voltage of the tempotron
is a weighted sum from all incoming spikes and the
resting... |
33d9993b6931226c6fceef916e08ccf30b845e1e0f4789a5a781299271a3b79a | Python | 16,271 | 331 | import scipy.io as scio
import dgl
import torch as th
import networkx as nx
import matplotlib.pyplot as plt
import argparse
import numpy as np
import copy
from csutil.csgraph import Elastic_Graph
##
def dt(h,lgdif_locini,lgdif_locnei):
n = len(h)
dtemp = np.zeros(n) #
v = np.zeros(n) #
z ... |
94693001b4ba9e9c9c10f0c90e5cf2d7698bbd77115aaa902c95c30e3e52b4aa | Python | 16,338 | 406 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from ..builder import NECKS
class Transition(BaseModule):
"""Base class for transition.
Args:
in_channels (int): Number of input ch... |
eeefc65f5aa061e45a30d0a59cd35d619a3c1b116932b3f99f84c0a362b81641 | Python | 16,364 | 385 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops import DeformConv2d
from mmcv.runner import BaseModule
from mmdet.core import multi_apply
from mmdet.core.utils import filter_scores_and_topk
from ..builder import HEADS
fro... |
cac0c2cf30e0863538243244dd2dc9c81a8518a67f50d7e27e225f28d399c892 | Python | 16,398 | 387 | from typing import Tuple
from statistics.mlp_output_wrappers import *
from statistics.dataframe_validation import *
from statistics.utilities import CONFIG
from statistics.dataframe_validation import *
from sklearn.metrics import confusion_matrix
import pandas as pd
import numpy as np
import seaborn as sns
import matpl... |
5ace44a2fca73c29a6de47d17c9e6e628466a90567c0985ca61ac5082ae4330f | Python | 16,399 | 341 | """test_models.py
This file is part of the test suite for keras2c
Implements tests for full models
"""
#!/usr/bin/env python3
import unittest
import tensorflow.keras as keras
from tensorflow.keras import models
from tensorflow.keras import layers
from tensorflow.keras.layers import Input, Dense, LSTM, Conv1D, Conv2D,... |
66cfd6115d0f0e3d0f29231cb6a4a3504481525b096d2016d0d0a885d81359d0 | Python | 16,412 | 476 | # -*- coding: utf-8 -*-
"""
Processing
==========
This module contains low level processing routines
author: Damian Wilary
email: dmw51@cam.ac.uk
"""
from __future__ import absolute_import
from __future__ import division
from collections.abc import Container
import copy
import numpy as np
from typing import List
impo... |
538c7b32d33bbf02b5ac1b0cb51a45c1867aac102a753af7cc365a5faf6c7c27 | Python | 16,440 | 328 | import argparse
import logging
import os
import random
import socket
import sys
import traceback
import numpy as np
import psutil
import setproctitle
import torch
import wandb
from mpi4py import MPI
# add the FedML root directory to the python path
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../.... |
0dd40ff0506d9c0b7cb46e9a689df69ae82f0eed3a246d0fd633a60951247de0 | Python | 16,441 | 259 | import argparse
import glob
import os
import random
from datetime import datetime
import numpy as np
import torch
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.loggers import TensorBoardLogger
from torch.nn import L1Loss, MarginRankingLoss, MSELoss... |
edef1a96523ab1997a462ada015066a38595f17337205ff11ad2aa354a44dd24 | Python | 16,443 | 351 | import logging, time
import os
import numpy as np
import torch
import shelve
try:
from fedml_core.trainer.model_trainer import ModelTrainer
except ImportError:
from FedML.fedml_core.trainer.model_trainer import ModelTrainer
from .utils import SegmentationLosses, Evaluator, LR_Scheduler, EvaluationMetricsK... |
bc511cdddce1cf4d985a6af91fda457d56a0335f701581bbf45caf7217024b0c | Python | 16,457 | 321 | import torch
from models.perception_loss import vgg16_feat, perceptual_loss
from util.util import grayimg
from . import networks
from .base_model import BaseModel
class Dadgan3chDoublemodModel(BaseModel):
""" This class implements the pix2pix model, for learning a mapping from input images to output images given... |
128c22eee5dacbb4dc3ab0d3914a86b08c7c0ed0113b524819ec1bac45c10070 | Python | 16,458 | 520 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import pytest
from mmcv import Config
from numpy.testing import assert_almost_equal
from mmpose.datasets import DATASETS
from tests.utils.data_utils import convert_db_to_output
def test_animal_horse10_dataset():
dataset = 'AnimalHorse10Dataset'
dat... |
a16fa3de07a22c10b4d6f1cc9575a01fa9fdff0309ab7cadfc6444083d6a87d0 | Python | 16,489 | 351 | # ----------------------------------------------------------------------- #
# Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. #
# #
# Software Name: Fast Autonomous Scanning Toolkit (FAST) #
# By: Argonne Na... |
a937835a9d130c4523d3d692c35adf9bd913229b7b0c398732f642ccb47cc952 | Python | 16,545 | 414 | # Network Models
# Created: 5/21/2021
# Status: OK
# Consider merge into 1 main file
import torch
import torch.nn as nn
import copy
import sys
import matplotlib.pyplot as plt
class _CNN_Pre(nn.Module):
# The Model that will be used for pre-trained model
def __init__(self, drop_rate, fil_num=64, in_channels=1, ... |
63344dcac5f6deb9f719c3aca29683ce9c3c28b45140254d35a931f459d28110 | Python | 16,565 | 360 | import torch
import tensorflow as tf
import os
os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false'
tf.config.set_visible_devices([], device_type='GPU')
from pprint import pprint
import jax.numpy as jnp
import jax.tree_util as tree
import numpy as np
from functools import partial
import haiku as hk
import optax
impor... |
0e87a6ae3cef60adf82e56093b0c40d8b701955e80d96a6a6dd8fc124c542bd6 | Python | 16,607 | 445 | # @author semese
import pickle
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
import torch
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
pd.options.mode.chained_assignment = None
class ObjectDict(dict):
'''
Interface similar to an argparser... |
659ae3f38490763a65eaae63763a0cef86e64ab0962b2decb7460a1da7069645 | Python | 16,613 | 557 | import os
import pathlib
from operator import itemgetter
import torch
from pytorch_model_summary import summary
from torch import nn, optim
from torchvision import transforms
from ..models.crnn import CRNN
from .ctc import ctcBeamSearch
from .dataset import ScaleLabelDataset
def convert_to_rgb(image):
return im... |
4626e9c2b35b49a19beb4e89cdc064e6cab2e1073f3713c4b673bb0566424b9c | Python | 16,646 | 428 | """Neighbor-list and static-input-cache utilities for the AIMNet2 calculator.
Holds :class:`AdaptiveNeighborList` (auto-sizing wrapper over the
nvalchemiops neighbor list), :class:`StaticInputCache` (bounded storage for
static-geometry MD-loop reuse), and the geometry/padding helpers used when
building neighbor matric... |
285b3e37b626138158f922245159fccbfa97fd85c7566fdc13f3b4f2fbfa5729 | Python | 16,680 | 395 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 12 13:38:23 2022
@author: Daniel
"""
from phase_to_rate.neural_coding import load_spikes, rate_n_phase, load_spikes_DMK
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import os
import sys
import matplotlib as mpl
import pdb
i... |
10437112c23ef46a3d85b661095a4f7ff499d930c0a6702ea5578815077b0c26 | Python | 16,700 | 325 | ############################################
# imports
############################################
import os
import random
from pathlib import Path
from Bio.SeqRecord import SeqRecord
from joblib import Parallel, delayed
from oligo_designer_toolsuite.utils import FastaParser, logger
from .._constants import SEPARA... |
6878955c86f67459ad36b75aba81f59a768ec293b8d4feb92d6fc2f2923f58f4 | Python | 16,701 | 535 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from collections.abc import Sequence
import mmcv
import numpy as np
import torch
from mmcv.parallel import DataContainer as DC
from mmcv.utils import build_from_cfg
from numpy import random
from torchvision.transforms import functional as F
from ..builde... |
03df45068d444c2b047955c31fe50660d16a9521dd666093a6e799b937facdbc | Python | 16,703 | 341 | """SAMPLING ONLY."""
import torch
import numpy as np
from tqdm import tqdm
from functools import partial
from .diffusion_utils import make_ddim_sampling_parameters, make_ddim_timesteps, noise_like
class DDIMSampler(object):
def __init__(self, model, schedule="linear", **kwargs):
super().__init__()
... |
cc1ef71babd318e5c819ce5cf924d2f0bd50df99f1b02b2cedf641fabad1f8ec | Python | 16,724 | 460 | # Common helper function
import numpy as np
def crop_center_image_xyz(img, center_pos, patch_shape):
assert np.all(img.shape[:3] >= patch_shape)
indices = []
for n_d in range(len(center_pos)):
shifting = 0
min_ind = center_pos[n_d] - patch_shape[n_d] // 2
max_ind = center_pos[n_d]... |
380be181a25fb1ba687e15df8a750f416d8a1e0fb3aaeadc2361c0ba91e424d3 | Python | 16,729 | 462 | import vtk
import numpy as np
import argparse
import sys
import os
import math
from collections import namedtuple
from utils import *
# parser = argparse.ArgumentParser()
# parser.add_argument('--mesh', help='Insert mesh path')
# parser.add_argument('--out', help='Insert output path+name')
# arg = parser.parse_args()... |
ace39bf5fd31152345f2c2e97085feb2ae924cd6eba1e7894f6f74cabc7531e6 | Python | 16,729 | 393 | import logging
from collections import OrderedDict
import numpy as np
import torch
from torch.autograd import Variable
def _concat(xs):
return torch.cat([x.view(-1) for x in xs])
class Architect(object):
def __init__(self, model, criterion, args, device):
self.network_momentum = args.momentum
... |
ea15f1364d5a78f03de684e7750df76fed21877c04f0a8219d543e1f7e50c32d | Python | 16,741 | 532 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Perform preprocessing and raw feature extraction."""
import argparse
import logging
import os
import librosa
import numpy as np
import soundfile as sf
import torch
import yaml
from... |
0dbe8b73d030da807616dda7f90c355863ca9a878701dcb9a79fe9a103282504 | Python | 16,792 | 500 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
import pytest
import torch
from torch import Tensor, eye, norm, ones, zeros
from torch.distributions import Independent, MultivariateNormal, Uniform, bije... |
2c9518cb1b373c578726f1392344f3dc2648354bb8cfbbece9ddb6e3657a2969 | Python | 16,801 | 522 | import pytest
from pathlib import Path
from clipkit.clipkit import execute
from clipkit.files import FileFormat
from clipkit.modes import TrimmingMode
from clipkit.settings import DEFAULT_AA_GAP_CHARS, DEFAULT_NT_GAP_CHARS
here = Path(__file__)
@pytest.mark.integration
class TestGappyMode(object):
def test_simp... |
cfe940d19e281165c823fe4d5cbb8be164162b3cbe7d41e84cc8dafc357b8ac0 | Python | 16,820 | 449 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import mmcv
import numpy as np
import torch
from mmcv.image import imwrite
from mmcv.utils.misc import deprecated_api_warning
from mmcv.visualization.image import imshow
from mmpose.core.evaluation import (aggregate_scale, aggregate_stage_flip,
... |
e66773fb7e94ebbcd5569449af8f77e5ebc020e61c42085b92acf567fe0cb4e4 | Python | 16,963 | 346 | import matplotlib
matplotlib.use('agg')
# import copy
import logging
import time
# import torch
import wandb
import numpy as np
# from torch import nn
import matplotlib.pyplot as plt
from .utils import transform_list_to_tensor, Saver, EvaluationMetricsKeeper
class FedGanAggregator(object):
def __init__(self, wor... |
cadc8d9e17a4f38c59357fd3f522e151af1ba5bba4c09378d89e9338363ecc29 | Python | 16,978 | 428 | import torch
import torch.nn as nn
import torch.nn.functional as F
from contextlib import contextmanager
from lib.model_zoo.common.get_model import get_model, register
from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer
from .diffusion_modules import Encoder, Decoder
from .distributions impo... |
9094f918856e47d765e2ddf711cf89e53c102afc78427185f6e222e14c0bf828 | Python | 16,979 | 453 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
import logging
import math
import warnings
import pytest
import torch
from torch import eye, ones, zeros
from torch.distributions import MultivariateNorm... |
38899984748fc8594f546eebf11ab10ea34cab474034a23246484a239c6c7c7b | Python | 16,994 | 569 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmcv.utils import ConfigDict
from mmdet.models.utils.transformer import (AdaptivePadding,
DetrTransformerDecoder,
DetrTransformerEncoder, PatchEmbed,
... |
5c3f908403b5b6f33622aa32e8c788de94052a223ac06012cdb7040c000bef9d | Python | 17,029 | 501 | import sys
import os
import p4.func
from p4.var import var
from p4.p4exceptions import P4Error
class DistanceMatrix:
"""A container for distances between sequences (usually).
The numbers are in self.matrix, a self.dim * self.dim list of lists.
There is also a self.names attribute, which is usually for ... |
1b6f88d5475479ca4b4493c29a6bf2a6a356c24c6794879c20577ffe6b0b8767 | Python | 17,042 | 404 | """model.py - Model and module class for EfficientNet.
They are built to mirror those in the official TensorFlow implementation.
"""
# Author: lukemelas (github username)
# Github repo: https://github.com/lukemelas/EfficientNet-PyTorch
# With adjustments and added comments by workingcoder (github username).
import... |
4228ef4ff41625a0bc3d004cff85bd7a6eb82e44b8f64c021e997077d587293f | Python | 17,072 | 537 | #!/usr/bin/env python
# https://github.com/griffithlab/regtools
# /home/yangili1/tools/regtools/build/regtools junctions extract -a 8 -i 50 -I 500000 bamfile.bam -o outfile.junc
# Using regtools speeds up the junction extraction step by an order of magnitude or more
import sys
import tempfile
import os
import gzip
imp... |
2344e42c8590042f5bbd01ee03711816538f8c92b66a8965cffff20e646b8d1d | Python | 17,132 | 397 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdet.core import bbox2result, bbox2roi, build_assigner, build_sampler
from ..builder import HEADS, build_head, build_roi_extractor
from .base_roi_head import BaseRoIHead
from .test_mixins import BBoxTestMixin, MaskTestMixin
@HEADS.register_module()
c... |
464481ef723991fc2c9ab7236def52831e1de3f76b78d662c5c3766555534823 | Python | 17,197 | 537 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 2 13:41:31 2021
@author: baris
"""
import numpy as np
import random
from scipy import ndimage
from scipy.stats import skewnorm
from skimage.measure import profile_line
from scipy import interpolate
from neo.core import AnalogSignal
import quantiti... |
aca538bee3b4fa9d5e7b04159e8c6af963d15890c83664b8f83a4b849634f2e4 | Python | 17,198 | 479 | #mapEnhancerFromFactor.py
'''
PROGRAM TO STITCH TOGETHER REGIONS TO FORM ENHANCERS, MAP READ DENSITY TO STITCHED REGIONS,
AND RANK ENHANCERS BY READ DENSITY TO DISCOVER SUPER-ENHANCERS
APRIL 11, 2013
VERSION 0.1
CONTACT: youngcomputation@wi.mit.edu
'''
import sys
import ROSE_utils
import time
import os
from stri... |
736082cc60442a58fe905f61af35e41e1a59efc02ac66039da126f4c91c20102 | Python | 17,206 | 529 | import pytest
from pathlib import Path
from clipkit.clipkit import execute
from clipkit.files import FileFormat
from clipkit.modes import TrimmingMode
from clipkit.settings import DEFAULT_AA_GAP_CHARS, DEFAULT_NT_GAP_CHARS
here = Path(__file__)
@pytest.mark.integration
class TestKpiGappyMode(object):
def test_s... |
bd2154c2c1221b5437736dfcecd547d92edd46dfd56855d3d56177edca6968e6 | Python | 17,215 | 531 | #!/usr/bin/env ipython
from collections.abc import Callable
from pathlib import Path
import shelve
import pandas as pd
import numpy as np
import scipy.stats as stats
import warnings
with warnings.catch_warnings():
warnings.simplefilter(action="ignore", category=FutureWarning)
import xgboost as xgb
import ligh... |
88cdc42dfbd0379d98987077d65a6de988b6e155c3b5de5988ddf5f3329e2732 | Python | 17,230 | 378 | import os
import torch
from collections import OrderedDict
from abc import ABC, abstractmethod
from . import networks
def get_cpu_state_dict(state_dict):
return {k: v.cpu() for k, v in state_dict.items()}
class BaseModel(ABC):
"""This class is an abstract base class (ABC) for models.
To create a subclas... |
9dbe5cb27b45dd69ef997108046beed6e969ad3e15ecc517ca19373d827937bf | Python | 17,242 | 361 | import os
# from re import L
import sys
import argparse
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler, StandardScaler
import time
import warnings
import torch
from scipy.stats import zscore
import lightning as pl
warnings.filterwarnings("ignore")
HOME = os.path.split(os.path.absp... |
1fbd75293227b22e76c627baeb3badaa330aa74816e701cf25a5ebb40cec7186 | Python | 17,262 | 333 | import torch
from models.perception_loss import vgg16_feat, perceptual_loss
from util.util import grayimg
from . import networks
from .base_model import BaseModel
import numpy as np
class Dadgan3chModel(BaseModel):
""" This class implements the pix2pix model, for learning a mapping from input images to output ima... |
14853351d974baff331328e4db361d1ac302b6303d8e630f620c4474d59ce8c8 | Python | 17,315 | 368 | import os
import argparse
import datetime
import numpy as np
import time
import torch
import torch.backends.cudnn as cudnn
import json
import random
import math
import warnings
from pathlib import Path
from timm.data import Mixup
from timm.models import create_model
from timm.scheduler import create_scheduler
from to... |
00277d704d4408d0860f985608dabe8c28ab44174799711019de13c9edcaa411 | Python | 17,328 | 434 | import json
import os
from torch import optim, nn, utils
import torchvision.transforms as T
from torchvision import datasets, transforms, models
import torchvision
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
import numpy as np
import torch
import pathlib
from PIL import Image
from pytorch_mod... |
9902cbe5ee90a1da2aa3e6f043e8a23dc1f8831193b963785c9af03d5c7bef2c | Python | 17,374 | 436 | from collections import OrderedDict
from typing import Tuple, Union
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
class Bottleneck(nn.Module):
expansion = 4
def __init__(self, inplanes, planes, stride=1):
super().__init__()
# all conv layers have strid... |
66a0e83f5dbf1faa45271604ce9f6595958675495facca32f786de25b3c89816 | Python | 17,413 | 416 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import (ConvModule, bias_init_with_prob, constant_init, is_norm,
normal_init)
from mmcv.runner import force_fp32
from mmdet.core import anchor_inside_flags, multi_apply, reduce_mean, unmap
from ..buil... |
9431ca2ea89399e6142549a87e26b0d199c0ff6a1f9881a4bb1c14bcde68233d | Python | 17,413 | 390 | import math
import warnings
from typing import cast
import torch
from torch import Tensor, nn
from aimnet import nbops, ops
from aimnet.kernels import WARP_CUDA_AVAILABLE, conv_sv_2d_sp
from aimnet.kernels.triton_support import triton_kernels_supported
class AEVSV(nn.Module):
"""AEV module to expand distances a... |
2cafba30a1c370339054ff6bf691963f27b12fc57e15d8b510ee31f63dab2238 | Python | 17,417 | 427 | import os
import shutil
import sys
from pathlib import Path
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE"
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import numpy as np
from genomad import sequence, utils
from genomad._paths import GenomadData, GenomadOutputs
from rich.progress ... |
ab8539ba6b757f021b72bd933d05c19aa9a96afa9895b1d3d17281cd1416ce8c | Python | 17,424 | 402 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source... |
3813a20f9e60f80f8a3a0e4f4c865272e2b6f7c63da0f798249aa4191d20f487 | Python | 17,449 | 412 | # Copyright (c) OpenMMLab. All rights reserved.
from warnings import warn
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, build_conv_layer, build_upsample_layer
from mmcv.ops.carafe import CARAFEPack
from mmcv.runner import BaseModule, ModuleList, ... |
dabe1f1784fb18845c34e935f7e78a38e749d912c2800e2ee1629bb41840fd83 | Python | 17,449 | 266 | import argparse
import math
import os
import random
from datetime import datetime
from functools import partial
import numpy as np
import torch
from pytorch_lightning import Trainer
from pytorch_lightning.loggers import TensorBoardLogger
from torch.utils.data import DataLoader
from selbstaufsicht import datasets, mod... |
ab16026b2ff9c0f26c7a80609c2009c2af4efcf49873f5796a30bb1cf3ff14e9 | Python | 17,450 | 360 | import numpy as np
import pandas as pd
class TraditionalClustering:
"""A class for all semantic clustering algorithms using category lists and phonematic algorithms using rules (
Troyer et al.) """
semantic_categories = pd.DataFrame()
phonematic_pairs = pd.DataFrame()
def initialize_phonematic_li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.