repo_name stringlengths 6 130 | hexsha list | file_path list | code list | apis list |
|---|---|---|---|---|
Computational-Imaging-LAB/Identification-of-S100-using-T2-w-images-deep-learning- | [
"5b847d2c4b0201e0734ff6d04efa4b4a8f65558a"
] | [
"prepare_data.py"
] | [
"import glob\nfrom tqdm import tqdm\nimport nibabel as nib\nimport numpy as np\nimport preprocess\npath='/cta/users/abas/Desktop/Embeddings/'\npath+='/gliom_data/Meningiom/nii_Meningioma_directory_April2021'\npath+='/*/*/Segmentations/*FLAIR_HYP*.ni*'\nsegmentations=glob.glob(path)\nout_path='/cta/users/abas/Deskto... | [
[
"numpy.max",
"numpy.min",
"numpy.mean"
]
] |
lavoiems/lightning-bolts | [
"208e92ba3dcdbc029afd37e09ec9461fbcf3f293"
] | [
"pl_bolts/models/rl/common/distributions.py"
] | [
"\"\"\"Distributions used in some continuous RL algorithms.\"\"\"\nimport torch\n\n\nclass TanhMultivariateNormal(torch.distributions.MultivariateNormal):\n \"\"\"The distribution of X is an affine of tanh applied on a normal distribution.\n\n X = action_scale * tanh(Z) + action_bias\n Z ~ Normal(mean, var... | [
[
"torch.Size",
"torch.tanh",
"torch.log"
]
] |
elifesciences/peerscout | [
"2e899f268b4712ffb7a09b171de3f3841337d65d"
] | [
"tests/docvec_model/Doc2VecTransformer_test.py"
] | [
"import logging\n\nimport pytest\n\nimport numpy as np\nfrom sklearn.metrics.pairwise import cosine_similarity\n\nfrom peerscout.docvec_model.Doc2VecTransformer import (\n Doc2VecTransformer\n)\n\nRELATED_TEXTS = [\n 'life sciences may include research subjects such as mice',\n 'life sciences may also look... | [
[
"numpy.mean",
"sklearn.metrics.pairwise.cosine_similarity"
]
] |
Tupi14/VAEP | [
"b0a27dc0c0c4f98e7d0c9c68c65ab63830ffac5a"
] | [
"socceraction/classification/features.py"
] | [
"import socceraction.spadl.config as spadl\nimport pandas as pd\nimport numpy as np\n\n\n_spadlcolumns =[\"game_id\",\"period_id\",\n \"time_seconds\",\"timestamp\",\n \"team_id\",\"player_id\",\"start_x\",\"start_y\",\n \"end_x\",\"end_y\",\"result_id\",\"re... | [
[
"numpy.divide",
"pandas.DataFrame",
"numpy.sqrt",
"pandas.concat"
]
] |
Claybarn/permute | [
"292d1925f27f91f1971baac4b27d10731716be2d"
] | [
"permute/data/__init__.py"
] | [
"\"\"\"Standard test data.\n\nFor more information, see\n\n - http://www.wiley.com/legacy/wileychi/pesarin/material.html\n\n\"\"\"\n\n\nimport os as _os\n\nimport numpy as np\n\nfrom .. import data_dir\n\n\n__all__ = ['load',\n 'kenya', ]\n\n\ndef load(f):\n r\"\"\"Load a data file located in the data ... | [
[
"numpy.zeros"
]
] |
eee4017/pytorch | [
"1de5c26814e75dcf5479a6732ed5df6ec768a547"
] | [
"test/run_test.py"
] | [
"#!/usr/bin/env python3\n\nimport argparse\nimport copy\nfrom datetime import datetime\nimport json\nimport modulefinder\nimport os\nimport shutil\nimport signal\nimport subprocess\nimport sys\nimport tempfile\n\nimport torch\nfrom torch.utils import cpp_extension\nfrom torch.testing._internal.common_utils import T... | [
[
"torch.distributed.is_available",
"torch.distributed.is_nccl_available",
"torch.distributed.is_mpi_available",
"torch.distributed.is_gloo_available",
"torch.utils.cpp_extension.verify_ninja_availability",
"torch.cuda.device_count",
"torch.testing._internal.common_utils.set_cwd",
"t... |
wzy810103882/MegaDepth | [
"ef57fd4a568084fc7e93f6bf1caf67dcf19ac6c1"
] | [
"models/HG_model.py"
] | [
"import numpy as np\nimport torch\nimport os\nfrom torch.autograd import Variable\nfrom .base_model import BaseModel\nimport sys\nimport pytorch_DIW_scratch\n\nclass HGModel(BaseModel):\n def name(self):\n return 'HGModel'\n\n def __init__(self, opt):\n BaseModel.initialize(self, opt)\n\n ... | [
[
"torch.mul",
"torch.sqrt",
"torch.pow",
"torch.cuda.FloatTensor",
"torch.div",
"torch.nn.parallel.DataParallel",
"torch.exp",
"torch.sum"
]
] |
sharp-rmf/fleet_driver_mir | [
"ca4ee124510a33f8da44b112cf825b7c8b3e8315"
] | [
"fleet_driver_mir/jsontocsv.py"
] | [
"import json\nimport sys\nimport pandas as pd\n\nif len(sys.argv)!=2:\n print(f'Please supply one json file')\n exit()\ntry:\n f=pd.read_json(sys.argv[1])\n new_file=f'{sys.argv[1]}'[:-4]+'csv'\n print(f'saving to {new_file}')\n f.to_csv(f'{sys.argv[1]}'[:-4]+'csv')\nexcept:\n print(f'Could not... | [
[
"pandas.read_json"
]
] |
deebuls/pytorch-classification-uncertainty | [
"06fb2f6a2ceeabb06b17a0767078699ae61dbdaa"
] | [
"losses.py"
] | [
"import torch\nimport torch.nn.functional as F\nfrom helpers import get_device\n\n\ndef relu_evidence(y):\n return F.relu(y)\n\n\ndef exp_evidence(y):\n return torch.exp(torch.clamp(y, -10, 10))\n\n\ndef softplus_evidence(y):\n return F.softplus(y)\n\n\ndef kl_divergence(alpha, num_classes, device=None):\n... | [
[
"torch.nn.functional.softplus",
"torch.clamp",
"torch.ones",
"torch.digamma",
"torch.tensor",
"torch.nn.functional.relu",
"torch.lgamma",
"torch.sum"
]
] |
celine-alameda/HOI_toolbox | [
"6cc06c6d0f81746d3fcb92005da6d819faa9b16b"
] | [
"toolbox/hoi_toolbox.py"
] | [
"\"\"\"Entry point for the HOI_Toolbox. Fir\"\"\"\nimport numpy as np\nimport pandas as pd\nimport scipy.io\nimport time\nfrom toolbox.higher_order_information.Oinfo import OInfoCalculator\nfrom toolbox.higher_order_information.dOinfo import DOInfoCalculator\nfrom toolbox.higher_order_information.local_o_info impor... | [
[
"numpy.array",
"numpy.genfromtxt",
"pandas.read_csv"
]
] |
BigBugX/TensorFlow_MobileNetV2_PortraitMatting | [
"2f299900fd50bb32806cd05a725f42e6cc0cd91d"
] | [
"portrait_plus.py"
] | [
"__author__ = 'Will@PCVG'\n# An implementation based on \"TF_PetroWU\"\n\nimport numpy as np\nimport scipy.io as sio\nimport os\nfrom PIL import Image\nimport math\nfrom scipy import misc\n\nclass BatchDatset:\n imgs = []\n max_batch = 0\n batch_size = 1\n cur_imgs = []\n cur_labels = []\n cur_bat... | [
[
"numpy.max",
"numpy.array",
"numpy.uint8",
"numpy.zeros",
"numpy.round",
"scipy.io.loadmat",
"numpy.min",
"numpy.mean"
]
] |
philip-fu/UniTrack | [
"9bc78d162251195650a4af76ec35cba97ba3fc44"
] | [
"tools/gen_mot16_gt.py"
] | [
"import os.path as osp\nimport os\nimport numpy as np\n\n# Modify here\nmot16_root = 'C:/Users/Philip Fu/datasets/MOT16/images'\nseq_root = osp.join(mot16_root, 'train')\n\nlabel_root = osp.join(mot16_root, 'obs', 'gt', 'train')\nos.makedirs(label_root, exist_ok=True)\nseqs = [s for s in os.listdir(seq_root)]\n\nti... | [
[
"numpy.loadtxt"
]
] |
TiagoTostas/NeuroKit | [
"664350463fc1c03eb81f0bba37296762be7c81ae",
"664350463fc1c03eb81f0bba37296762be7c81ae"
] | [
"neurokit2/ecg/ecg_fixpeaks.py",
"neurokit2/complexity/embedding.py"
] | [
"# - * - coding: utf-8 - * -\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport matplotlib.patches\n\n\ndef ecg_fixpeaks(rpeaks, sampling_rate=1000, iterative=True, show=False):\n \"\"\"Correct R-peaks location based on their interval (RRi).\n\n Identify erroneous inter-beat-int... | [
[
"numpy.max",
"numpy.concatenate",
"numpy.pad",
"numpy.delete",
"numpy.array",
"numpy.zeros",
"pandas.DataFrame",
"numpy.min",
"numpy.mean",
"matplotlib.pyplot.figure",
"numpy.logical_and",
"numpy.any",
"numpy.ediff1d",
"numpy.ravel",
"numpy.arange",
... |
mkirby42/financeApp | [
"34759d43899fc3b067a83476a6371f1def5bbd21"
] | [
"financeApp/pages/page_1.py"
] | [
"import dash\nimport dash_core_components as dcc\nimport dash_html_components as html\nfrom dash.dependencies import Input, Output\nfrom app import app\nimport datetime\nimport pandas as pd\nfrom pandas_datareader import data as wb\nimport plotly.graph_objects as go\nfrom alpha_vantage.timeseries import TimeSeries\... | [
[
"pandas.DataFrame"
]
] |
veecos1/Grinstead_And_Snell_Python | [
"1ee23dc4a8db14e5e139e4992b6a08b4d1ae7a48"
] | [
"Lesson 2/Set 1/2.py"
] | [
"import random as ra\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nsimulations = 1000\n\nthird = 0\nfourth = 0\nfifth = 0\nsixth = 0\ntwentieth = 0\n\nfor i in range(simulations):\n spin = ra.random()\n if spin < 1/3:\n third += 1\n elif spin < (1/3 + 1/4):\n fourth +=1\n elif sp... | [
[
"matplotlib.pyplot.show"
]
] |
kirill-pinigin/NeuralPhotoFilter | [
"a28f136eca25958e1836994ee2d4dab08f7c2b9d"
] | [
"NeuralBlocks.py"
] | [
"import torch\nimport torch.nn as nn\nfrom torch.nn import Parameter\nimport torch.nn.functional as F\nimport numpy as np\n\nclass Identity(torch.nn.Module):\n def __init__(self):\n super(Identity, self).__init__()\n\n def forward(self, x):\n return x\n\n\nclass Flatten(nn.Module):\n def forw... | [
[
"torch.nn.Linear",
"torch.round",
"torch.cat",
"torch.nn.LeakyReLU",
"torch.nn.BatchNorm2d",
"torch.nn.Parameter",
"torch.sigmoid",
"numpy.histogram",
"torch.mul",
"torch.sqrt",
"torch.nn.ConvTranspose2d",
"torch.abs",
"torch.nn.ReflectionPad2d",
"torch.Tens... |
infradust/s3access | [
"86d15d01480484e14c3d97eadc4d231da4b80ff9"
] | [
"tests/test_pandas_reader.py"
] | [
"import tempfile\nimport unittest\nfrom datetime import date, datetime\n\nimport numpy as np\nimport pandas as pd\n\nfrom s3access.reader import Options\nfrom s3access.s3pandas.reader import Pandas, empty\n\n\nclass StrictPandasReader(unittest.TestCase):\n\n def test_categorical_combine(self):\n a = b\"a\... | [
[
"pandas.DataFrame",
"pandas.Series",
"numpy.all",
"pandas.read_parquet",
"numpy.dtype"
]
] |
niklasmaki/BGCN | [
"a9e28f138319fd660e212110952fb67385c33ddf"
] | [
"BGCN_main.py"
] | [
"'''\nCopyright (C) 2019. Huawei Technologies Co., Ltd and McGill University. All rights reserved.\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the MIT License.\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even th... | [
[
"tensorflow.set_random_seed",
"numpy.random.seed"
]
] |
praeclarumjj3/OLIE | [
"c0a27e7409f7db51b190bfac114677cb7b5dd669"
] | [
"modules/solov2/solo_utils.py"
] | [
"import torch\nimport numpy as np\nimport torch.nn.functional as F\nfrom PIL import Image\nimport os\nfrom scipy.io import loadmat\nimport matplotlib.pyplot as plt\nfrom torch.autograd import Variable\nimport collections\nimport torchvision.transforms as transforms\n\ndef visualize_maps(maps, name):\n x = maps.c... | [
[
"numpy.concatenate",
"numpy.uint8",
"numpy.array",
"numpy.empty",
"numpy.zeros",
"torch.is_tensor",
"scipy.io.loadmat",
"numpy.tile",
"numpy.nonzero",
"numpy.diff",
"numpy.cumsum",
"numpy.int32",
"torch.nn.functional.max_pool2d",
"torch.exp",
"numpy.asan... |
ashva7/data_analysis | [
"aefe1bd4f99f6f934b16c89eb90bc34321f51f94"
] | [
"data_analysis/_util.py"
] | [
"import array\nfrom threading import Thread\nfrom collections import defaultdict\nimport numpy as np\nimport scipy.sparse\n\nfrom tweepy.error import RateLimitError\nfrom PyQt5 import QtWidgets, QtCore\n\ndef get_text_cleaned(tweet):\n text = tweet['text']\n\n slices = []\n #Strip out the urls.\n if 'ur... | [
[
"numpy.asarray",
"numpy.frombuffer"
]
] |
yniad/Monte-Carlo-Tree-Search | [
"60ed3fc68aec7036b29d5360ed25296adc9958fb"
] | [
"codigos/_agent.py"
] | [
"import numpy as np\nimport chess\n\n\nclass simple_agent():\n def get_move_values(self,board,both_players=False):\n moves=list(board.legal_moves)\n values = np.zeros([len(moves),2])\n for i,move in enumerate(moves):\n whites=0\n blacks=0\n b=str(board).repla... | [
[
"numpy.concatenate",
"numpy.argmax"
]
] |
lingtengqiu/Open-PIFuhd | [
"3a66b647bcf5591e818af62735e64a93c4aaef85"
] | [
"engineer/models/PIFu/BasePIFu.py"
] | [
"import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom engineer.utils.geometry import index, orthogonal, perspective\nfrom torch.nn import init\nclass _BasePIFuNet(nn.Module):\n def __init__(self,\n projection_mode:str='orthogonal',\n error_term:str='mse',\n ... | [
[
"torch.nn.MSELoss",
"torch.nn.init.constant_",
"torch.nn.init.kaiming_normal_",
"torch.nn.init.normal_",
"torch.nn.BCELoss",
"torch.nn.init.orthogonal_",
"torch.nn.init.xavier_normal_"
]
] |
greembow/skynet_mod_bot_discord | [
"fa5c0acef497228b72a6456c1bd4df7f3d94adc6"
] | [
"train.py"
] | [
"import nltk\r\nnltk.download('punkt')\r\nnltk.download('wordnet')\r\nfrom nltk.stem import WordNetLemmatizer\r\nlemmatizer = WordNetLemmatizer()\r\nimport json\r\nimport pickle\r\n\r\nimport numpy as np\r\nfrom keras.models import Sequential\r\nfrom keras.layers import Dense, Activation, Dropout\r\nfrom keras.opti... | [
[
"numpy.array"
]
] |
thisis-nkul/ML-DL-implementation | [
"235c8c57666efe3666f08ffd047e2df776ea485e"
] | [
"MLlib/loss_func.py"
] | [
"import numpy as np\nfrom MLlib.activations import Sigmoid\nfrom MLlib import Tensor\nfrom MLlib import autograd\nfrom MLlib.utils.misc_utils import unbroadcast\n\n\nclass MeanSquaredError(autograd.Function):\n \"\"\"\n Calculate Mean Squared Error.\n \"\"\"\n\n __slots__ = ()\n\n @staticmethod\n ... | [
[
"numpy.square",
"numpy.zeros_like",
"numpy.dot",
"numpy.log",
"numpy.cosh",
"numpy.sum",
"numpy.tanh",
"numpy.sign",
"numpy.power",
"numpy.abs",
"numpy.absolute"
]
] |
theoseo/Online-Realtime-Action-Recognition-based-on-OpenPose | [
"19f51a4b083943d550c9573307be21880bd5b920"
] | [
"Pose/pose_visualizer.py"
] | [
"# -*- coding: UTF-8 -*-\nimport cv2 as cv\nimport numpy as np\nimport tensorflow as tf\nfrom .coco_format import CocoPart, CocoColors, CocoPairsRender\nfrom .pose_estimator import estimate\n\n\nclass TfPoseVisualizer:\n # the thickness of showing skeleton\n Thickness_ratio = 2\n\n def __init__(self, graph... | [
[
"numpy.zeros",
"tensorflow.get_default_graph",
"numpy.log",
"tensorflow.GraphDef",
"numpy.ones",
"tensorflow.Session",
"tensorflow.import_graph_def",
"numpy.copy",
"tensorflow.gfile.GFile"
]
] |
nitrogl/CoSimul_Platform | [
"41848210deae900a69c5be61e84eeab645e15fc3"
] | [
"SimDSE/analysis.py"
] | [
"'''\nCreated on Jul. 23, 2019\nData analysis of the simulation results.\n\n@file analysis.py\n@author Evandro de Souza\n@date 2019.07.23 \n@version 0.1\n@company University of Alberta - Computing Science\n'''\n\nimport matplotlib.pyplot as plt\nimport pandas as pd\nimport sys\n\n\nphasor = 'Phasor_1_001'\n... | [
[
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.tight_layout",
"pandas.HDFStore",
"matplotlib.pyplot.subplots_adjust"
]
] |
guillefix/neural-tangents | [
"f22fd3c6b0ee3757b34d2beefe4a7ee4a6cc82d6"
] | [
"examples/function_space.py"
] | [
"# Copyright 2019 Google LLC\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# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed ... | [
[
"numpy.zeros"
]
] |
Praneethp09/Geo_Test | [
"746323b43e651f1357f27fc2c0c7f5cdd89d5a1a"
] | [
"trimmed_match/design/tests/matched_pairs_rmse_test.py"
] | [
"# Copyright 2020 Google LLC.\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# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed... | [
[
"pandas.DataFrame"
]
] |
mcclow12/chatbot | [
"63d3ca2102d30e9af7b4e4e8a43af3041e578ceb"
] | [
"deploy/recommender_app/app/recommender.py"
] | [
"from heapq import nlargest\n\nimport numpy as np\nfrom pyxdameraulevenshtein import damerau_levenshtein_distance\n#\nimport pickle\n#\n\n\nclass Recommender:\n def __init__(self):\n\n self.V = np.load('./V.npy')\n self.title_to_id = pickle.load(open('title_to_id.p', 'rb'))\n self.movieId_to... | [
[
"numpy.linalg.norm",
"numpy.load"
]
] |
Wayne-Zen/Microbiome-Pipeline | [
"9b188975eb873312c90012dba1d2d1ca44ce44ed"
] | [
"my-data/preprocess_for_galaxy.py"
] | [
"import os\nimport sys\nimport pandas as pd\nfrom itertools import islice\n\n#trim primer\n#change header\n#count sequence number\ndef preprocess_for_galaxy(meta_data_dir, input_dir, output_dir):\n meta_data = pd.read_csv(os.path.join(meta_data_dir, 'meta_data.txt') , sep='\\t')\n \n cnt_list = []\n for... | [
[
"pandas.DataFrame"
]
] |
xiaofengShi/Gans | [
"03938440f5f83da22602a0b3b78d689f310c1a95"
] | [
"pytorch_sketch2paints/util/image_pool.py"
] | [
"import random\nimport torch\n\n\"\"\" \nThis program desigined to make the imagepool\nthe return_images contains many images, each image is the generated image and the num is pool size\nreturn is a fake image but maybe not generated by this batch input image\n\"\"\"\nclass ImagePool():\n def __init__(self, poo... | [
[
"torch.cat",
"torch.unsqueeze"
]
] |
chessking94/LichessLastMonth | [
"06ac8b0e826088ffcf02d4aa611b75523fb5e906"
] | [
"DownloadLastMonthLichess.py"
] | [
"import pyodbc as sql\nimport pandas as pd\nimport datetime as dt\nfrom urllib import request, error\nimport requests\nimport os\nimport json\n\ndef main(): \n my_games_flag = 0 # 0/1 value; if 0 use below user, if 1 use file\n\n conn = sql.connect('Driver={ODBC Driver 17 for SQL Server};Server=HUNT-PC1;Data... | [
[
"pandas.read_sql"
]
] |
odednoam/Adafruit_Blinka_Displayio | [
"3329de4221e8edbfd235e01c826528eccc1779bb"
] | [
"displayio/display.py"
] | [
"# SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams for Adafruit Industries\n#\n# SPDX-License-Identifier: MIT\n\n\"\"\"\n`displayio.display`\n================================================================================\n\ndisplayio for Blinka\n\n**Software and Dependencies:**\n\n* Adafruit Blinka:\n http... | [
[
"numpy.dstack",
"numpy.array"
]
] |
BrunoSanchez/capsule_N1 | [
"a5ee3b74afc27de1a954ae2f9f96c278a4723226"
] | [
"tests/test_plot.py"
] | [
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# test_plot.py\n#\n# Copyright 2017 Bruno S <bruno@oac.unc.edu.ar>\n#\n# This file is part of ProperImage (https://github.com/toros-astro/ProperImage)\n# License: BSD-3-Clause\n# Full Text: https://github.com/toros-astro/ProperImage/blob/master/LICENSE.txt\n#\n\... | [
[
"matplotlib.testing.decorators.check_figures_equal",
"numpy.sum",
"numpy.ravel",
"numpy.arange",
"numpy.size",
"numpy.sqrt",
"matplotlib.pyplot.gca"
]
] |
collinskatie/mlmi4_MAML_reproduce | [
"3cbda95ca380de11fce63d961de19847752b526c"
] | [
"Multi_Dim_Sine/data.py"
] | [
"\n'''\nData loaders for sinusoid regression with multiple dimensional sines\nHeavily borrowed and modified from: https://github.com/AdrienLE/ANIML/blob/master/ANIML.ipynb\n'''\n\nimport numpy as np\nimport torch\nfrom math import pi as PI\n\n# using parameters from original MAML Section 5.1 (https://arxiv.org/pdf/... | [
[
"numpy.linspace",
"numpy.random.uniform",
"numpy.sin",
"torch.Tensor"
]
] |
TowKnee0/Osu-Mania-Bot | [
"7d027121368788c4dca3dbf2a0b59b71f94b7984"
] | [
"main.py"
] | [
"import cv2\nimport numpy as np\nimport time\nimport key_press\nimport mss\n\nfrom typing import Tuple, List\n\n\nclass OsuManiaBot(object):\n \"\"\" A simple bot for playing Osu mania. Success rate near 100% using the provided skin.\n\n Instance Attributes:\n - bbox: coordinates in the form (x1, y1, x2,... | [
[
"numpy.all"
]
] |
Artisan-Lab/SMTimer | [
"8e0bbb854afd360dcc61d6b098c4ae8931bae14c"
] | [
"dgl_treelstm/util.py"
] | [
"import torch as th\n\n\ndef extract_root(batch, device, logits):\n g = batch.graph\n root_idx = []\n result_idx = 0\n for idx in g.batch_num_nodes:\n root_idx.append(result_idx)\n result_idx = result_idx + idx\n root_idx = th.LongTensor(root_idx).to(device)\n batch_label = th.index_... | [
[
"torch.index_select",
"torch.LongTensor"
]
] |
oplatek/ALI | [
"193b666f62236fa1837613beb807d9dcdf978ce6"
] | [
"experiments/semi_supervised_svhn.py"
] | [
"import argparse\n\nimport numpy\nfrom fuel.datasets import H5PYDataset\nfrom fuel.schemes import ShuffledScheme, ShuffledExampleScheme\nfrom fuel.streams import DataStream\nfrom sklearn.svm import LinearSVC\n\n\ndef main(dataset_path, use_c, log_min, log_max, num_steps):\n train_set = H5PYDataset(\n data... | [
[
"numpy.exp",
"numpy.mean",
"numpy.std",
"numpy.linspace",
"sklearn.svm.LinearSVC"
]
] |
combofish/chips-get | [
"6005f24d09edda3f1f54c6603205b2f854ec3b3f"
] | [
"Python3/performance/get-pi.py"
] | [
"import sys\nimport numpy as np\nimport random\nimport time\n\ndef estimate_nbr_points_in_quarter_circle(nbr_estimates):\n nbr_trials_in_quarter_unit_circle = 0\n\n for step in range(int(nbr_estimates)):\n x = random.uniform(0,1)\n y = random.uniform(0,1)\n is_in_unit_circle = pow(x,2) + ... | [
[
"numpy.random.seed",
"numpy.sum",
"numpy.random.uniform"
]
] |
LukasBommes/PV-Drone-Inspect | [
"af07a5e5690326837d1e9b26bdbb32f5582e89fd"
] | [
"tests/unit/test_gps.py"
] | [
"import unittest\nimport numpy as np\nfrom hypothesis import given\nimport hypothesis.strategies as some\nimport hypothesis.extra.numpy as some_np\n\nfrom extractor.gps import gps_to_ltp, gps_from_ltp, \\\n interpolate_gps\n\n\nclass TestGps(unittest.TestCase):\n \n @given(\n some_np.arrays(\n ... | [
[
"numpy.allclose",
"numpy.array"
]
] |
akshayka/gavel | [
"40a22a725f2e70478483e98c9b07c6fc588e0c40"
] | [
"scheduler/policies/max_min_fairness.py"
] | [
"import os, sys\nsys.path.append(os.path.dirname(os.path.realpath(__file__)))\n\nimport cvxpy as cp\nimport numpy as np\n\nfrom policy import Policy, PolicyWithPacking\nfrom proportional import ProportionalPolicy\n\nclass MaxMinFairnessPolicy(Policy):\n\n def __init__(self, solver):\n self._name = 'MaxMin... | [
[
"numpy.full",
"numpy.array",
"numpy.reshape",
"numpy.zeros",
"numpy.tile",
"numpy.multiply",
"numpy.prod",
"numpy.vstack"
]
] |
ArabicaCapitalOne/arabica_backend | [
"8810f2907ed2fff2adb033119a42a046bec68240"
] | [
"predict_algorithm.py"
] | [
"# This is the prediction algorithm to foresee the comparative consumption, impletement by TensorFlow\nimport tensorflow as tf\nimport json, csv\nimport output\n\nmonth = []\namount = []\nwith open('data.csv') as datafile:\n\treader = csv.DictReader(datafile)\n\tfor row in reader:\n\t\tmonth.append(float(row['month... | [
[
"tensorflow.Session",
"tensorflow.Variable",
"tensorflow.placeholder",
"tensorflow.global_variables_initializer",
"tensorflow.square",
"tensorflow.train.GradientDescentOptimizer"
]
] |
mszhanyi/onnxruntime | [
"6f85d3e5c81c919022ac4a77e5a051da8518b15d",
"6f85d3e5c81c919022ac4a77e5a051da8518b15d"
] | [
"orttraining/orttraining/test/python/orttraining_test_ortmodule_deepspeed_zero_stage_1.py",
"onnxruntime/test/providers/cpu/rnn/LSTM.py"
] | [
"\"\"\"Test for a simple ORTModule using the high-level DeepSpeed API.\n\nTo run on the local GPU(s):\n\n```\n$ pip install deepspeed\n$ deepspeed orttraining_test_ortmodule_deepspeed_zero_stage_1.py \\\n --deepspeed_config=orttraining_test_ortmodule_deepspeed_zero_stage_1_config.json\n```\n\"\"\"\nimport argpar... | [
[
"torch.nn.Linear",
"torch.distributed.init_process_group",
"torch.no_grad",
"torch.manual_seed",
"torch.nn.ReLU",
"torch.cuda.is_available",
"torch.distributed.barrier",
"torch.nn.CrossEntropyLoss"
],
[
"numpy.concatenate",
"numpy.clip",
"numpy.array",
"numpy.em... |
PerryXDeng/project_punyslayer | [
"79529b020ca56a5473dbb85ac7155bc03dc5023a",
"79529b020ca56a5473dbb85ac7155bc03dc5023a"
] | [
"feature_cluster_algos.py",
"legacy_code/tf_mnist/generate_datasets.py"
] | [
"import pickle\nimport os\nimport numpy as np\nimport cupy as cp\nimport tensorflow as tf\nimport cv2 as cv\n\nfrom generate_datasets import try_draw_single_font\nfrom unicode_info.database import generate_data_for_experiment\nfrom cluster_metrics import calculate_mean_iou, calculate_mean_precision\n\nimport time\n... | [
[
"numpy.concatenate",
"numpy.full",
"numpy.linalg.norm",
"numpy.matmul",
"numpy.zeros",
"numpy.load",
"numpy.save",
"numpy.nonzero",
"numpy.multiply",
"numpy.where",
"numpy.mean",
"numpy.std",
"numpy.ix_",
"matplotlib.pyplot.show",
"tensorflow.keras.model... |
YoushaaMurhij/VOTR_Inference | [
"dbf6ddc66f2644c1897a4307e30e2ae781ebacf6"
] | [
"VOTR/pcdet/utils/loss_utils.py"
] | [
"import numpy as np\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\nfrom . import box_utils\n\n\nclass SigmoidFocalClassificationLoss(nn.Module):\n \"\"\"\n Sigmoid focal cross entropy loss.\n \"\"\"\n\n def __init__(self, gamma: float = 2.0, alpha: float = 0.25):\n \"\"\... | [
[
"torch.sigmoid",
"numpy.array",
"torch.isnan",
"torch.norm",
"torch.le",
"torch.pow",
"torch.clamp",
"torch.abs",
"torch.from_numpy",
"torch.nn.functional.cross_entropy",
"torch.log",
"torch.where",
"torch.sum"
]
] |
hatimwen/CV_Project_wenht | [
"4463797193107fdaab8394770dd382c9c5ca09ee"
] | [
"utils/mixup.py"
] | [
"import numpy as np\nimport torch\nimport torch.nn as nn\n\ndef mixup(batch_x, batch_y, alpha=0.5, use_cuda=True):\n '''\n batch_x:批样本数,shape=[batch_size,channels,width,height]\n batch_y:批样本标签,shape=[batch_size]\n alpha:生成lam的beta分布参数,一般取0.5效果较好\n use_cuda:是否使用cuda\n \n returns:\n mixed ... | [
[
"numpy.random.beta",
"torch.randperm"
]
] |
youweiliang/norm_robustness | [
"a258ae64bb5cef1feeb120e3ec088bd311853643"
] | [
"AT/train_adv_cifar10_wd.py"
] | [
"from __future__ import print_function\nimport os\nimport pickle\nimport argparse\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torchvision\nimport torch.optim as optim\nfrom torchvision import datasets, transforms\n\n# from models.wideresnet import *\nfrom models import *\nfrom loss... | [
[
"torch.device",
"torch.no_grad",
"torch.manual_seed",
"torch.nn.functional.cross_entropy",
"torch.cuda.is_available",
"torch.utils.data.DataLoader"
]
] |
rangsimanketkaew/moleview | [
"686161680284fe81f5d406d4119a45764ab6e14d"
] | [
"moleview/src/draw.py"
] | [
"\"\"\"\r\nMIT License\r\n\r\nCopyright (c) 2020-2021 Rangsiman Ketkaew\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the righ... | [
[
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show",
"matplotlib.pyplot.axis"
]
] |
google-research/reverse-engineering-neural-networks | [
"5449da47db051cb073786615b2de52c9fdade319"
] | [
"renn/data/datasets.py"
] | [
"\"\"\"Datasets.\"\"\"\n\nimport tensorflow_datasets as tfds\nimport tensorflow_text as text\nimport tensorflow as tf\n\nimport os\n\nfrom renn import utils\nfrom renn.data.tokenizers import load_tokenizer, SEP, tensor_punctuation_separator\nfrom renn.data import data_utils\n\n__all__ = [\n 'ag_news', 'goemotion... | [
[
"tensorflow.size",
"tensorflow.convert_to_tensor",
"tensorflow.concat",
"tensorflow.where",
"tensorflow.equal",
"tensorflow.transpose",
"tensorflow.data.Dataset.from_generator",
"tensorflow.constant",
"tensorflow.squeeze",
"tensorflow.cast"
]
] |
mhauru/uhlmann-fidelities-from-tensor-networks | [
"cc30882db529fcc787418b172550ae91bd34dcba"
] | [
"plot_quench_magnetization.py"
] | [
"import numpy as np\nimport scipy.integrate as integrate\nimport pickle\nimport datetime\nimport sys\nimport matplotlib.cm as cm\nimport matplotlib.colors as colors\nimport matplotlib.gridspec as gridspec\nfrom matplotlib import pyplot as plt\nfrom ncon import ncon\nfrom tntools import datadispenser\n\nnoshow = \"n... | [
[
"numpy.array",
"numpy.ceil",
"numpy.linalg.norm",
"matplotlib.pyplot.savefig",
"numpy.load",
"numpy.real",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"numpy.abs",
"matplotlib.pyplot.show",
"numpy.imag"
]
] |
poketorena/deep-learning-from-scratch | [
"1142428f121e5c57499ccb61a679df39044835da"
] | [
"convolution.py"
] | [
"import numpy as np\nfrom common.util import im2col\n\n\nclass Convolution:\n def __init__(self, W, b, stride=1, pad=0):\n self.W = W\n self.b = b\n self.stride = stride\n self.pad = pad\n\n def forward(self, x):\n FN, C, FH, FW = self.W.shape\n N, C, H, W = x.shape\n... | [
[
"numpy.dot"
]
] |
mberr/rank-based-evaluation | [
"76a0847eecf4350d92783e9773d6fc6b6c69ca51"
] | [
"src/kgm/models/matching/gcn_align.py"
] | [
"# coding=utf-8\n\"\"\"\nImplementation of GCN-Align.\n\nThe paper introducing the model can be found at https://www.aclweb.org/anthology/D18-1032.pdf.\n\nThe authors' implementation can be found at https://github.com/1049451037/GCN-Align and they also refer to\nhttps://github.com/1049451037/HIN-Align for an improv... | [
[
"torch.nn.ModuleDict",
"torch.nn.ModuleList"
]
] |
stas00/pytorch-lightning | [
"84c507c4df5f5c336deb19ce7f70fa02329f39f6"
] | [
"pytorch_lightning/core/step_result.py"
] | [
"from typing import Optional, Dict, Union, Sequence, Callable, MutableMapping, Any\nfrom torch import Tensor\nimport torch\nfrom copy import copy\n\n\nclass Result(Dict):\n\n def __init__(\n self,\n minimize: Optional[Tensor] = None,\n early_stop_on: Optional[Tensor] = None,\n ... | [
[
"torch.stack"
]
] |
yurynamgung/faster-rcnn-pytorch | [
"6817ffdedfa8527ea06a93782ac37ebfdb3d33af"
] | [
"model/utils/generate_anchor.py"
] | [
"import math\nimport numpy as np\n\ndef generate_anchor(feature_height, feature_width, image_size, ratio=[0.5, 1, 2], anchor_size = [128, 256, 512]):\n #---------- debug\n assert len(image_size) == 2\n #----------\n anchor_base = []\n for ratio_t in ratio:\n for anchor_size_t in anchor_size:\n... | [
[
"numpy.array",
"numpy.zeros"
]
] |
sselab2021/FMS_human_3d-skeleton_by_Azure-Kinect | [
"99520fd78a32f467cf0ada3632984304a64d5cbd"
] | [
"03_Figures_of_paper/Fig_4_1.py"
] | [
"import pandas as pd\nimport matplotlib.pyplot as plt\nfrom matplotlib import font_manager\n\n# 01. start-Data preparation\n\n# To save the CSV files that recorded the frequency of no-body frames in 'Front' and 'Side' sensors\n# Front.csv and Side.csv are saved in dataset.\nnobody_csv_file_list = [r'G:\\Dataset of ... | [
[
"matplotlib.pyplot.text",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"matplotlib.font_manager.fontManager.addfont",
"matplo... |
alantess/DDQN-BTC | [
"0fff185200dd1c16088dc322cbb7790b848c1e6d"
] | [
"agent.py"
] | [
"import numpy as np\r\nimport torch as T\r\nimport torch.nn as nn\r\nfrom networks import DDQN\r\nfrom memory import ReplayBuffer\r\nfrom sklearn.preprocessing import StandardScaler\r\n\r\nclass Agent(object):\r\n def __init__(self, lr, input_dims, n_actions,epsilon, batch_size,env,\r\n capacity=... | [
[
"sklearn.preprocessing.StandardScaler",
"numpy.arange",
"torch.tensor",
"numpy.random.random",
"torch.argmax"
]
] |
GMLC-TDC/pesgm-2019-helics-tutorial | [
"7534cc5f208e558c5f1f9b4347e93f82065be3c9"
] | [
"data/case9/case9.py"
] | [
"# -*- coding: utf-8 -*-\n# Copyright (c) 1996-2015 PSERC. All rights reserved.\n# Use of this source code is governed by a BSD-style\n# license that can be found in the LICENSE file.\n\n\"\"\"Power flow data for 9 bus, 3 generator case.\n\"\"\"\n\nfrom numpy import array\n\n\ndef case9():\n \"\"\"Power flow dat... | [
[
"numpy.array"
]
] |
Connossor/mystic-bit | [
"f57f471d3d154560d23bc9eff17fd5b8f284684c"
] | [
"mysticbit/ml.py"
] | [
"\"\"\" Core ML functions\"\"\"\nimport pandas as pd\nfrom sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor\nfrom sklearn.multioutput import MultiOutputRegressor\nfrom sklearn.pipeline import Pipeline, make_pipeline\nfrom sklearn.model_selection import LeavePGroupsOut\nfrom sklearn.preproces... | [
[
"pandas.DataFrame",
"sklearn.cluster.KMeans",
"sklearn.ensemble.GradientBoostingRegressor",
"sklearn.preprocessing.RobustScaler"
]
] |
wilko77/blocklib | [
"0fb4ef62f2b9cd6d685fadf92801ca207079843d"
] | [
"blocklib/encoding.py"
] | [
"\"\"\"Class to implement privacy preserving encoding.\"\"\"\nimport hashlib\nimport numpy as np\nfrom typing import List, Set\n\n\ndef flip_bloom_filter(string: str, bf_len: int, num_hash_funct: int):\n \"\"\"\n Hash string and return indices of bits that have been flipped correspondingly.\n\n :param stri... | [
[
"numpy.zeros"
]
] |
jameszou/unseenest | [
"24afc3dfb74c5d6ef49427f59213661dc411f929"
] | [
"src/unseen_est.py"
] | [
"from __future__ import division\nimport os, sys, random, cPickle, sets, subprocess, pandas, gzip, math, itertools\nimport numpy as np\nfrom operator import itemgetter\nfrom scipy.stats import binom_test\nfrom scipy.stats import chi2_contingency\nfrom scipy.stats import entropy\nfrom scipy.stats import poisson\nfro... | [
[
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.log",
"numpy.arange",
"scipy.stats.binom"
]
] |
nhrade/advent-of-code | [
"96a60ebb1bb4dfd0d6aabc0d71c926580c86c7e0"
] | [
"day15/chiton.py"
] | [
"import numpy as np\nfrom heapq import heappush, heappop\nfrom dataclasses import dataclass, field\nimport os\n\n\n@dataclass(order=True)\nclass PosItem:\n priority: int\n pos: tuple[int, int] = field(compare=False)\n\n\npath = os.path.join(os.path.dirname(__file__), \"input.txt\")\n\n\ndef find_path(arr):\n ... | [
[
"numpy.zeros_like",
"numpy.zeros"
]
] |
mdomarsaleem/kedro | [
"571bb8009b930e67c073115c23ae2d03942f6499"
] | [
"kedro/io/parquet_local.py"
] | [
"# Copyright 2018-2019 QuantumBlack Visual Analytics Limited\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# THE SOFTWARE IS P... | [
[
"pandas.read_parquet"
]
] |
MistQue/kendryte-model-compiler | [
"36af917defb37880037fb84330ab995ed44311e1"
] | [
"model_loader/pb/layer_list_to_k210_layer.py"
] | [
"'''\n * Copyright 2018 Canaan 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 ... | [
[
"numpy.ones"
]
] |
Johnzhjw/MOE-DGNAS | [
"3387808846fdb0dd8446117cef261b24c38d1702"
] | [
"CCMOEA.py"
] | [
"# -*- coding: utf-8 -*-\nimport numpy as np\nimport geatpy as ea # 导入geatpy库\nfrom sys import path as paths\nfrom os import path\nimport random\nfrom SurroModel import get_surrogate_model\n\npaths.append(path.split(path.split(path.realpath(__file__))[0])[0])\n\n\ndef remove_duplication(pop):\n x = pop.decoding... | [
[
"numpy.array",
"numpy.ones",
"numpy.where",
"numpy.all",
"numpy.sort",
"numpy.unique",
"numpy.cumsum",
"numpy.argsort",
"numpy.vstack"
]
] |
NimrodCarmon/isofit | [
"e9a04d328bd4171131f3ce8e8b4eadf9a6901747"
] | [
"isofit/utils/apply_oe.py"
] | [
"#! /usr/bin/env python3\n#\n# Authors: David R Thompson and Philip G. Brodrick\n#\n\nimport argparse\nimport os\nfrom os.path import join, exists, split, abspath\nfrom shutil import copyfile\nfrom datetime import datetime\nfrom spectral.io import envi\nimport logging\nimport json\nimport gdal\nimport numpy as np\n... | [
[
"numpy.isclose",
"numpy.min",
"numpy.mean",
"numpy.deg2rad",
"numpy.max",
"numpy.logical_and",
"numpy.savetxt",
"numpy.zeros",
"numpy.percentile",
"numpy.loadtxt",
"numpy.arctan2",
"numpy.floor",
"numpy.ceil",
"numpy.sum",
"numpy.rad2deg",
"numpy.one... |
s0mya/CompilerGym | [
"8a4fd04cc28f47b6b710ea8fa54f526e994ca764"
] | [
"compiler_gym/views/observation_space_spec.py"
] | [
"# Copyright (c) Facebook, Inc. and its affiliates.\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.\nimport json\nfrom typing import Callable, Optional, Union\n\nimport networkx as nx\nimport numpy as np\nfrom gym.spaces import Box, Sp... | [
[
"numpy.array",
"numpy.iinfo"
]
] |
ognpa/govhack2018 | [
"a6e2260a13225b032b3518ba4a6a5de706a96833"
] | [
"src/app.py"
] | [
"#!flask/bin/python\nfrom flask import Flask\nimport pandas as pd\nimport requests\nfrom flask import send_file\nimport matplotlib\nmatplotlib.use(\"agg\")\nfrom flask import jsonify\nimport seaborn as sns\nimport matplotlib.pyplot as plt\n#%matplotlib inline\napp = Flask(__name__)\n\n\nall_data_sets={'ato':'ato.xl... | [
[
"matplotlib.use",
"matplotlib.pyplot.savefig",
"pandas.read_excel",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show"
]
] |
FMsunyh/pysot | [
"1581d98cd5b4f09a1f3a31e45076a039558567ba"
] | [
"training_dataset/vid/par_crop.py"
] | [
"from os.path import join, isdir\nfrom os import listdir, mkdir, makedirs\nimport cv2\nimport numpy as np\nimport glob\nimport xml.etree.ElementTree as ET\nfrom concurrent import futures\nimport sys\nimport time\n\nVID_base_path = '/home/syh/train_data/ILSVRC2015'\nann_base_path = join(VID_base_path, 'Annotations/V... | [
[
"numpy.array",
"numpy.mean",
"numpy.sqrt"
]
] |
mahakbansal/ChessAlphaZero | [
"2b3f823fdc252d7fd32de0b5e4e53aece9082dd5"
] | [
"chess/tensorflow/NNet.py"
] | [
"import os\nimport shutil\nimport time\nimport random\nimport numpy as np\nimport math\nimport sys\nsys.path.append('../../')\nfrom utils import *\nfrom pytorch_classification.utils import Bar, AverageMeter\nfrom NeuralNet import NeuralNet\nfrom chess.pythonchess import chess as chess\n\n\nimport tensorflow as tf\n... | [
[
"numpy.reshape",
"numpy.zeros",
"tensorflow.Session",
"tensorflow.train.Saver",
"tensorflow.global_variables_initializer"
]
] |
simeonreusch/ztf_plan_obs | [
"fc2f6521a99d1386654400d18e8aea9dd1536e02"
] | [
"ztf_plan_obs/multiday_plan.py"
] | [
"#!/usr/bin/env python3\nimport matplotlib.pyplot as plt\nimport os\nfrom datetime import datetime, date\nfrom matplotlib.backends.backend_pdf import PdfPages\nfrom tqdm import tqdm\nfrom astropy.time import Time\nfrom astropy import units as u\nfrom ztf_plan_obs.plan import PlanObservation\nfrom ztf_plan_obs.plan ... | [
[
"matplotlib.pyplot.close",
"matplotlib.backends.backend_pdf.PdfPages",
"matplotlib.pyplot.tight_layout"
]
] |
pingguokiller/hoenas | [
"8e4969e4270f665eda0dadde4f3c69379a0a2db0"
] | [
"models/archinfo.py"
] | [
"import numpy as np\nimport utils\nimport json\nfrom models.operations import candidateNameList\n\n\n# arch is represented by 2 parts: op and edge.\nclass ArchInfo(object):\n #\n def __init__(self):\n self.NODE_SIZE = 14\n self.OP_SIZE = len(candidateNameList)\n self.CELL_SIZE = 4\n ... | [
[
"numpy.ones"
]
] |
jeromekelleher/tszip | [
"735b4459b4043b03d43222ca6a1ef0aec9a9589a"
] | [
"tscompress/compression.py"
] | [
"# MIT License\n#\n# Copyright (c) 2019 Tskit Developers\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, co... | [
[
"numpy.zeros",
"numpy.hstack",
"numpy.any",
"numpy.arange",
"numpy.searchsorted"
]
] |
surfmachine/ai | [
"c79b348ce7782c0d3c0c4421c75007be54e55693"
] | [
"src/17_dqn_branching/enjoy_lunar_lander.py"
] | [
"from tqdm import tqdm\nimport torch \nfrom branching_dqn_lunar_lander import BranchingQNetwork, TensorEnv, ExperienceReplayMemory, AgentConfig, BranchingTensorEnv\n\nll = 'LunarLander-v2'\n\nbins = 4\nenv = BranchingTensorEnv(ll, bins)\n \nagent = BranchingQNetwork(env.observation_space.shape[0], env.action... | [
[
"torch.no_grad",
"torch.argmax"
]
] |
Javesun99/HyperNets | [
"6ebe64c440c7bc1e7e2ea39c898fe90cf850d61e"
] | [
"sound-event-detection/SEDNet.py"
] | [
"import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport os\nimport numpy as np\nimport utility_functions as uf\nfrom hypercomplex_layers import QuaternionConv, QuaternionLinear, PHMConv, PHMLinear\n\n'''\nPytorch implementation of the original SELDNet: https://arxiv.org/pdf/1807.00129.pdf\nAnd... | [
[
"torch.nn.Linear",
"torch.nn.Dropout",
"numpy.array",
"torch.nn.GRU",
"torch.nn.Sigmoid",
"torch.nn.Sequential",
"torch.nn.MaxPool2d",
"torch.nn.BatchNorm2d",
"numpy.ones",
"torch.nn.ReLU",
"torch.nn.Conv2d"
]
] |
fabianrost84/pandas | [
"a5d251de3af3cf07dfec39baa343633a9989c1d5"
] | [
"pandas/core/internals/blocks.py"
] | [
"# -*- coding: utf-8 -*-\nfrom datetime import date, datetime, timedelta\nimport functools\nimport inspect\nimport re\nimport warnings\n\nimport numpy as np\n\nfrom pandas._libs import internals as libinternals, lib, tslib, tslibs\nfrom pandas._libs.tslibs import Timedelta, conversion, is_null_datetimelike\nimport ... | [
[
"pandas.core.dtypes.cast.infer_dtype_from",
"pandas.core.dtypes.common.is_float_dtype",
"pandas.core.dtypes.common.is_datetime64_dtype",
"numpy.empty",
"pandas.core.computation.expressions.where",
"pandas.core.dtypes.common.pandas_dtype",
"numpy.prod",
"pandas.core.arrays.Categoric... |
RobinMaas95/GTSRB_Visualization | [
"fa837ff94e089a936ef4f4418970d262b35f70b6"
] | [
"code/nn_interpretability/nn_interpretability/interpretation/cam/grad_cam.py"
] | [
"from torch.nn import Module\nfrom torch.nn import functional as F\nfrom torchvision import transforms\nimport torch\n\nfrom nn_interpretability.interpretation.cam.cam_base import CAMBase\n\n\nclass GradCAMInterpreter(CAMBase):\n \"\"\"\n Implements the decision-based interpretability method \"Grad-CAM\"\n ... | [
[
"torch.nn.functional.relu",
"torch.nn.functional.adaptive_avg_pool2d"
]
] |
WeiweiJin/PulseWaveSignalProcessor | [
"83d7dcc896f39b4438692f2bce207aa0132e5aea"
] | [
"PulseWaveSignalProcessor.py"
] | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Jun 16 16:37:24 2020\n\n@author: weiweijin\n\"\"\"\n\n\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt \nfrom scipy.signal import kaiserord, firwin, filtfilt\nfrom scipy import signal\n\n# %% import data\n# import wav... | [
[
"scipy.signal.firwin",
"numpy.array",
"scipy.signal.sosfilt",
"numpy.argmin",
"matplotlib.pyplot.plot",
"scipy.signal.butter",
"numpy.mean",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.figure",
"scipy.signal.filtfilt",
"numpy.multiply",
"numpy.arange",
"numpy.arg... |
wwqgtxx/Paddle | [
"109ca9d250e37e723e364366e8402c307b110169"
] | [
"python/paddle/tests/test_model.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 re... | [
[
"numpy.testing.assert_allclose",
"numpy.array",
"numpy.zeros_like",
"numpy.random.rand",
"numpy.reshape",
"numpy.random.seed",
"numpy.sum",
"numpy.testing.assert_almost_equal",
"numpy.argmax",
"numpy.random.randint",
"numpy.random.random"
]
] |
EmileDvs/pyleecan | [
"1faedde4b24acc6361fa1fdd4e980eaec4ca3a62"
] | [
"Tests/Plot/test_PostPlot.py"
] | [
"from os.path import join\n\nimport pytest\n\nfrom numpy import exp, sqrt, pi\n\nimport matplotlib.pyplot as plt\n\nfrom pyleecan.Classes.Simu1 import Simu1\n\nfrom pyleecan.Classes.InputCurrent import InputCurrent\n\nfrom pyleecan.Classes.MagFEMM import MagFEMM\nfrom pyleecan.Classes.ForceMT import ForceMT\n\nfrom... | [
[
"numpy.sqrt",
"numpy.exp",
"matplotlib.pyplot.subplots"
]
] |
loveisacat/pymarl | [
"383af616cbf5b1c878b62089baf15231a29f9a82"
] | [
"src/run.py"
] | [
"import datetime\nimport os\nimport pprint\nimport time\nimport threading\nimport torch as th\nfrom types import SimpleNamespace as SN\nfrom utils.logging import Logger\nfrom utils.timehelper import time_left, time_str\nfrom os.path import dirname, abspath\n\nfrom learners import REGISTRY as le_REGISTRY\nfrom runne... | [
[
"torch.cuda.is_available"
]
] |
CSUBioGroup/SDLDA- | [
"ceb8fc1713b7eb90b858cec6b9418ff76524842d"
] | [
"LOOCV/data_input_cv.py"
] | [
"# encoding=utf-8\r\nimport random\r\nimport pickle\r\nimport numpy as np\r\nfrom hyperparams import Hyperparams as params\r\n\r\nrandom.seed(params.static_random_seed)\r\nneg_pos_ratio = params.neg_pos_ratio\r\ntrain_val_ratio = params.train_val_ratio\r\n\r\n\r\nclass DataLoader:\r\n def __init__(self, use_sid... | [
[
"numpy.array",
"numpy.stack",
"numpy.load"
]
] |
VolkerH/LLSpy | [
"d14b2387058f679981ff08af546570527bc723d9"
] | [
"llspy/otf.py"
] | [
"from .exceptions import OTFError\nfrom .util import load_lib\nfrom datetime import datetime, timedelta\n\nimport numpy as np\nimport re\nimport ctypes\nimport os\nimport logging\n\nlogger = logging.getLogger(__name__)\n\n\ntry:\n import pathlib as plib\n\n plib.Path()\nexcept (ImportError, AttributeError):\n... | [
[
"numpy.abs"
]
] |
qqaatw/pytorch | [
"44764f131b040a41a6dcf1304bb635c574bf5a3b",
"44764f131b040a41a6dcf1304bb635c574bf5a3b"
] | [
"test/test_cuda.py",
"test/quantization/core/test_quantized_tensor.py"
] | [
"# Owner(s): [\"module: cuda\"]\n\nfrom itertools import repeat, chain, product\nfrom typing import NamedTuple\nimport collections\nimport contextlib\nimport ctypes\nimport gc\nimport io\nimport os\nimport pickle\nimport queue\nimport sys\nimport tempfile\nimport threading\nimport unittest\n\nimport torch\nimport t... | [
[
"torch.cuda.graph",
"torch.cat",
"torch.cuda.amp.autocast",
"torch.triu_indices",
"torch.cuda.comm.broadcast",
"torch.cuda.device",
"torch.bmm",
"torch.cuda.default_stream",
"torch.cuda.comm.gather",
"torch.load",
"torch.nn.parallel.scatter_gather.gather",
"torch.ge... |
consbio/clover | [
"f8da46fa67240cc3f1ef0460e3a249e57e5f7224"
] | [
"trefoil/netcdf/variable.py"
] | [
"from bisect import bisect_left, bisect_right\n\nimport numpy\nfrom datetime import date, datetime\nimport pytz\nfrom affine import Affine\nfrom netCDF4 import num2date, date2num, Variable\nfrom pyproj import Proj\nimport six\n\nfrom trefoil.geometry.bbox import BBox\nfrom trefoil.utilities.proj import is_latlong\n... | [
[
"numpy.array",
"numpy.isclose",
"numpy.arange",
"numpy.append",
"numpy.searchsorted"
]
] |
VitaminBrad/AMICI | [
"d220128f262747ad9f15db83377e4f8a5d2006d3"
] | [
"python/amici/pandas.py"
] | [
"\"\"\"\nPandas Wrappers\n---------------\nThis modules contains convenience wrappers that allow for easy interconversion\nbetween C++ objects from :mod:`amici.amici` and pandas DataFrames\n\"\"\"\n\nimport pandas as pd\nimport numpy as np\nimport math\nimport copy\n\nfrom typing import List, Union, Optional, Dict,... | [
[
"pandas.DataFrame.from_records",
"numpy.isnan"
]
] |
bklebel/keras | [
"f2af6049de7152fde27c54b8f7b0925793e049a5"
] | [
"tests/keras/backend/backend_test.py"
] | [
"import pytest\nfrom numpy.testing import assert_allclose\nimport numpy as np\nimport scipy.signal as signal\nimport scipy.sparse as sparse\nimport warnings\nfrom keras.utils.test_utils import keras_test\n\nfrom keras import backend as K\nfrom keras.backend import floatx, set_floatx, variable\nfrom keras.utils.conv... | [
[
"numpy.repeat",
"numpy.testing.assert_allclose",
"numpy.dot",
"numpy.random.choice",
"numpy.random.rand",
"numpy.array_equal",
"numpy.min",
"numpy.mean",
"numpy.exp",
"numpy.alltrue",
"numpy.random.random",
"scipy.signal.convolve",
"numpy.concatenate",
"nump... |
bvermeulen/Seistools | [
"9c6fadf92b9ac2cbd6c32ed510147525c4b5464b"
] | [
"sweep_impulse_responses..py"
] | [
"from pathlib import Path\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom segpy.reader import create_reader\n\nfile_name1 = Path('./data_files/himin.sgy')\nfile_name2 = Path('./data_files/hilin.sgy')\ncorr_file_name = Path('./data_files/hicut_corr.csv')\nwavelet_file_name = Path('./d... | [
[
"numpy.correlate",
"pandas.DataFrame",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.show"
]
] |
JokerYan/pytorch_image_classification | [
"e080a065c8afd3a96fa459c64442efd072464f40"
] | [
"pytorch_image_classification/losses/ricap.py"
] | [
"from typing import List, Tuple\n\nimport torch\nimport torch.nn as nn\n\n\nclass RICAPLoss:\n def __init__(self, reduction: str):\n self.loss_func = nn.CrossEntropyLoss(reduction=reduction)\n\n def __call__(\n self, predictions: torch.Tensor,\n targets: Tuple[List[torch.Tensor], ... | [
[
"torch.nn.CrossEntropyLoss"
]
] |
old-school-kid/astro-projects | [
"e82dfe68488ef1f072711871ad20178a23f89019"
] | [
"threebody.py"
] | [
"import os\nos.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = \"hide\"\nimport pygame\nfrom random import *\nimport numpy as np\nimport time\nimport sys\n\n# initiate pygame and clock\npygame.init()\nclock = pygame.time.Clock()\ngame_font = pygame.font.SysFont('ubuntu', 15)\n\n# dimensions\nWIDTH = 1540\nHEIGHT = 865\n\n#... | [
[
"numpy.finfo",
"numpy.array",
"numpy.linalg.norm",
"numpy.add"
]
] |
martinlarsalbert/rolldecay-estimators | [
"4d70da6058720ecbcecba3ed94c40f287a115e05",
"4d70da6058720ecbcecba3ed94c40f287a115e05"
] | [
"rolldecayestimators/measure.py",
"rolldecayestimators/ikeda_estimator.py"
] | [
"import numpy as np\nimport pandas as pd\nfrom rolldecayestimators import lambdas\n\ndef sample_increase(X, increase=5):\n N = len(X) * increase\n t_interpolated = np.linspace(X.index[0], X.index[-1], N)\n X_interpolated = pd.DataFrame(index=t_interpolated)\n\n for key, values in X.items():\n X_i... | [
[
"numpy.array",
"numpy.fft.rfft",
"pandas.merge",
"numpy.log",
"pandas.DataFrame",
"numpy.roll",
"numpy.fft.rfftfreq",
"numpy.interp",
"numpy.tile",
"numpy.diff",
"numpy.argmax",
"numpy.linspace",
"numpy.gradient"
],
[
"scipy.optimize.curve_fit",
"mat... |
khuship-wmt/incubator-mxnet | [
"dfc47be76d97640d9209f601a6c89809eeafae96"
] | [
"python/mxnet/numpy/multiarray.py"
] | [
"#!/usr/bin/env python\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.... | [
[
"numpy.array",
"numpy.asarray",
"numpy.clip",
"numpy.issubdtype",
"numpy.dtype"
]
] |
NickYi1990/torch_buddy | [
"b888f60b25e4f70b89960d158aaf893ab6183481"
] | [
"torch_buddy/utils/plot.py"
] | [
"import numpy as np\nimport matplotlib\n\nmatplotlib.use(\"TkAgg\")\n\nimport matplotlib.pyplot as plt\n\n\ndef subplots(data_for_plots, figsize=[12, 4]):\n \"\"\"\n data_for_plots = [[1,2,3], [4,5,6]]\n \"\"\"\n f, axes = plt.subplots(np.int(np.ceil(len(data_for_plots) / 2)), 2, figsize=figsize)\n ... | [
[
"matplotlib.use"
]
] |
rodonguyen/vres_code_2021 | [
"cb49d941db4dfc5137e887b195f403fb4262cfd8"
] | [
"linear_regression_pandas/bin/lr_ds12.py"
] | [
"import pandas as pd\r\nfrom sklearn import linear_model\r\n\r\ndf = pd.read_csv('./dataset/dataset_12_pandas.csv')\r\nx = df.values\r\ny = df['y'].values\r\n\r\n# Create linear regression object\r\nregression = linear_model.LinearRegression()\r\n\r\n# Train the model using the training sets\r\nregression.fit(x, y)... | [
[
"pandas.read_csv",
"sklearn.linear_model.LinearRegression"
]
] |
theorist17/adapter-transformers | [
"17a1e3f24aca59e3b131a47685dcefdfc69fa090"
] | [
"src/transformers/trainer.py"
] | [
"import json\nimport logging\nimport math\nimport os\nimport random\nimport re\nimport shutil\nfrom contextlib import contextmanager\nfrom pathlib import Path\nfrom typing import Callable, Dict, List, Optional, Tuple\n\nimport numpy as np\nimport torch\nfrom packaging import version\nfrom torch import nn\nfrom torc... | [
[
"torch.distributed.get_world_size",
"torch.cat",
"torch.distributed.is_available",
"torch.cuda.manual_seed_all",
"torch.utils.data.sampler.RandomSampler",
"torch.utils.data.dataloader.DataLoader",
"numpy.random.seed",
"torch.no_grad",
"torch.distributed.all_gather",
"torch.... |
TheCodeWanderer/Blog-Scripts | [
"caeb5fe1118351f7889574d8649c580cfaebdaf8"
] | [
"Visualize HRTF.py"
] | [
"# -*- coding: utf-8 -*-\r\n\"\"\"\r\nLoads a SOFA file and visualizes the HRTF amplitude and phase\r\n\r\nCreated on Mon Feb 24 23:08:19 2020\r\n@author: Ivan\r\n\"\"\"\r\n#%% Load SOFA file\r\n\r\nfrom SOFASonix import SOFAFile\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nimport scipy.fft\r\n\r\nfi... | [
[
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.title",
"numpy.real",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"numpy.argsort",
"numpy.abs",
"numpy.imag"
]
] |
white-hat-vaibhs/malaria | [
"4110fa3bd4dabf573aa50451c776e807d18025b8"
] | [
"src/visualization.py"
] | [
"#!/usr/bin/env python3\r\n# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Fri Dec 1 18:16:05 2017\r\n\r\n@author: Carlos Atico Ariza, PhD\r\n\"\"\"\r\n\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\nimport itertools\r\n\r\ndef plot_confusion_matrix(cm1, classes, normalize=False, \r\n ... | [
[
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.title",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.imshow"
]
] |
ananiask8/FFWM | [
"117f593783da67da9dc910a751910760497ef37f"
] | [
"ffwm/data/face_dataset.py"
] | [
"import os, cv2, torch\nimport numpy as np\nfrom os.path import basename, join\nfrom ffwm.data.base_dataset import BaseDataset\n\n\"\"\"\nFace Dataset\n\"\"\"\n\ndef s2f(file):\n \"\"\"\n get corresponding frontal image name: only for multipie\n \"\"\"\n path, name = os.path.split(file)\n ss = name.s... | [
[
"numpy.sin",
"numpy.random.shuffle",
"torch.clamp",
"torch.from_numpy",
"numpy.random.randint",
"numpy.cos",
"numpy.clip",
"numpy.hstack",
"torch.mean"
]
] |
Surya2709/Steganography-With-QR-Codes | [
"e363d596c85af81646f72ce7b96f49aef51241cf"
] | [
"decoder.py"
] | [
"from pathlib import Path\nimport qrtools\nimport os\nimport numpy as np\nfrom PIL import Image\nfrom pyzbar.pyzbar import decode\n\nclass decoder:\n def __init__(self,shapekey,Folderpath):\n self.shapekey=shapekey\n self.Folderpath=Folderpath\n self.decode()\n\n def decode(self):\n ... | [
[
"numpy.uint8",
"numpy.array",
"numpy.asarray"
]
] |
MSadeghzadehG/pythonic_lucene | [
"3cb50a46b127d189d1e161bad0d73b280fb8810d"
] | [
"search_engine/search/similarity.py"
] | [
"import numpy as np\n\n\nclass Similarity:\n \"\"\"\n Similarity defines the components of Lucene scoring.\n\n Doc: https://lucene.apache.org/core/8_11_0/core/org/apache/lucene/search/similarities/Similarity.html\n Code: https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/s... | [
[
"numpy.log"
]
] |
joneswong/AutoGraph | [
"62ea5dd250424ace5c6d6aa72cb196ed335dc2e3"
] | [
"code_submission/schedulers/genetic_optimization.py"
] | [
"from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nfrom scipy.stats import truncnorm\nimport numpy as np\nimport random\nimport copy\n\nfrom schedulers import Scheduler\nfrom spaces import Categoric, Numeric\n\n\nclass GeneticOptimizer(Scheduler):\n ... | [
[
"numpy.argmin"
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.