repo_name
stringlengths
8
130
hexsha
list
file_path
list
code
list
apis
list
Sunshine352/adversarial-robustness-toolbox
[ "070bf751aee40eb1b723fa5e24cde55d17978f62" ]
[ "art/defences/spatial_smoothing_unittest.py" ]
[ "from __future__ import absolute_import, division, print_function, unicode_literals\n\nimport logging\nimport unittest\n\nimport numpy as np\n\nfrom art.defences.spatial_smoothing import SpatialSmoothing\n\nlogger = logging.getLogger('testLogger')\n\n\nclass TestLocalSpatialSmoothing(unittest.TestCase):\n def te...
[ [ "numpy.array", "numpy.ones", "numpy.arange" ] ]
brokencuph/diff_pd
[ "e491668995a163b8ff7542d99f0b4e0c0f4ed2df" ]
[ "python/example/print_quadruped_3d.py" ]
[ "import sys\nsys.path.append('../')\n\nfrom pathlib import Path\nimport pickle\nimport matplotlib.pyplot as plt\nfrom matplotlib.ticker import ScalarFormatter\nfrom matplotlib.gridspec import GridSpec\nimport numpy as np\n\nfrom py_diff_pd.common.common import print_info, print_error\n\ndef format_axes(fig):\n f...
[ [ "matplotlib.pyplot.rc", "matplotlib.pyplot.figure", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.show", "numpy.linalg.norm" ] ]
weihs/hashtag_co-occurrence_network
[ "b6aaa664d4cd42fd7dfd2d2dc2350568e0c6b08e" ]
[ "inconsistency_graph_construction.py" ]
[ "import json\nimport copy\nimport yaml\nimport sys\nimport numpy as np\nimport networkx as nx\nfrom scipy import linalg\n\n\ndef merge_cooccurrence_matrix(number_of_days, origin_directory,result_directory,origin_prefix,result_filename):\n postfix='.npy'\n for i in range(1,1+number_of_days):#build combine co_o...
[ [ "numpy.save", "numpy.load", "scipy.linalg.block_diag" ] ]
lbaiao/sys-simulator-2
[ "94f00d43309fe7b56dac5099bd4024695ba317b6" ]
[ "scripts_a2c/script5.py" ]
[ "# Similar to script 1 but with discrete-value actions.\n# It uses CompleteEnvironmentA2C2\n\nfrom sys_simulator import general as gen\nfrom sys_simulator.q_learning.environments.completeEnvironmentA2C2 \\\n import CompleteEnvironmentA2C2\nfrom sys_simulator.q_learning.rewards import dis_reward_tensor\nfrom sys_...
[ [ "torch.sum", "torch.nn.functional.mse_loss", "torch.FloatTensor", "torch.mul", "torch.cuda.is_available", "torch.zeros", "torch.cat", "torch.mean" ] ]
ndawlab/seqanx
[ "de44aa1baeb10646d538c185f0428d53b00db4b5" ]
[ "sisyphus/mdp/_dp.py" ]
[ "\"\"\"Dynamic programming module\"\"\"\n\nimport numpy as np\nfrom copy import deepcopy\nfrom ._misc import check_params, softmax, pessimism\nfrom warnings import warn\n\nclass ValueIteration(object):\n \"\"\"Q-value iteration algorithm.\n \n Parameters\n ----------\n policy : max | min | softmax | ...
[ [ "numpy.equal", "numpy.all", "numpy.abs", "numpy.zeros" ] ]
phenomax/praktipy
[ "58d1f74e6d128b0d22bfa0fcaf754c9b8b9e8c23" ]
[ "praktiplot.py" ]
[ "# Setting matplotlib layout to match tex settings \n\nimport matplotlib\nmatplotlib.use('pgf')\nimport matplotlib.pyplot as plt\nfrom os.path import dirname, abspath\nimport locale\nmatplotlib.rcParams.update({\n 'font.family': 'serif',\n 'text.usetex': True,\n 'pgf.rcfonts': False,\n 'pgf.texsystem': ...
[ [ "matplotlib.use", "matplotlib.pyplot.ticklabel_format" ] ]
reubensgithub/covid-19-dashboard
[ "f0d8de85a989597fe38ea771439a70fc9e0bd21f" ]
[ "coursework_project_dec_2021/covid_data_handler.py" ]
[ "\"\"\"This module has various functions inside it that will allow\r\n the processing and handling of covid data, whether from a\r\n CSV file or returned from an API\"\"\"\r\nimport sched\r\nimport time\r\nimport logging\r\nimport pandas as pd\r\nfrom typing import List\r\nfrom uk_covid19 import Cov19API\r\n\...
[ [ "pandas.read_csv", "pandas.DataFrame" ] ]
vpolisky/pymc3
[ "87cdd712c86321121c2ed3150764f3d847f5083c" ]
[ "pymc3/distributions/discrete.py" ]
[ "from functools import partial \nimport numpy as np\nimport theano\nimport theano.tensor as tt\nfrom scipy import stats\n\nfrom .dist_math import bound, factln, binomln, betaln, logpow\nfrom .distribution import Discrete, draw_values, generate_samples, reshape_sampled\n\n__all__ = ['Binomial', 'BetaBinomial', 'Be...
[ [ "numpy.random.uniform", "numpy.sum", "numpy.squeeze", "numpy.floor", "numpy.random.choice", "scipy.stats.poisson.rvs", "numpy.atleast_1d", "numpy.arange", "numpy.log", "numpy.prod", "scipy.stats.binom.rvs", "numpy.finfo", "numpy.full", "numpy.array", "nu...
zwx8981/DBCNN-Pytorch
[ "fa29f0307aa4533c4025c688ba5301cfddf9812f", "fa29f0307aa4533c4025c688ba5301cfddf9812f" ]
[ "simple_demo.py", "loss/cross_entropy_prob.py" ]
[ "import torch\nimport torch.nn as nn\nfrom torchvision import transforms\nfrom DBCNN import DBCNN\nfrom PIL import Image\n\ndevice = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n\ntest_transform = transforms.Compose([\n transforms.ToTensor(),\n transforms.Normalize(mean=(0.485, 0.456, 0...
[ [ "torch.unsqueeze", "torch.no_grad", "torch.cuda.is_available", "torch.load" ], [ "torch.sum", "torch.nn.functional.log_softmax" ] ]
CVxTz/keras_model_aws_ec2
[ "92a19f1c065ba7b19c0cd4e75b30f2935a7efacb" ]
[ "baseline.py" ]
[ "from glob import glob\n\nimport pandas as pd\nimport numpy as np # linear algebra\nfrom tensorflow.keras.applications.imagenet_utils import preprocess_input\nfrom tensorflow.keras.callbacks import ModelCheckpoint\nfrom sklearn.model_selection import train_test_split\n\nfrom models import get_model_classif_nasnet\...
[ [ "numpy.array", "pandas.DataFrame", "tensorflow.keras.callbacks.ModelCheckpoint", "sklearn.model_selection.train_test_split" ] ]
hzxie/torch-points-kernels
[ "a52ea03bdd62e890320c592282ebd89de659534f" ]
[ "torch_points_kernels/chamfer_dist.py" ]
[ "import torch\n\nif torch.cuda.is_available():\n import torch_points_kernels.points_cuda as tpcuda\n\n\nclass ChamferFunction(torch.autograd.Function):\n @staticmethod\n def forward(ctx, xyz1, xyz2):\n if not torch.cuda.is_available():\n raise NotImplementedError(\n \"CPU v...
[ [ "torch.sum", "torch.cuda.is_available", "torch.mean" ] ]
zaman-lab/brexitmeter-py
[ "a1ea66d7d747276679f8f4acdb2c2963517a0f04" ]
[ "test/storage_service_test.py" ]
[ "\nimport os\nimport tensorflow as tf\n\nfrom app.storage_service import weights_filepath, dictionaries_dirpath\n\ndef test_local_storage():\n local_filepaths = [\n\t\tweights_filepath(\"local\"),\n\t\tos.path.join(dictionaries_dirpath(\"local\"), \"dic.txt\"),\n\t\tos.path.join(dictionaries_dirpath(\"local\"), ...
[ [ "tensorflow.io.gfile.exists" ] ]
NREL/Panel-Segmentation
[ "2270157fe87dc211f87d79b9ca38a4fbae967a1a" ]
[ "panel_segmentation/panel_detection.py" ]
[ "\"\"\"\nPanel detection class\n\"\"\"\n\nimport numpy as np\nfrom tensorflow.keras import backend as K\nfrom tensorflow.keras.preprocessing import image\nfrom tensorflow.keras.models import load_model\nimport cv2\nimport matplotlib.pyplot as plt\nfrom skimage.transform import hough_line, hough_line_peaks\nfrom mat...
[ [ "tensorflow.keras.backend.sum", "tensorflow.keras.preprocessing.image.ImageDataGenerator", "numpy.dtype", "matplotlib.pyplot.tight_layout", "numpy.ones_like", "numpy.copy", "numpy.log", "tensorflow.keras.backend.mean", "matplotlib.pyplot.figure", "numpy.cos", "matplotli...
deka108/mars
[ "2cd39847c188bb690dd5e2d612a5cbe9f7b21eca" ]
[ "mars/web/session.py" ]
[ "# Copyright 1999-2020 Alibaba Group Holding Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by appl...
[ [ "numpy.dtype" ] ]
jaryP/ContinualAI
[ "7d9b7614066d219ebd72049692da23ad6ec132b0", "7d9b7614066d219ebd72049692da23ad6ec132b0" ]
[ "continual_learning/scenarios/classification/new_classes/nc_scenarios.py", "continual_learning/scenarios/utils.py" ]
[ "from collections import defaultdict\nfrom typing import Union, List, Any, Callable, Dict\n\nimport numpy as np\n\nfrom continual_learning.datasets.base import AbstractDataset, DatasetSplitsContainer\n\nfrom continual_learning.scenarios.base import TasksGenerator\nfrom continual_learning.scenarios.classification.ne...
[ [ "numpy.asarray" ], [ "torch.tensor", "scipy.ndimage.interpolation.rotate" ] ]
Duplums/SMLvsDL
[ "b285717bd8d8e832b4bc9e2b42d18bd96b628def" ]
[ "dl_training/main.py" ]
[ "import argparse\nfrom dl_training.training import BaseTrainer\nfrom dl_training.testing import OpenBHBTester\nimport torch\nimport logging\n\nif __name__==\"__main__\":\n\n logger = logging.getLogger(\"SMLvsDL\")\n\n parser = argparse.ArgumentParser()\n\n # Data location + saving paths\n parser.add_arg...
[ [ "torch.manual_seed", "torch.cuda.is_available" ] ]
inacioMattos/DeepLearning-Cachorros-e-Gatos
[ "a1eb42308f820809b7239cca6e81c4e880f5f540" ]
[ "src/backend/model.py" ]
[ "import tensorflow as tf\nfrom tensorflow.keras.models import Sequential\nfrom tensorflow.keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, MaxPooling2D\nfrom tensorflow.keras.callbacks import TensorBoard\nimport pickle, os, time\n\n\nDATADIR=\"data/\"\nNAME=\"cachorros-gatos-cnn-128-128-128-{}\".for...
[ [ "tensorflow.keras.models.Sequential", "tensorflow.keras.layers.Flatten", "tensorflow.keras.layers.MaxPooling2D", "tensorflow.keras.layers.Activation", "tensorflow.keras.layers.Dense", "tensorflow.keras.layers.Conv2D", "tensorflow.GPUOptions", "tensorflow.ConfigProto" ] ]
vivivibo/pipeline
[ "2a24660ca4b53b51bde3daedde80d8489bdeb37c" ]
[ "af/analysis/analysis/analysis.py" ]
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"ooni-pipeline: * -> Analysis\n\nConfigured with /etc/analysis.conf\n\nRuns as a system daemon but can also be used from command line in devel mode\n\nCreates and updates unlogged tables.\nShows confirmed correlated by country, ASN, input URL over time.\n\nIn...
[ [ "matplotlib.use" ] ]
hadrianl/qlib
[ "fa8f1cba06ba511744a0625afdf2cc3ac05302d0" ]
[ "setup.py" ]
[ "# Copyright (c) Microsoft Corporation.\n# Licensed under the MIT License.\nimport io\nimport os\nimport numpy\n\nfrom setuptools import find_packages, setup, Extension\n\n# Package meta-data.\nNAME = \"pyqlib\"\nDESCRIPTION = \"A Quantitative-research Platform\"\nREQUIRES_PYTHON = \">=3.5.0\"\n\nVERSION = \"0.6.3....
[ [ "numpy.get_include" ] ]
PauloBernardo/InteligenciaComputacional
[ "f5edcc01c68b83fc4435e6669e3ebd0a32d7d8b7" ]
[ "linearRegression/main.py" ]
[ "import matplotlib.pyplot as plt\nimport numpy as np\nfrom sklearn.linear_model import LinearRegression\n\n\ndef simple_example():\n X = [10, 20, 30]\n Y = [15, 19, 45]\n plt.scatter(X, Y,)\n plt.show()\n\n A = np.array([10, 1, 20, 1, 30, 1]).reshape(3, 2)\n B = np.array(Y).reshape(3, 1)\n\n a ...
[ [ "numpy.matmul", "matplotlib.pyplot.grid", "sklearn.linear_model.LinearRegression", "matplotlib.pyplot.title", "numpy.hstack", "matplotlib.pyplot.show", "matplotlib.pyplot.ylabel", "numpy.array", "matplotlib.pyplot.plot", "numpy.linspace", "matplotlib.pyplot.xlabel", ...
xkf15/faas-profiler
[ "77681daa9f5776e58d1e7dc2d38b61735d54b014" ]
[ "workload_analyzer/PerfMonAnalyzer.py" ]
[ "# Copyright (c) 2019 Princeton University\n#\n# This source code is licensed under the MIT license found in the\n# LICENSE file in the root directory of this source tree.\n\nfrom datetime import datetime, timedelta\nimport json\nimport os.path\nimport pandas as pd\nimport sys\n\nsys.path = ['./', '../'] + sys.path...
[ [ "pandas.DataFrame" ] ]
eonu/inf4-hons
[ "4b7372272860f19c0f5ea2910f122a62531d7d2e", "4b7372272860f19c0f5ea2910f122a62531d7d2e" ]
[ "sequentia/lib/sequentia/internals/validator.py", "sequentia/lib/sequentia/classifiers/hmm/topologies/left_right.py" ]
[ "import numpy as np\nfrom copy import copy\n\nclass _Validator:\n \"\"\"Performs internal validations on various input types.\"\"\"\n\n def observation_sequences(self, X, allow_single=False):\n \"\"\"Validates observation sequence(s).\n\n Parameters\n ----------\n X: numpy.ndarray ...
[ [ "numpy.random.RandomState", "numpy.atleast_2d" ], [ "numpy.arange", "numpy.ones", "numpy.tril", "numpy.triu" ] ]
JianGoForIt/tensorflow
[ "12e78f07a30e5ec8d1a9baf7cd87f4f45d29b657" ]
[ "tensorflow/python/ops/array_ops.py" ]
[ "# Copyright 2015 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by appl...
[ [ "tensorflow.python.framework.tensor_shape.unknown_shape", "tensorflow.python.ops.constant_op.constant", "tensorflow.python.ops.gen_array_ops._pad", "tensorflow.python.ops.gen_math_ops._range", "tensorflow.python.framework.tensor_shape.TensorShape", "tensorflow.python.ops.gen_array_ops.rank...
breaks-software/OSCAAR
[ "254acfccbd907b89485b9d78cff2681892a40309" ]
[ "oscaar/photometry.py" ]
[ "'''oscaar v2.0 \n Module for differential photometry\n Developed by Brett Morris, 2011-2013'''\nimport numpy as np\nfrom matplotlib import pyplot as plt\nimport matplotlib.cm as cm\n\ndef phot(image, xCentroid, yCentroid, apertureRadius, plottingThings, annulusOuterRadiusFactor=2.8, annulusInnerRadiusFactor=1....
[ [ "numpy.sum", "matplotlib.pyplot.draw", "numpy.sin", "numpy.median", "matplotlib.pyplot.clf", "numpy.cos", "numpy.arange", "numpy.max", "numpy.std" ] ]
dreamflasher/pybo-python3
[ "803873df98640c94580ccd93b6661197acf8fc5e" ]
[ "pybo/utils.py" ]
[ "\"\"\"\nVarious utility functions.\n\"\"\"\n\n\n\n\n\nimport numpy as np\nimport re\nimport subprocess\n\n__all__ = ['rstate', 'SubprocessQuery', 'InteractiveQuery']\n\n\ndef rstate(rng=None):\n \"\"\"\n Return a RandomState object. This is just a simple wrapper such that if rng\n is already an instance o...
[ [ "numpy.random.RandomState", "numpy.float" ] ]
o-Ian/X-Minerei
[ "d9f86d802787381afa4e955d7532cf9788b94962" ]
[ "Catch.Manipulation_data.py" ]
[ "import requests\nimport csv\nimport json\nimport pandas as pd\nimport os\nimport numpy as np\nimport datetime\nimport os\nfrom selenium.webdriver.chrome.options import Options\nfrom selenium.webdriver.support.ui import WebDriverWait\nfrom selenium.webdriver.support import expected_conditions as EC\nfrom selenium.w...
[ [ "pandas.read_csv", "pandas.DataFrame", "pandas.to_datetime", "pandas.merge", "numpy.select" ] ]
shangz-ai/gluon-nlp
[ "75b3c121ac02c1bdef25a785fda2238e256246f9" ]
[ "scripts/word_embeddings/evaluation.py" ]
[ "# coding: utf-8\n\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the...
[ [ "numpy.array" ] ]
pedrogbmendes/TrimTuner
[ "a9dec1f1ac610e6ec6d54cfaf5f9c93bc4f80f97" ]
[ "trimtuner/trimtuner/trimtuner.py" ]
[ "import time\nimport sys\nimport math\nimport random\nimport george\nimport numpy as np\nimport os\n\n#acq function\nfrom trimtuner.acquisition_functions.constrained_entropy_search import Constrained_EntropySearch\nfrom trimtuner.acquisition_functions.marginalization import MarginalizationGPMCMC, MarginalizationDT\...
[ [ "numpy.log2", "numpy.ones", "numpy.append", "numpy.zeros", "numpy.random.seed", "numpy.copy", "numpy.log", "numpy.array_equal", "numpy.array", "numpy.concatenate", "numpy.random.randint" ] ]
kurbansitterley/WaterTAP3
[ "8f4493182a39e3ba180019aba02249916dbae500" ]
[ "watertap3/watertap3/utils/financials.py" ]
[ "##############################################################################\n# Institute for the Design of Advanced Energy Systems Process Systems\n# Engineering Framework (IDAES PSE Framework) Copyright (c) 2018-2020, by the\n# software owners: The Regents of the University of California, through\n# Lawrence B...
[ [ "pandas.read_csv", "pandas.DataFrame", "pandas.concat" ] ]
vgaurav3011/100-Days-of-ML
[ "ec302b03fd492c459cff2592b3a4f5e38f9c9d72" ]
[ "Day 47/classifiers/neural_net.py" ]
[ "from __future__ import print_function\n\nfrom builtins import range\nfrom builtins import object\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom past.builtins import xrange\n\nclass TwoLayerNet(object):\n \"\"\"\n A two-layer fully-connected neural network. The net has an input dimension of\n N...
[ [ "numpy.sum", "numpy.zeros", "numpy.random.randn", "numpy.random.choice", "numpy.exp", "numpy.arange", "numpy.max", "numpy.maximum" ] ]
jsa4000/OpenGL-Python
[ "62055ba0c16f54507b7ba709d6691b2e9c7bc152" ]
[ "scripts/tests/test_opengl.py" ]
[ "import os\nimport math\nimport ctypes\nimport numpy as np\nimport pandas as pd\nimport OpenGL.GL as GL\nimport OpenGL.GL.shaders\nimport pygame\nfrom PIL import Image\nfrom pyrr import Quaternion, matrix44, Matrix44, Vector3\n\n\n# https://github.com/adamlwgriffiths/Pyrr/tree/master/pyrr\n# https://www.opengl.org/...
[ [ "numpy.eye", "numpy.zeros", "pandas.DataFrame", "numpy.cross", "numpy.asarray", "numpy.reshape", "pandas.merge", "numpy.array", "numpy.dot", "numpy.linalg.norm", "numpy.radians" ] ]
fadhilmch/FaceRecognition
[ "03ecddb15db79b23ff612b119c9678f5b2ce1194" ]
[ "demo_video_face_recognition.py" ]
[ "import cv2\nimport time\nimport numpy as np\nfrom detection.FaceDetector import FaceDetector\nfrom recognition.FaceRecognition import FaceRecognition\nfrom classifier.FaceClassifier import FaceClassifier\n\nVIDEO_INPUT_FILE = './media/test_video/Zidane_1.avi'\nVIDEO_OUTPUT_FILE = './media/test_video_output/Zidane_...
[ [ "numpy.argwhere" ] ]
SiChen-cuc/Tiyuntsong
[ "b1797b543f21d8e0cc80b2934aa1f5a70df5ee45" ]
[ "src/multi.py" ]
[ "import sabre as env\nimport math\nfrom network import Zero\nfrom tracepool import tracepool\nimport numpy as np\nfrom rules import rules\nfrom log import log\nimport os\nfrom multiprocessing import cpu_count\nimport multiprocessing as mp\n\nNUM_AGENT = 2\nUSE_CORES = cpu_count()\n\n\ndef agent(agent_id, net_params...
[ [ "numpy.array", "numpy.argmax" ] ]
zygn/f1tenth_gym
[ "fbb5b6a2b84bff0bd1e4eeeb62d963c74632f787" ]
[ "playground/random_obs.py" ]
[ "import random\nimport cv2\nimport numpy as np\nfrom tqdm import tqdm\n\nfile_name = 'map.png'\nimg = cv2.imread(file_name, -1)\n\ndst = img.copy()\nh, w = img.shape\nepsilon = 0.9999\n\n# 그레이스케일과 바이너리 스케일 변환\nth = cv2.bitwise_not(dst)\ncontours, _ = cv2.findContours(th, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)\n\n...
[ [ "numpy.array" ] ]
pmrowla/dvclive
[ "fe95917c965db210a6a11ff3d6f287c2df298330" ]
[ "tests/test_catalyst.py" ]
[ "import os\n\nimport pytest\nfrom catalyst import dl\nfrom catalyst.contrib.datasets import MNIST\nfrom catalyst.data import ToTensor\nfrom catalyst.utils.torch import get_available_engine\nfrom torch import nn, optim\nfrom torch.utils.data import DataLoader\n\nimport dvclive\nfrom dvclive.catalyst import DvcLiveCa...
[ [ "torch.utils.data.DataLoader", "torch.nn.Flatten", "torch.nn.Linear", "torch.nn.CrossEntropyLoss" ] ]
lynshao/NoisyNN
[ "2c827dbe697f4a8d8f9b2cb8abb2aa43a749fa16" ]
[ "TrainingNoise_CIFAR10/Update.py" ]
[ "import torch\nfrom torch import nn\nfrom torch.utils.data import DataLoader, Dataset\n\n\nclass DatasetSplit(Dataset):\n def __init__(self, dataset, idxs):\n self.dataset = dataset\n self.idxs = list(idxs)\n\n def __len__(self):\n return len(self.idxs)\n\n def __getitem__(self, item):...
[ [ "torch.nn.CrossEntropyLoss" ] ]
smolsbs/aoc
[ "558cc68b94ead332190e14ad7a9ecd6ca5c4aa5a" ]
[ "2020/day-11/day11.py" ]
[ "#!/usr/bin/env python3\nimport numpy as np\n\ndirs = [(0,1), (1,0), (0, -1), (-1, 0), (1,1), (1,-1), (-1, 1), (-1,-1)]\n\ndef parse_seats(line):\n v = []\n for s in line:\n if s == 'L':\n v.append(0)\n else:\n v.append(-1)\n return v\n\ndef allpos(xx,yy):\n all_p = [...
[ [ "numpy.copy", "numpy.count_nonzero" ] ]
m-philipps/pyPESTO
[ "4c30abfca56ba714c302141cd44a9dd366bff4bb" ]
[ "pypesto/objective/amici.py" ]
[ "import abc\nimport copy\nimport os\nimport tempfile\nfrom collections import OrderedDict\nfrom typing import Dict, Optional, Sequence, Tuple, Union\n\nimport numpy as np\n\nfrom ..C import FVAL, MODE_FUN, MODE_RES, RDATAS\nfrom .amici_calculator import AmiciCalculator\nfrom .amici_util import (\n create_identit...
[ [ "numpy.spacing", "numpy.asarray" ] ]
gottaegbert/penter
[ "8cbb6be3c4bf67c7c69fa70e597bfbc3be4f0a2d", "8cbb6be3c4bf67c7c69fa70e597bfbc3be4f0a2d" ]
[ "matplotlib/gallery_python/event_handling/path_editor.py", "matplotlib/gallery_python/text_labels_and_annotations/fancytextbox_demo.py" ]
[ "\"\"\"\n===========\nPath Editor\n===========\n\nSharing events across GUIs.\n\nThis example demonstrates a cross-GUI application using Matplotlib event\nhandling to interact with and modify objects on the canvas.\n\"\"\"\nimport numpy as np\nimport matplotlib.path as mpath\nimport matplotlib.patches as mpatches\n...
[ [ "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "matplotlib.path.Path", "matplotlib.patches.PathPatch", "numpy.sqrt", "matplotlib.pyplot.Artist.update_from" ], [ "matplotlib.pyplot.show" ] ]
UoS-SNe/pycoco
[ "bbcb09b6c8fde7e0c4464bfbd574a42e09dbfed2" ]
[ "pycocosn/classes.py" ]
[ "\"\"\"\nWorkhorse classes for interacting/running the CoCo templates.\n\nauthor: Rob Firth; github.com/RobFirth ; University of Southampton SN Group\n 2017\n\"\"\"\n\nfrom __future__ import print_function ## Force python3-like printing\n\nimport os\nimport re\nimport warnings\nfrom collections import Order...
[ [ "numpy.sum", "scipy.interpolate.interp1d", "numpy.argsort", "numpy.append", "scipy.interpolate.InterpolatedUnivariateSpline", "matplotlib.pyplot.figure", "numpy.logical_and", "numpy.nanmean", "numpy.in1d", "numpy.log10", "matplotlib.pyplot.get_cmap", "numpy.isnan", ...
TXM-DOOM/B.Tech-CSE-Y2
[ "763436ae866f1f18fa8071c253d005bdf289532f" ]
[ "applied-statistics/python-revisited/libraries/numpy/sorting.py" ]
[ "import numpy as np\n\ntestArr1 = np.array([1, 20, 23, 14, 2, 1, 234, 12, 1, 3]) # Sorts in ascending order\ntestArr2 = np.array([True, False, False, True]) # False at the start of the array and then True\ntestArr3 = np.array(['C', 'A', 'Z', 'V']) # Sorts Alphabetically\n\nprint('1: {}\\n2: {}\\n3: {}'.format(np.so...
[ [ "numpy.array", "numpy.sort" ] ]
benjamin-work/aristo-mini
[ "4d99fa4cb9eb1e64d0d21adfea15450d626cfcba" ]
[ "aristomini/common/wordtwovec.py" ]
[ "\"\"\"\na wrapper class for the gensim Word2Vec model that has extra features we need, as well as some\nhelper functions for tokenizing and stemming and things like that.\n\"\"\"\n\nfrom functools import lru_cache\nimport math\nfrom typing import Iterable, List\n\nfrom gensim.parsing.preprocessing import STOPWORDS...
[ [ "numpy.dot", "numpy.average", "numpy.zeros" ] ]
AishwaryaKalloli/koalas
[ "8d35a74508c1319996c8c27e2a5e24af52b9ee31" ]
[ "databricks/koalas/base.py" ]
[ "#\n# Copyright (C) 2019 Databricks, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable la...
[ [ "pandas.api.types.is_list_like", "numpy.timedelta64" ] ]
taolon2018/Tensorflow2_Models
[ "b931b6779e8d2fc775bcaa1e9cbcad6edf0438f4" ]
[ "object_detection/YOLO_v3/model/yolov3.py" ]
[ "import tensorflow as tf\n\nfrom object_detection.YOLO_v3.backbone.darknet53 import Darknet53, ConvLayer\n\n\nclass ConvSet(tf.keras.layers.Layer):\n def __init__(self, output_dim):\n super(ConvSet, self).__init__()\n self.conv_1 = ConvLayer(output_dim, 1)\n self.conv_2 = ConvLayer(output_di...
[ [ "tensorflow.keras.layers.Conv2D", "tensorflow.image.resize", "tensorflow.concat" ] ]
jeffreyblair/ML
[ "9cf810cbe9a1720de9013740650f9d72b61bde59" ]
[ "logistic_regression/logistic.py" ]
[ "\"\"\" Methods for doing logistic regression.\"\"\"\n\nimport numpy as np\nfrom utils import sigmoid\n\ndef logistic_predict(weights, data):\n \"\"\"\n Compute the probabilities predicted by the logistic classifier.\n\n Note: N is the number of examples and\n M is the number of features per examp...
[ [ "numpy.array", "numpy.log" ] ]
lukevolpatti/xarray
[ "65ca92a5c0a4143d00dd7a822bcb1d49738717f1" ]
[ "xarray/core/common.py" ]
[ "import warnings\nfrom contextlib import suppress\nfrom html import escape\nfrom textwrap import dedent\nfrom typing import (\n Any,\n Callable,\n Dict,\n Hashable,\n Iterable,\n Iterator,\n List,\n Mapping,\n Tuple,\n TypeVar,\n Union,\n)\n\nimport numpy as np\nimport pandas as pd\...
[ [ "numpy.full_like", "numpy.dtype", "numpy.issubdtype", "numpy.asarray", "pandas.Grouper", "numpy.nonzero", "numpy.unique" ] ]
jungwoohan72/DGN_pytorch
[ "65fe7ab4df661d97725f2a72a1fdb49df1b2ea44" ]
[ "Starcraft/DGN/test.py" ]
[ "import os, sys\nimport numpy as np\nfrom smac.env import StarCraft2Env\nfrom model import DGN\nfrom buffer import ReplayBuffer\nfrom config import *\nfrom utilis import *\nimport torch\nimport torch.optim as optim\n\ntest_env = StarCraft2Env(map_name='25m')\nenv_info = test_env.get_env_info()\nn_ant = env_info[\"n...
[ [ "numpy.array", "numpy.eye", "torch.load" ] ]
alexjungaalto/nLassoExpFamPDSimulations
[ "c07b441fff6473d7c650e511e210aaebf7fe061b" ]
[ "get_obs_csv.py" ]
[ "import requests\nimport datetime as dt\nimport xml.etree.ElementTree as ET\nimport numpy as np\nimport re\nimport argparse\n\ndef get_param_names(url):\n \"\"\" Get parameters metadata \"\"\"\n req = requests.get(url)\n params = {}\n\n if req.status_code == 200:\n xmlstring = req.content\n ...
[ [ "numpy.array", "numpy.append" ] ]
attackgnome/SpaceX
[ "1005f8a24bc44ee3d19cc4500d9674666f07621b" ]
[ "spacex_dash_app.py" ]
[ "# Import required libraries\nimport pandas as pd\nimport dash\nimport dash_html_components as html\nimport dash_core_components as dcc\nfrom dash.dependencies import Input, Output\nimport plotly.express as px\n\n# Read the airline data into pandas dataframe\nspacex_df = pd.read_csv(\"spacex_launch_dash.csv\")\nmax...
[ [ "pandas.read_csv" ] ]
simonwey/DecoupleNet
[ "3e9e09d512230cb0d95e9db98c5838ca9ff799da" ]
[ "lib/dataset/crowdpose.py" ]
[ "# ------------------------------------------------------------------------------\n# Copyright (c) Microsoft\n# Licensed under the MIT License.\n# Written by Bowen Cheng (bcheng9@illinois.edu) and Bin Xiao (leoxiaobin@gmail.com)\n# ------------------------------------------------------------------------------\n\nfr...
[ [ "numpy.ones", "numpy.zeros", "numpy.amax", "numpy.amin", "numpy.max", "numpy.min", "numpy.array" ] ]
bioShaun/omsCabinet
[ "741179a06cbd5200662cd03bc2e0115f4ad06917" ]
[ "bioinformatics/analysis/snp/replace_score.py" ]
[ "import fire\nimport gzip\nimport pandas as pd\nfrom pathlib import PurePath\n\n\ndef extract_vcf_header(vcf):\n if vcf.suffix == '.gz':\n vcf_inf = gzip.open(vcf)\n else:\n vcf_inf = open(vcf)\n prefix = ''\n for eachline in vcf_inf:\n if vcf.suffix == '.gz':\n eachline ...
[ [ "pandas.read_csv" ] ]
bvaisvil/lefse
[ "6e325486b9d72a3d489b472691d171377d85b589" ]
[ "format_input.py" ]
[ "#!/usr/bin/env python3\n\nimport sys,os,argparse,pickle,re,numpy\n\nimport functools\n\n\n#***************************************************************************************************************\n#* Log of change ...
[ [ "numpy.std", "numpy.mean" ] ]
samuelwestlake/deeplodocus-dev
[ "12b283ca4eb39abf13ddc56eabc78e01e90627ff" ]
[ "deeplodocus/data/load/loader.py" ]
[ "# Python imports\nfrom typing import Optional\nfrom typing import List\nfrom typing import Union\nfrom typing import Any\nimport numpy as np\nimport mimetypes\nimport weakref\n\n# Deeplodocus imports\nfrom deeplodocus.utils.notification import Notification\nfrom deeplodocus.utils.generic_utils import get_int_or_f...
[ [ "numpy.load" ] ]
fernandezdaniel/Spearmint
[ "3c9e0a4be6108c3d652606bd957f0c9ae1bfaf84" ]
[ "spearmint/kernels/matern.py" ]
[ "# -*- coding: utf-8 -*-\n# Spearmint\n#\n# Academic and Non-Commercial Research Use Software License and Terms\n# of Use\n#\n# Spearmint is a software package to perform Bayesian optimization\n# according to specific algorithms (the “Software”). The Software is\n# designed to automatically run experiments (thus t...
[ [ "numpy.sqrt", "numpy.ones", "numpy.exp" ] ]
iamabhishek0/sympy
[ "c461bd1ff9d178d1012b04fd0bf37ee3abb02cdd" ]
[ "sympy/parsing/autolev/test-examples/ruletest12.py" ]
[ "import sympy.physics.mechanics as me\nimport sympy as sm\nimport math as m\nimport numpy as np\n\nx, y = me.dynamicsymbols('x y')\na, b, r = sm.symbols('a b r', real=True)\neqn = sm.Matrix([[0]])\neqn[0] = a*x**3+b*y**2-r\neqn = eqn.row_insert(eqn.shape[0], sm.Matrix([[0]]))\neqn[eqn.shape[0]-1] = a*sm.sin(x)**2+b...
[ [ "numpy.deg2rad" ] ]
ACWI-SSWD/nldi_xstool
[ "f201befc6454202042d2ed76e82c3c07edcf4c48" ]
[ "nldi_xstool/__openChannel.py" ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue May 5 16:26:25 2015\n\n@author: mweier\n\"\"\"\n\nimport numpy as np\nfrom numba import jit\n\n\n@jit\ndef channelBuilder(wsDepth, rightSS, leftSS, widthBottom):\n \"\"\"\n Builds trapziodal channel station/elevation array given depth,\n right side slope, l...
[ [ "numpy.sqrt", "numpy.vstack", "numpy.max", "numpy.power", "numpy.min", "numpy.array", "numpy.where" ] ]
whq-hqw/detr_change
[ "142f75cc5e0b59ca6e07928ddcbed3e461816611" ]
[ "models/matcher.py" ]
[ "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\"\"\"\nModules to compute the matching cost and solve the corresponding LSAP.\n\"\"\"\nimport torch\nfrom scipy.optimize import linear_sum_assignment\nfrom torch import nn\n\nfrom util.box_ops import box_cxcywh_to_xyxy, generalized_box_iou\n\...
[ [ "torch.as_tensor", "torch.no_grad", "torch.cdist", "scipy.optimize.linear_sum_assignment", "torch.cat" ] ]
lupantech/InterGPS
[ "0f326027d16d7d50a9c189f897739dfb95085021" ]
[ "theorem_predict/eval_transformer.py" ]
[ "#!/usr/bin/env python\n# coding: utf-8\n\nimport json\nimport ast\nfrom tqdm import tqdm\n\nimport torch\nfrom transformers import BartForConditionalGeneration, BartTokenizerFast\n\n\ndef evaluate(diagram_logic_file, text_logic_file, tokenizer_name, model_name, check_point, seq_num):\n\n test_lst = range(2401, ...
[ [ "torch.LongTensor", "torch.device", "torch.load" ] ]
zajaczajac/metaworld
[ "4febbc4f702c3145b73b012b58b111b2c439032a" ]
[ "metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_lever_pull.py" ]
[ "import numpy as np\nfrom gym.spaces import Box\n\nfrom metaworld.envs.env_util import get_asset_full_path\nfrom metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import SawyerXYZEnv, _assert_task_is_set\n\n\nclass SawyerLeverPullEnv(SawyerXYZEnv):\n\n def __init__(self):\n\n hand_low = (-0.5, 0.40, -0.15)\...
[ [ "numpy.array", "numpy.linalg.norm", "numpy.exp" ] ]
realspacekolle/pyScattData
[ "585376761ef380c1f006bc8a0d23adaed5e9258d" ]
[ "h5_extract_write_plot/h5_extract_write_plot.py" ]
[ "import sys\nfrom pathlib import Path\nimport h5py\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n\nTWOTHETA_KEYS = [\"2th\", \"2theta\", \"twotheta\"]\nQ_KEYS = [\"q\"]\nINTENSITY_KEYS = [\"i\", \"intensity\", \"int\"]\nSTACK_INDICES_KEY = \"stack_indices\"\n\nDPI = 300\nFIGSIZE = (12,4)\nFONTSIZE_LABELS ...
[ [ "numpy.vstack", "matplotlib.pyplot.ticklabel_format", "matplotlib.pyplot.tick_params", "matplotlib.pyplot.figure", "numpy.savetxt", "matplotlib.pyplot.savefig", "numpy.column_stack", "numpy.amax", "numpy.amin", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.close", ...
ilopata1/matplotlib-scalebar
[ "7e0d7b668021f01501b47b6eeecc1e8808d81c29" ]
[ "doc/example_dimension.py" ]
[ "import matplotlib.pyplot as plt\nfrom matplotlib_scalebar.scalebar import ScaleBar\nfrom matplotlib_scalebar.dimension import _Dimension, _PREFIXES_FACTORS, _LATEX_MU\n\n\nclass TimeDimension(_Dimension):\n def __init__(self):\n super().__init__(\"s\")\n for prefix, factor in _PREFIXES_FACTORS.ite...
[ [ "matplotlib.pyplot.figure", "matplotlib.pyplot.gca", "matplotlib.pyplot.savefig" ] ]
whigg/BeringSeaIce2018
[ "b5404cfbb51cb6f893be78d53b94de8092b25a7b" ]
[ "Scripts/BeringSeaIce_NSIDC_Feb.py" ]
[ "\"\"\"\nScript calculates sea ice extent in the Bering Sea from SIC fields\nNotes\n-----\n Author : Zachary Labe\n Date : 12 March 2018\n\"\"\"\n\n### Import modules\nimport numpy as np\nfrom netCDF4 import Dataset\nimport matplotlib.pyplot as plt\nimport datetime\nimport statsmodels.api as sm\n\n### Defin...
[ [ "matplotlib.pyplot.legend", "matplotlib.pyplot.rc", "matplotlib.pyplot.figure", "matplotlib.pyplot.savefig", "matplotlib.pyplot.xlim", "numpy.arange", "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.text", "matplotl...
mvaz/textacy
[ "760b96a561eb3379b3a211a0353c9bc47127e99c" ]
[ "textacy/corpus.py" ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nA class for working with a collection of spaCy docs. Includes functionality for\neasily adding, getting, and removing documents; saving to / loading their data\nfrom disk; and tracking basic corpus statistics.\n\"\"\"\nfrom __future__ import absolute_import, division, print_functio...
[ [ "numpy.vstack", "numpy.ndarray.tolist", "numpy.asarray", "numpy.frombuffer" ] ]
TomKingsfordUoA/ResidualMaskingNetwork
[ "b77abb6e548b9a09b5c96b1592d71332b45d050e" ]
[ "rmn/models/residual_attention_network.py" ]
[ "import torch\nimport torch.nn as nn\nfrom torch.nn import init\nimport functools\nfrom torch.autograd import Variable\nimport numpy as np\nfrom .basic_layers import ResidualBlock\nfrom .attention_module import AttentionModule\n\n\nclass ResidualAttentionModel(nn.Module):\n def __init__(self, in_channels=3, num_...
[ [ "torch.nn.MaxPool2d", "torch.nn.BatchNorm2d", "torch.nn.Linear", "torch.nn.Conv2d", "torch.nn.AvgPool2d", "torch.nn.ReLU" ] ]
kumiori/stability-bifurcation
[ "9a82bf40742a9b16122b7a476ad8aec65fe22539" ]
[ "scripts/parametric_1d.py" ]
[ "from traction_1d import *\nimport numpy as np\nfrom utils import ColorPrint\n\n# ell_list = np.linspace(.1, .5, 20)\n# ell_min = 0.1\n#ell_max = 2.\nell_list = np.logspace(np.log10(.15), np.log10(1.5), 20)\n\ndef t_stab(ell, q=2):\n\tcoeff_stab = 2.*np.pi*q/(q+1)**(3./2.)*np.sqrt(2)\n\tif 1/ell > coeff_stab:\n\t\t...
[ [ "numpy.sqrt", "numpy.log10", "numpy.logspace" ] ]
hishamsajid/vsketch
[ "1b35b794972097b8fb5af94ea6e93f3e8c69448c" ]
[ "examples/random_flower/sketch_random_flower.py" ]
[ "import math\n\nimport numpy as np\n\nimport vsketch\n\n\nclass RandomFlowerSketch(vsketch.SketchClass):\n num_line = vsketch.Param(200, 1)\n point_per_line = vsketch.Param(100, 1)\n rdir_range = vsketch.Param(math.pi / 6)\n\n def draw(self, vsk: vsketch.Vsketch) -> None:\n vsk.size(\"a4\", lands...
[ [ "numpy.cumsum", "numpy.sin", "numpy.linspace", "numpy.cos" ] ]
mpsampat/kaggle-ds-bowl-2018-baseline
[ "c769ba7b4db4d1f38f7190db9a11bf812b2b983a" ]
[ "bowl_config.py" ]
[ "from config import Config\nimport numpy as np\nclass BowlConfig(Config):\n \"\"\"Configuration for training on the toy shapes dataset.\n Derives from the base Config class and overrides values specific\n to the toy shapes dataset.\n \"\"\"\n # Give the configuration a recognizable name\n NAME = \...
[ [ "numpy.array" ] ]
flatironinstitute/sparse_dot
[ "d04a277016ec4af4e507131a3751daca028edc1d" ]
[ "sparse_dot_mkl/tests/test_gram_matrix.py" ]
[ "import unittest\nimport numpy as np\nimport numpy.testing as npt\nfrom sparse_dot_mkl import gram_matrix_mkl\nfrom sparse_dot_mkl.tests.test_mkl import MATRIX_1\n\n\nclass TestGramMatrix(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n gram_ut = np.dot(MATRIX_1.A.T, MATRIX_1.A)\n g...
[ [ "numpy.zeros", "numpy.tril_indices", "numpy.asarray", "numpy.testing.assert_array_almost_equal", "numpy.dot" ] ]
slamer59/awesome-panel
[ "91c30bd6d6859eadf9c65b1e143952f7e64d5290" ]
[ "application/pages/awesome_panel_express_tests/test_perspective.py" ]
[ "\"\"\"\r\n# Perspective Viewer\r\n\r\n[Perspective](https://github.com/finos/perspective#readme) is an interactive visualization\r\ncomponent for large, real-time datasets. It comes with the `perspective-viewer` web component.\r\n\r\nIt enables analysts and traders at large banks like J.P.Morgan to understand thei...
[ [ "pandas.read_csv" ] ]
OscarPellicer/probreg
[ "8f1dd23dd86371b8040abad580332ff36967c078" ]
[ "tests/test_svr.py" ]
[ "import unittest\nimport numpy as np\nimport transforms3d as t3d\nimport open3d as o3\nfrom probreg import l2dist_regs\nfrom probreg import transformation as tf\n\n\nclass SVRTest(unittest.TestCase):\n def setUp(self):\n pcd = o3.io.read_point_cloud('data/horse.ply')\n pcd = pcd.voxel_down_sample(v...
[ [ "numpy.random.uniform", "numpy.allclose", "numpy.asarray", "numpy.zeros" ] ]
anishacharya/BGMD
[ "03dee098217d2b9a209fea5759e2e0a2237390a5" ]
[ "src/aggregation_manager/trimmed_mean.py" ]
[ "# Copyright (c) Anish Acharya.\n# Licensed under the MIT License\nimport numpy as np\nfrom .base_gar import GAR\nfrom scipy import stats\nfrom typing import List\n\"\"\"\nComputes Trimmed mean estimates\nCite: Yin, Chen, Ramchandran, Bartlett : Byzantine-Robust Distributed Learning: Towards Optimal Statistical Rat...
[ [ "scipy.stats.trim_mean" ] ]
guiomar/mne-python
[ "2d19800a07904cfe69c1ba290c3eaf712625c6ab" ]
[ "mne/io/nirx/tests/test_nirx.py" ]
[ "# -*- coding: utf-8 -*-\n# Authors: Robert Luke <mail@robertluke.net>\n# Eric Larson <larson.eric.d@gmail.com>\n# simplified BSD-3 license\n\nimport os.path as op\nimport shutil\nimport os\nimport datetime as dt\nimport numpy as np\n\nimport pytest\nfrom numpy.testing import assert_allclose, ass...
[ [ "numpy.diff", "numpy.testing.assert_array_equal", "numpy.isnan", "numpy.where", "numpy.testing.assert_allclose" ] ]
Miles-Ma/mmclassification
[ "b54acfd5c431bf3a15a964c9d3d9a271c197ac18" ]
[ "mmcls/models/utils/attention.py" ]
[ "import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom mmcv.cnn.bricks.transformer import build_dropout\nfrom mmcv.cnn.utils.weight_init import trunc_normal_\nfrom mmcv.runner.base_module import BaseModule\n\nfrom ..builder import ATTENTION\nfrom .helpers import to_2tuple\n\n\nclass WindowMSA(B...
[ [ "torch.nn.Linear", "torch.roll", "torch.nn.Softmax", "torch.nn.functional.pad", "torch.arange", "torch.zeros", "torch.nn.Dropout" ] ]
xpo0a/SpeechEnhancement
[ "2efd67c24289541e43d3943cc1a3f8989c0afeb4" ]
[ "data_preprocess.py" ]
[ "import os\nimport yaml\n\nimport librosa\nimport numpy as np\nfrom tqdm import tqdm\n\n\ndef slice_signal(file, window_size, stride, sample_rate):\n\n wav, sr = librosa.load(file, sr=None)\n\n if sr != sample_rate:\n wav = librosa.resample(wav, sr, sample_rate)\n\n wav = wav / np.max(np.abs(wav))\n...
[ [ "numpy.array", "numpy.max", "numpy.abs", "numpy.min" ] ]
kbrodt/clog-loss
[ "0831b3a01b079609a71490bb921633110927206c" ]
[ "src/models/resnext.py" ]
[ "import math\nfrom functools import partial\nfrom functools import partialmethod\n\n\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\nfrom .resnet import conv1x1x1, Bottleneck, ResNet\n\n\ndef partialclass(cls, *args, **kwargs):\n class PartialClass(cls):\n __init__ = partialmethod...
[ [ "torch.nn.Conv3d", "torch.nn.Linear", "torch.nn.BatchNorm3d" ] ]
NVIDIA/cuQuantum
[ "0f00494d4639d760228ac002e83e6d2d3dd97eca" ]
[ "python/samples/sampler.py" ]
[ "# Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES\n#\n# SPDX-License-Identifier: BSD-3-Clause\n\nimport numpy as np\nimport cupy as cp\n\nimport cuquantum\nfrom cuquantum import custatevec as cusv\n\n\nnIndexBits = 3\nnSvSize = (1 << nIndexBits)\nnMaxShots = 5\nnShots = 5\n\nbitStringLen = 2;\nbi...
[ [ "numpy.empty", "numpy.asarray", "numpy.allclose" ] ]
JeromeMutgeert/Detectron-DA-Faster-RCNN
[ "86e4fb06bf3e934c12eb0913ef4210ad61114386" ]
[ "detectron/core/test_engine.py" ]
[ "# Copyright (c) 2017-present, Facebook, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicabl...
[ [ "numpy.array", "numpy.load", "numpy.empty" ] ]
DamonU2/model-factory
[ "494f8b65afcd80fbedca3224e4c29a2e10cd484f" ]
[ "scripts/PSRA_combineSrcLossTable.py" ]
[ "#!/usr/bin/env python\n\nimport pandas as pd\nimport numpy as np\nimport csv\nimport glob \nimport os\nimport re\nimport sys\nimport argparse\nimport configparser\nimport logging\n\n'''\npython script to merge source loss tables for Provinces and territories\nwhere PSRA runs have een split up by economic region or...
[ [ "pandas.read_csv", "pandas.DataFrame" ] ]
bclarkson-code/search-query-classification
[ "8928faad459ef97934a6dbcf38a9347da5662415" ]
[ "gpt2_model/generate_gpt2_embeddings.py" ]
[ "import pickle\nimport torch\nfrom tqdm.auto import tqdm\nfrom gpt2_predictor import GPT2Predictor, GPT2TestSearchQueryDataModule\n\nif __name__ == '__main__':\n encoding = {\n 'Arts': 0,\n 'Business': 11,\n 'Computers': 10,\n 'Games': 12,\n 'Health': 9,\n 'Home': 6,\n ...
[ [ "torch.no_grad" ] ]
cpaxton/costar_plan
[ "be5c12f9d0e9d7078e6a5c283d3be059e7f3d040" ]
[ "costar_models/python/costar_models/conditional_image_costar.py" ]
[ "from __future__ import print_function\n\nimport keras.backend as K\nimport keras.losses as losses\nimport keras.optimizers as optimizers\nimport numpy as np\n\nfrom keras.callbacks import ModelCheckpoint\nfrom keras.layers.advanced_activations import LeakyReLU\nfrom keras.layers import Input, RepeatVector, Reshape...
[ [ "numpy.zeros_like", "numpy.expand_dims", "numpy.ones_like" ] ]
Jackwaterveg/Parakeet
[ "e75a07076ba5766206a6cd1fb2e5f82b0ba3842c" ]
[ "utils/gen_duration_from_textgrid.py" ]
[ "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless re...
[ [ "numpy.diff" ] ]
ufukhurriyetoglu/allennlp
[ "3f431799776dbf2a42091ba114fc3b6f38b268c8" ]
[ "allennlp/models/coreference_resolution/coref.py" ]
[ "import logging\nimport math\nfrom typing import Any, Dict, List, Optional, Tuple\n\nimport torch\nimport torch.nn.functional as F\nfrom torch.autograd import Variable\nfrom overrides import overrides\n\nfrom allennlp.common import Params\nfrom allennlp.data import Vocabulary\nfrom allennlp.models.model import Mode...
[ [ "torch.cat", "torch.nn.Dropout", "torch.sort" ] ]
civic-jabber/data-ingest
[ "bf44c6041ad947547ceede535124c5db004d2f43" ]
[ "civic_jabber_ingest/cli.py" ]
[ "import click\nimport pandas as pd\n\n\nfrom civic_jabber_ingest.external_services.newspaper import load_news\nfrom civic_jabber_ingest.external_services.open_states import get_all_people\nfrom civic_jabber_ingest.regs.va import load_va_regulations\nfrom civic_jabber_ingest.utils.config import read_config\n\n\n@cli...
[ [ "pandas.DataFrame" ] ]
beaulian/fpn.pytorch
[ "49fe36711cff71e26d9bef838613577dabd02336" ]
[ "lib/datasets/pascal_voc.py" ]
[ "# --------------------------------------------------------\n# Fast R-CNN\n# Copyright (c) 2015 Microsoft\n# Licensed under The MIT License [see LICENSE for details]\n# Written by Ross Girshick\n# --------------------------------------------------------\n\nimport xml.dom.minidom as minidom\n\nimport os\n# import PI...
[ [ "numpy.mean", "scipy.io.loadmat", "numpy.zeros" ] ]
supunab/Lantern
[ "f453de532da638c1f467953b32bbe49a3dedfa45" ]
[ "src/out/NIPS18evaluation/evaluationRNN/min-char-rnn-pytorch.py" ]
[ "\"\"\"\nMinimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)\nBSD License\n\"\"\"\nimport numpy as np\nimport time\nimport torch\nimport torch.nn as nn\nfrom torch.autograd import Variable\nimport torch.nn.functional as F\n\ndef run(write_to):\n\n torch.set_num_threads(1)\n\n start =...
[ [ "torch.nn.Linear", "torch.manual_seed", "torch.nn.CrossEntropyLoss", "torch.set_num_threads", "torch.zeros", "torch.LongTensor", "torch.cat" ] ]
mcflugen/terrainbento
[ "1b756477b8a8ab6a8f1275b1b30ec84855c840ea" ]
[ "terrainbento/derived_models/model_440_basicChSa/model_440_basicChSa.py" ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nmodel_440_basicChSa.py: erosion model using depth-dependent cubic diffusion\nwith a soil layer, basic stream power, and discharge proportional to drainage\narea.\n\nModel 440 BasicChSa\n\nLandlab components used: FlowRouter, DepressionFinderAndRouter,\n Fast...
[ [ "numpy.where", "numpy.minimum" ] ]
jdvelasq/techminer2
[ "ad64a49402749755798a18417c38a7ad10e83bad" ]
[ "techminer2/co_occurrence_matrix_cluster_mds_map.py" ]
[ "\"\"\"\nCo-occurrence Matrix / Cluster MDS Map\n===============================================================================\n\n>>> from techminer2 import *\n>>> directory = \"data/\"\n>>> file_name = \"sphinx/images/co_occurrence_matrix_cluster_mds_map.png\"\n>>> co_occurrence_matrix_cluster_mds_map(\n... ...
[ [ "sklearn.manifold.MDS" ] ]
Telcrome/ai-trainer
[ "54bca3252e194c054bdd3af2b94d6dde940a2a86" ]
[ "trainer/ml/utils.py" ]
[ "from enum import Enum\nfrom typing import Generator, Tuple, Iterable, Dict, List\n\nimport cv2\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport seaborn as sns\nfrom scipy.ndimage import label, generate_binary_structure\nfrom scipy.ndimage.morphology import distance_transform_edt as dist_trans\n\nimport...
[ [ "numpy.ones", "numpy.zeros", "numpy.argwhere", "scipy.ndimage.label", "numpy.invert", "numpy.any", "numpy.ones_like", "scipy.ndimage.generate_binary_structure", "numpy.copy", "numpy.lexsort", "numpy.max", "numpy.min", "numpy.where", "numpy.unique", "nump...
sxontheway/BalanceFL
[ "43bb7539c932b7b6f7ad03f94a724452ae3855a3" ]
[ "IMU/fed.py" ]
[ "import copy\nimport time\nfrom collections import OrderedDict\n\nimport torch\nfrom data.dataloader import local_client_dataset, test_dataset\nfrom models.utils import *\nfrom utils.train_helper import validate_one_model\nfrom utils.sampling import *\n\n\nimport numpy as np\nfrom multiprocessing import Process\nim...
[ [ "torch.utils.data.DataLoader", "torch.stack", "torch.no_grad", "numpy.random.multivariate_normal", "torch.cuda.is_available", "torch.cat", "torch.set_grad_enabled", "torch.unique", "numpy.where", "numpy.average", "numpy.unique", "torch.optim.SGD", "numpy.zeros",...
alphardex/looter
[ "2be094576e31fd13123719ca94e42cb31475dffa" ]
[ "examples/baidu_index.py" ]
[ "\"\"\"\n爬取百度指数的某一时间段内的特定关键词的所有指数\n\"\"\"\nimport time\nimport looter as lt\nimport requests\nimport pandas as pd\nimport arrow\nfrom loguru import logger\n\nwords = [] # 关键词列表\nstart_date = '2018-01-29'\nend_date = '2018-12-31'\nkinds = ['all', 'pc', 'wise']\ndomain = 'http://index.baidu.com'\nheaders = {\n 'H...
[ [ "pandas.date_range" ] ]
aiyasin/X2Paddle
[ "b37959f2ecdc09fdec7a38c01272126a7f3800e4" ]
[ "x2paddle/op_mapper/dygraph/caffe2paddle/caffe_op_mapper.py" ]
[ "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless req...
[ [ "numpy.zeros", "numpy.squeeze" ] ]
ahillbs/minimum_scan_cover
[ "e41718e5a8e0e3039d161800da70e56bd50a1b97" ]
[ "code/instance_evolver.py" ]
[ "import os\nimport subprocess\nfrom inspect import isclass\n\nimport configargparse\nimport numpy as np\nimport sqlalchemy\nimport yaml\nfrom IPython import embed\n\n\nfrom angular_solver import solve\nfrom database import Config, ConfigHolder, Graph, Task, get_session, DatabaseGraphGenome\nfrom genetic_algorithm i...
[ [ "numpy.zeros" ] ]
aounleonardo/Spread-Classification
[ "22c643252e31df367dfeb55fd1a5397dabd7f2b4" ]
[ "modeling/src/nlp_ignite_engines.py" ]
[ "import torch\n\nfrom ignite.engine.engine import Engine, State, Events\nfrom ignite.utils import convert_tensor\n\n\ndef _prepare_batch(batch, device=None, non_blocking=False):\n \"\"\"Prepare batch for training: pass to a device with options.\n\n \"\"\"\n x, attention_mask, y = batch\n return (\n ...
[ [ "torch.no_grad" ] ]
janfreyberg/ipyannotate
[ "b1c30fe73bfda107d4ef75945338d42bfe8e3b64" ]
[ "tests/images/test_abstract_canvas.py" ]
[ "import pathlib\nimport tempfile\nfrom typing import Tuple, Union\nfrom unittest.mock import patch\n\nimport ipywidgets as widgets\nimport numpy as np\nfrom hypothesis import assume, given, infer, settings, strategies\nfrom PIL import Image\n\nfrom ipyannotations.images.canvases.abstract_canvas import (\n Abstra...
[ [ "numpy.isclose" ] ]
thomashopf/EVcouplings-1
[ "d3e4947d29b62537bd79215ce72b6eea18134850" ]
[ "evcouplings/compare/protocol.py" ]
[ "\"\"\"\nEC to 3D structure comparison protocols/workflows.\n\nAuthors:\n Thomas A. Hopf\n Anna G. Green (complex and _make_complex_contact_maps)\n\"\"\"\n\nfrom copy import deepcopy\nfrom math import ceil\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom evcouplings.align.alignmen...
[ [ "pandas.read_csv", "matplotlib.pyplot.figure", "matplotlib.pyplot.savefig", "pandas.concat", "matplotlib.pyplot.close" ] ]
srkasuMsft/MLOpsTemplate
[ "0c90ed954c553a3936ecb882cbf35dfd03e14e9d" ]
[ "src/workshop/core/scoring/batch_score.py" ]
[ "\nimport os\nimport tempfile\nimport logging\nfrom azureml.core.model import Model\nimport pickle\nimport pandas as pd\nfrom azureml.core import Run\nimport os\nimport mlflow\n\ndef init():\n global model\n model_dir =os.getenv('AZUREML_MODEL_DIR')\n model_file = os.listdir(model_dir)[0]\n model_path =...
[ [ "pandas.concat", "pandas.read_json" ] ]
bayesxl/PB2
[ "54b94dc2ebae488ea5e2bf5250a9d10b89011852" ]
[ "run_ppo.py" ]
[ "\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport os\nimport random\nimport argparse\nimport matplotlib.pyplot as plt\nimport pandas as pd\nfrom datetime import datetime\n\nimport ray\nfrom ray.tune import run, sample_from\nfrom ray.tune.sc...
[ [ "pandas.DataFrame", "pandas.concat" ] ]
MerkleBros/generate-ascii-art-from-photographs
[ "966f83737d32bd7cd8858e94ac0d2b1aef24e676" ]
[ "services/image-to-ascii-api/generate_ascii_post.py" ]
[ "import base64\nimport io\nimport os\nimport json\nimport numpy as np\nfrom PIL import Image, ImageDraw, ImageFont\nfrom colour import Color\n\ndef generate_ascii_post(event, context):\n\n try:\n\n print(\"## ENVIRONMENT\")\n print(os.environ)\n print(\"## EVENT\")\n print(event)\n\n ...
[ [ "numpy.asarray" ] ]
zjzh/vega
[ "aa6e7b8c69024262fc483ee06113b4d1bd5156d8", "aa6e7b8c69024262fc483ee06113b4d1bd5156d8" ]
[ "vega/networks/pytorch/customs/modnas/arch_space/construct/torch/torch.py", "vega/networks/pytorch/customs/modnas/arch_space/torch/resnet.py" ]
[ "# -*- coding:utf-8 -*-\n\n# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/l...
[ [ "torch.nn.DataParallel", "torch.load", "torch.cuda.device_count", "torch.cuda.set_device" ], [ "torch.nn.BatchNorm2d", "torch.nn.MaxPool2d", "torch.nn.Linear", "torch.nn.AdaptiveAvgPool2d", "torch.nn.Conv2d", "torch.nn.Sequential", "torch.nn.ReLU" ] ]
CyberZHG/keras-global-self-attention
[ "f3bf21dbb1f3251b5417a8bb254dd91807b1aec5" ]
[ "keras_self_attention/seq_self_attention.py" ]
[ "from tensorflow import keras\nfrom tensorflow.keras import backend as K\n\n\nclass SeqSelfAttention(keras.layers.Layer):\n\n ATTENTION_TYPE_ADD = 'additive'\n ATTENTION_TYPE_MUL = 'multiplicative'\n\n def __init__(self,\n units=32,\n attention_width=None,\n ...
[ [ "tensorflow.keras.activations.serialize", "tensorflow.keras.backend.sum", "tensorflow.keras.constraints.get", "tensorflow.keras.backend.batch_dot", "tensorflow.keras.backend.expand_dims", "tensorflow.keras.constraints.serialize", "tensorflow.keras.backend.floatx", "tensorflow.keras...