repo_name
stringlengths
6
130
hexsha
list
file_path
list
code
list
apis
list
alexpearce/probfit
[ "24e19f01075b3684ba63bbb5328186777f380764" ]
[ "doc/conf.py" ]
[ "# -*- coding: utf-8 -*-\n#\n# probfit documentation build configuration file, created by\n# sphinx-quickstart on Sat Nov 10 11:16:37 2012.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated ...
[ [ "matplotlib.use" ] ]
williams-c/covid_graphs
[ "8c5df91b5da660d217af66465537a315acc98ff9" ]
[ "server/data_scripts/format_state.py" ]
[ "\nimport pandas as pd\n\ndef format_csv_by_state(df, start, end, states):\n df = df.drop(columns=['UID', 'code3', 'iso2', 'iso3', 'FIPS', 'Lat', 'Long_'])\n df = df.groupby('Province_State').agg('sum')\n # flips columns and rows\n df = df.T\n # turns date from string to pandas datetime\n df_time = pd.to_date...
[ [ "pandas.to_datetime", "pandas.DatetimeIndex" ] ]
hrsu/win_api
[ "be55004cc6f4c357475b45e80c06dc480a67927f" ]
[ "text-cnn/eval.py" ]
[ "#! /usr/bin/env python\n\nimport tensorflow as tf\nimport numpy as np\nimport os\nimport time\nimport datetime\nimport data_helpers\nfrom text_cnn import TextCNN\nfrom tensorflow.contrib import learn\nimport csv\n\n# Parameters\n# ==================================================\n\n# Data Parameters\ntf.flags.DE...
[ [ "numpy.concatenate", "numpy.array", "tensorflow.flags.DEFINE_string", "tensorflow.train.latest_checkpoint", "tensorflow.flags.DEFINE_boolean", "tensorflow.Graph", "tensorflow.Session", "tensorflow.contrib.learn.preprocessing.VocabularyProcessor.restore", "tensorflow.ConfigProto...
futabato/mlops_demo
[ "c2563980327a516fea855c64311a340d34588e94" ]
[ "mlflow/example2.py" ]
[ "import mlflow\nfrom mlflow.utils.mlflow_tags import MLFLOW_RUN_NAME\n\nexperiment_name = 'MNIST-Classification'\nmlflow.set_experiment(experiment_name)\n\nimport tensorflow as tf\nfrom tensorflow import keras\nfrom tensorflow.keras.datasets import mnist\n\n(X_train, y_train), (X_test, y_test) = mnist.load_data()\n...
[ [ "tensorflow.keras.datasets.mnist.load_data", "tensorflow.keras.layers.Flatten", "tensorflow.keras.layers.Dense", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.MaxPooling2D", "tensorflow.keras.models.Sequential" ] ]
Shunichi09/reinforcement_learning_with_DNN
[ "612635235fd48fad3773f77a89cabbe97996a319" ]
[ "catcher/DDQN_torch.py" ]
[ "import gym\nfrom gym import wrappers\nimport gym_ple\nimport numpy as np\n\nimport torch\nfrom torch import nn\nfrom torch import optim\nimport torch.nn.functional as F\nfrom torch.autograd import Variable\nfrom torch.nn.utils import clip_grad_norm_\n\nfrom tensorboardX import SummaryWriter\n\nfrom PIL import Imag...
[ [ "torch.nn.Linear", "torch.rand", "torch.cat", "torch.zeros", "numpy.array", "torch.nn.MSELoss", "torch.FloatTensor", "torch.no_grad", "torch.from_numpy", "torch.nn.Conv2d", "torch.nn.init.normal_", "numpy.random.random" ] ]
TharinduDR/OffensiveNN
[ "336b377c44a7067d2e23ca4a8d331ce7f99157cc" ]
[ "offensive_nn/callbacks.py" ]
[ "import tensorflow.keras.backend as K\nimport numpy as np\n\nfrom tensorflow.keras.callbacks import Callback\n\n\n# https://www.kaggle.com/hireme/fun-api-keras-f1-metric-cyclical-learning-rate/code\nclass CyclicLR(Callback):\n \"\"\"This callback implements a cyclical learning rate policy (CLR).\n The method ...
[ [ "tensorflow.keras.backend.set_value", "tensorflow.keras.backend.get_value", "numpy.abs", "numpy.floor", "numpy.maximum" ] ]
oylb126/shakemap
[ "cbad8622bd520e1936447620edfb3a4feea1a8d9" ]
[ "shakelib/gmpe/nga_east.py" ]
[ "\"\"\"\nModule to simplify importing the OQ implementation of the\nNGA-East GMPE suite.\n\"\"\"\n\nimport os\nimport re\nimport sys\nimport logging\n\nimport pandas as pd\nimport numpy as np\n\nfrom openquake.hazardlib.gsim.base import GMPE\nfrom openquake.hazardlib import const\nfrom openquake.hazardlib import im...
[ [ "numpy.array", "numpy.log", "numpy.sum", "numpy.clip", "numpy.full_like" ] ]
AkshayGuptaK/maze-solvers
[ "f324c1af83e6456dcf0da89ffadd85930adc62e5" ]
[ "GenerateSolver.py" ]
[ "'''Matrix based Maze Solvers'''\r\n#Solver Generator\r\n\r\nimport numpy as np\r\nimport random\r\n\r\ndef print_multi_nparray(multi_array): #output display function\r\n layers = multi_array.shape[-1]\r\n for layer in range(layers):\r\n print(multi_array[..., layer])\r\n\r\nclass MemorySolver():\r\n ...
[ [ "numpy.count_nonzero", "numpy.dot", "numpy.zeros", "numpy.copy", "numpy.ones", "numpy.multiply", "numpy.where" ] ]
amjankowska/SocSIM
[ "768e81d10f9b1015a336a2f4bdc9d860907d2353" ]
[ "SOC/models/tests/test_manna.py" ]
[ "from SOC.models import Manna\nimport numpy as np\nimport pytest\n\ndef test_boundary_shape():\n sim = Manna(L=10)\n assert sim.values.shape == (12, 12)\n assert sim.L_with_boundary == 12\n\ndef test_run_abel():\n sim = Manna(L=20)\n sim.run(5)\n\ndef test_run_nonabel():\n sim = Manna(L=20, abelia...
[ [ "numpy.testing.assert_allclose" ] ]
btrspg/deTiN
[ "8076827fb915e6d675dca3940721b7a49f7198d3" ]
[ "deTiN/deTiN_utilities.py" ]
[ "import gzip\nimport pickle\nimport random\nimport sys\nfrom itertools import compress\n\nimport matplotlib\nimport numpy as np\nimport pandas as pd\nfrom scipy.stats import fisher_exact\n\nmatplotlib.use('agg')\nimport matplotlib.pyplot as plt\n\nrandom.seed(1)\n\ntry:\n xrange\nexcept NameError:\n xrange = ...
[ [ "numpy.ones_like", "numpy.true_divide", "numpy.min", "numpy.mean", "numpy.cumsum", "pandas.concat", "pandas.read_csv", "matplotlib.pyplot.xticks", "numpy.max", "matplotlib.pyplot.subplots", "numpy.logical_and", "numpy.isfinite", "numpy.nanmax", "matplotlib.u...
elifesciences-publications/temporal_prediction_model
[ "bbad285cf7d543f049f047d8941132d1b2a7223c" ]
[ "src/python_code/network_code/predictive_network_base.py" ]
[ "import os \nimport copy\nimport pickle as pkl\nfrom imp import reload\nimport numpy as np\nimport theano\nimport lasagne\nfrom visualisation.network_visualisation import plot_loss \nfrom network_code import optimizer_lasagne\nreload(optimizer_lasagne)\n\n#--------------------------------------------------------...
[ [ "numpy.exp", "numpy.zeros" ] ]
mikiya1130/deep-learning-from-scratch
[ "d265bc25b2dc38f13a540e43fcd36195a71f2fc1", "d265bc25b2dc38f13a540e43fcd36195a71f2fc1" ]
[ "ch03/sig_step_compare.py", "ch07/train_convnet.py" ]
[ "#%%\n# coding: utf-8\nimport numpy as np\nimport matplotlib.pylab as plt\n\n\ndef sigmoid(x):\n return 1 / (1 + np.exp(-x))\n\n\ndef step_function(x):\n return np.array(x > 0, dtype=np.int)\n\nx = np.arange(-5.0, 5.0, 0.1)\ny1 = sigmoid(x)\ny2 = step_function(x)\n\nplt.plot(x, y1)\nplt.plot(x, y2, 'k--')\npl...
[ [ "numpy.array", "numpy.exp", "matplotlib.pylab.show", "numpy.arange", "matplotlib.pylab.ylim", "matplotlib.pylab.plot" ], [ "matplotlib.pyplot.xlabel", "matplotlib.pyplot.ylim", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.arange", "matplotlib.pyp...
Meng-Lingjun-xjtu/ttt-plus-plus
[ "0f26c689fcaa666fa3524e7c5b6de0c1cb510e89" ]
[ "cifar/ttt++.py" ]
[ "from __future__ import print_function\nimport argparse\n\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\n\nfrom utils.misc import *\nfrom utils.test_helpers import *\nfrom utils.prepare_dataset import *\n\n# ----------------------------------\n\nimport copy\nimport time\nimport pandas as pd\n\ni...
[ [ "torch.cat", "numpy.random.seed", "torch.save", "torch.split", "torch.cuda.device_count", "torch.manual_seed", "torch.optim.lr_scheduler.ReduceLROnPlateau", "torch.nn.DataParallel" ] ]
J08nY/minerva
[ "8182d0006c434257ecb3689b2b4506b02e70303a" ]
[ "experiments/random/plot_new.py" ]
[ "#!/usr/bin/env python\nimport argparse\nimport itertools as it\nfrom copy import copy\nfrom math import sqrt, ceil\nimport re\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom matplotlib import cm, gridspec\nfrom matplotlib.colors import Normalize\nfrom matplotlib.ticker import (MultipleLocator, FormatS...
[ [ "numpy.array", "matplotlib.ticker.MultipleLocator", "matplotlib.cm.get_cmap", "matplotlib.ticker.FormatStrFormatter", "matplotlib.pyplot.figure", "matplotlib.pyplot.show", "numpy.meshgrid", "matplotlib.gridspec.GridSpec" ] ]
itohamy/dpmmpython
[ "7a84da36e07dd22a581de2138f368bdded32ac4e" ]
[ "trials_py2.py" ]
[ "\n\n\nimport numpy as np\nfrom matplotlib import pyplot as plt\nfrom julia.api import Julia\njl = Julia(compiled_modules=False)\nfrom sys import path\nfrom dpmmpython.priors import niw\nfrom dpmmpython.dpmmwrapper import DPMMPython\nfrom dpmmpython.dpmmwrapper import DPMModel\nimport random\n\n#path[4] = '/Users/i...
[ [ "numpy.cov", "numpy.zeros", "numpy.unique" ] ]
joaochenriques/MCTE_2022
[ "b999d60b6c4153be5a314da262a18e467cb41d7e" ]
[ "libs/mpl_utils.py" ]
[ "import matplotlib.pyplot as mpl\nimport numpy as np\nfrom cycler import cycler\nimport os\n\ndef config_plots( font_sans_serif=False ):\n \n if font_sans_serif:\n mpl.rcParams['mathtext.fontset'] = 'dejavusans'\n mpl.rcParams['font.family'] = 'DejaVu Sans'\n mpl.rcParams['font.sans-serif'] = ...
[ [ "matplotlib.pyplot.gca", "numpy.arctan2", "matplotlib.pyplot.style.use", "matplotlib.pyplot.rc" ] ]
mencattini/bmdt
[ "681b31c409fa1ea8d218b8b004aa4a0ce75bca11" ]
[ "bmdt/core.py" ]
[ "from collections import Counter\nimport numpy as np\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.base import BaseEstimator, ClassifierMixin\n\n\nclass Bmdt(BaseEstimator, ClassifierMixin):\n \"\"\"Binary Multiclass Decision Tree classification algorithm. It can be\n choice when there is a b...
[ [ "numpy.array", "numpy.sum", "numpy.any", "sklearn.tree.DecisionTreeClassifier", "numpy.unique" ] ]
LongerVision/cudf
[ "b3dc9d6adf16635c94a1735ad9ca73c12494884e" ]
[ "python/cudf/cudf/core/column/column.py" ]
[ "# Copyright (c) 2018-2022, NVIDIA CORPORATION.\n\nfrom __future__ import annotations\n\nimport builtins\nimport pickle\nimport warnings\nfrom functools import cached_property\nfrom types import SimpleNamespace\nfrom typing import (\n Any,\n Dict,\n List,\n MutableSequence,\n Optional,\n Sequence,...
[ [ "numpy.array", "numpy.isnan", "numpy.find_common_type", "numpy.asarray", "pandas.StringDtype", "numpy.ascontiguousarray", "numpy.isscalar", "numpy.timedelta64", "pandas.Series", "numpy.int32", "numpy.issubdtype", "numpy.dtype", "numpy.datetime64" ] ]
roycek7/machine_learning
[ "4589a590b9e87d37976cd0bcf9626d085735132d" ]
[ "K Nearest Neighbour/knn.py" ]
[ "\"\"\"\n@author: roycek\n\"\"\"\n\nimport math\n\nimport numpy as np\nimport pylab\nfrom sklearn.model_selection import train_test_split\n\nlabel = 1\nk = 100\nfeatures = 11\n\n\ndef normalize_data(data):\n return (data - np.min(data)) / (np.max(data) - np.min(data))\n\n\ndef euclidean_distance(test_data_point,...
[ [ "sklearn.model_selection.train_test_split", "numpy.max", "numpy.min" ] ]
xwang233/code-snippe
[ "2c053c85c6d73a32cc4b8e92e55ef8d0d780d578" ]
[ "pooling-bench-68682/c.py" ]
[ "import torch.utils.benchmark as benchmark\nimport glob\nimport pickle\n\nres = []\n\nfor pkl in sorted(glob.glob('./*.pkl')):\n with open(pkl, 'rb') as f:\n res += pickle.load(f)\n\ncompare = benchmark.Compare(res)\ncompare.print()\n" ]
[ [ "torch.utils.benchmark.Compare" ] ]
MobleyLab/quanformer
[ "d2e00309101a962d18f36c7966f20a78d62f349d" ]
[ "quanformer/tests/test_basic_plot.py" ]
[ "\"\"\"\ntest_basic_plot.py\n\"\"\"\nimport sys\nimport os\nimport pytest\nimport shutil\n\n# define location of input files for testing\nmydir = os.path.dirname(os.path.abspath(__file__))\n\n# import functions to aid testing\nsys.path.append(os.path.join(os.path.dirname(__file__), 'helpers'))\nfrom helper import *...
[ [ "matplotlib.use" ] ]
zhakguder/puzzlesolver
[ "6516a446065f84031607b8a97a566784d25fa21f" ]
[ "tests/test_imageprocess.py" ]
[ "\"\"\"Tests for image processing\"\"\"\n\nimport unittest\nfrom os import path\n\nimport cv2\nimport numpy as np\n\nfrom puzzlesolver.imageprocess import chaincode, fileops\nfrom puzzlesolver.utils import get_project_root\n\n\nclass TestImageProcess(unittest.TestCase):\n \"\"\"Tests for imageprocess\"\"\"\n\n ...
[ [ "numpy.sum", "numpy.ones" ] ]
zoumo4913/DRAMsim3
[ "79a6aa3038e1a6da749fe1fb041a4564555e5a0a" ]
[ "scripts/plot_stats.py" ]
[ "#!/usr/bin/env python3\n\"\"\"\nGenerate time series graphs of power/bandwidth/energy...\n\"\"\"\n\nimport argparse\nimport json\nimport os\nimport sys\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n\ndef extract_epoch_data(json_data, label, merge_channel=True):\n \"\"\"\n TODO enable merge_channel=...
[ [ "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.title", "matplotlib.pyplot.legend", "matplotlib.pyplot.hist", "matplotlib.pyplot.show", "matplotlib.pyplot.ylabel", "numpy.average", "matplotlib.pyplot.clf", "matplotlib.pyplot.ticklabel_format" ] ]
zhaoxin94/OVANet
[ "16c660cc8e6b384528f9e28d79ebc1ee7a2255ea" ]
[ "train.py" ]
[ "from __future__ import print_function\nimport yaml\nimport easydict\nimport os\nimport torch\nfrom torch import nn\nimport torch.nn.functional as F\nfrom torch.autograd import Variable\nfrom apex import amp, optimizers\nfrom utils.utils import log_set, save_model\nfrom utils.loss import ova_loss, open_entropy\nfro...
[ [ "torch.cuda.manual_seed_all", "numpy.random.seed", "torch.manual_seed", "torch.cuda.is_available", "torch.nn.CrossEntropyLoss" ] ]
zjstillman/RAISRFT
[ "fbef07fb7d42fbd1ffc3c2efb678f7570347a59c" ]
[ "FFT_Crop_Abs_Ver/hashkey.py" ]
[ "import numpy as np\nfrom math import atan2, floor, pi\n# from numba import jit\n\n# @jit\ndef hashkey(block, Qangle, W):\n # Calculate gradient\n gy, gx = np.gradient(block)\n\n # Transform 2D matrix into 1D array\n gx = gx.ravel()\n gy = gy.ravel()\n\n # SVD calculation\n G = np.vstack((gx,gy...
[ [ "numpy.real", "numpy.isreal", "numpy.linalg.eig", "numpy.sqrt", "numpy.gradient", "numpy.vstack" ] ]
Jueun-Park/donkey_gym
[ "f1a19a9983f06af167d9e8f647a39195dc505a0c" ]
[ "default_controller/plot.py" ]
[ "import matplotlib.pyplot as plt\nimport pandas as pd\nimport os\n\nfilename = os.path.dirname(os.path.abspath(__file__)) + \"/data/\" + \"data.csv\"\ndf = pd.read_csv(filename)\ndf.plot(x='t')\nplt.show()\n" ]
[ [ "matplotlib.pyplot.show", "pandas.read_csv" ] ]
ZombaSY/util-collection
[ "49b65eeff130edfa34fcecd7bba5b2e717eebdb7" ]
[ "machine learning/PSNR.py" ]
[ "import torch\nimport os\nimport pandas as pd\n\nfrom PIL import Image\nfrom torchvision import transforms\n\n\nclass PSNR:\n \"\"\"Peak Signal to Noise Ratio\n img1 and img2 have range [0, 255]\"\"\"\n\n def __init__(self):\n self.name = \"PSNR\"\n\n @staticmethod\n def __call__(img1, img2):\...
[ [ "pandas.DataFrame", "torch.sqrt", "torch.mean" ] ]
AlexanderAzhar/RGBDStudy
[ "2ba4404eff5231982ad49ce8c2d0121af37cd95b" ]
[ "main.py" ]
[ "import numpy as np\nimport argparse\nimport glob\nimport os\nfrom functools import partial\nimport vispy\nimport scipy.misc as misc\nfrom tqdm import tqdm\nimport yaml\nimport time\nimport sys\nfrom mesh import write_ply, read_ply, output_3d_photo\nfrom utils import get_MiDaS_samples, read_MiDaS_depth\nimport torc...
[ [ "torch.cuda.empty_cache", "numpy.abs", "numpy.load", "torch.load" ] ]
zha-hengfeng/EACNet
[ "e542d5ec02b4669b31a083f05c1b873697185489" ]
[ "evaluate_iou.py" ]
[ "import os\r\nimport time\r\nimport torch\r\nimport numpy as np\r\nimport torch.backends.cudnn as cudnn\r\nfrom torch.autograd import Variable\r\nfrom argparse import ArgumentParser\r\n# user\r\nfrom builders.model_builder import build_model\r\nfrom builders.dataset_builder import build_dataset_test\r\nfrom utils.u...
[ [ "numpy.max", "torch.cuda.synchronize", "torch.autograd.Variable", "torch.no_grad", "torch.cuda.is_available", "numpy.argmax", "torch.load" ] ]
tugot17/Swarm-Algorithms
[ "93c50485a7e3fab9d2dd8bdb8b9b47b46e012085" ]
[ "swarm_algorithms/aaa.py" ]
[ "from swarm_algorithms.abstract_swarm_algorithm import AbstractSwarmAlgorithm\nimport numpy as np\n\nfrom swarm_algorithms.particle import Particle\n\n\nclass AAA(AbstractSwarmAlgorithm):\n # Hyperparameters\n w_min, w_max = np.pi / 2, 3 * np.pi / 2\n\n a_min, a_max = 0., 2 * np.pi\n p_lo, p_hi = -15., ...
[ [ "numpy.random.normal", "numpy.sin", "numpy.copy", "numpy.random.uniform", "numpy.sqrt", "numpy.cos" ] ]
gbup-group/EAN-efficient-attention-network
[ "ac9c049158873836e1c239fc35f65d4b79274b12" ]
[ "search_imagent/EAN_search.py" ]
[ "from __future__ import print_function\n\nimport os\nimport shutil\nimport time\nimport random\nimport torch\nimport torch.nn as nn\nimport torch.nn.parallel\nimport torch.nn.functional as F\nimport torch.backends.cudnn as cudnn\nimport torch.optim as optim\nimport torchvision.transforms as transforms\nimport torch...
[ [ "torch.nn.Linear", "torch.cat", "torch.cuda.is_available", "torch.load", "numpy.cumsum", "torch.utils.data.sampler.SubsetRandomSampler", "torch.exp", "torch.nn.CrossEntropyLoss", "torch.nn.DataParallel", "torch.manual_seed", "torch.utils.data.DataLoader", "torch.nn....
S-Yuan137/COMAPreduce
[ "bcb8b171ae3a226b10978e83f85ec72f538466ff" ]
[ "comancpipeline/Analysis/CreateLevel3.py" ]
[ "# Routines for downsampling the level 2 data to wide band chunks for continuum data analysis\n# Data will be cleaned such that it is ready to enter the destriper:\n# 1) From Statistics : Remove atmosphere and baselines \n# 2) From astrocalibration : Apply Jupiter calibration to each feed\n\nimport numpy as np\nimp...
[ [ "numpy.reshape", "numpy.zeros", "numpy.sum", "numpy.ones", "numpy.load", "numpy.where", "numpy.isfinite", "numpy.nanmedian" ] ]
m4ln/image_processing_scripts
[ "3274e01869be9c7a845a4bb76aa02b3cf0023b50" ]
[ "util/print_numpy.py" ]
[ "import numpy as np\n\n\ndef print_numpy(array, shape=True, val=True):\n \"\"\"\n Prints the mean, min, max, median, std, and size of a numpy array\n\n Args:\n array: numpy array\n shape: if True prints the shape of the numpy array\n val: if True prints the values of the numpy array\n\...
[ [ "numpy.max", "numpy.median", "numpy.min", "numpy.mean", "numpy.std" ] ]
eigenholser/image-highlight
[ "61705dd797605c2cb3eac74c5e5d62a94c54a68e" ]
[ "highlight.py" ]
[ "from __future__ import print_function\nimport argparse\nimport json\nimport logging\nimport numpy as np\nimport os\nfrom PIL import Image\nimport sys\n\n\nlogger = logging.getLogger(__name__)\n\n\nclass Highlighter(object):\n \"\"\"\n Methods for applying highlights to image from JSON description.\n \"\"\...
[ [ "numpy.array", "numpy.exp", "numpy.log" ] ]
charan223/alstm
[ "33fe910a6c170547debbd5cbed254594183b8a0b" ]
[ "examples/model.py" ]
[ "\"\"\"PyTorch Language Model\n\nGeneric PyTorch Language Model that can runs on top of an RNN class.\n\"\"\"\nimport torch\nimport torch.nn as nn\nfrom torch.autograd import Variable\nfrom embed_regularize import embedded_dropout\nfrom locked_dropout import LockedDropout\nfrom weight_drop import WeightDrop\n\n\nde...
[ [ "torch.nn.Linear", "torch.nn.Dropout", "torch.nn.LSTM", "torch.nn.GRU", "torch.nn.ModuleList", "torch.nn.Embedding" ] ]
KiUngSong/Generative-Models
[ "a86edb7a29daf97239f7bdde72cd9c9bffbc9c6c" ]
[ "Vanilla GAN & cGAN/GAN_pytorch.py" ]
[ "import torch\r\nimport numpy as np\r\nfrom torch import nn\r\nfrom tqdm.notebook import tqdm\r\n\r\n\r\nclass Generator(nn.Module):\r\n def __init__(self, img_shape, dim_latent, g_dims=[128,256,512,1024]):\r\n super(Generator, self).__init__()\r\n self.dim_latent = int(dim_latent)\r\n self....
[ [ "torch.nn.Linear", "torch.zeros", "torch.rand", "numpy.reshape", "torch.nn.Sigmoid", "torch.nn.Sequential", "torch.nn.Tanh", "torch.nn.LeakyReLU", "torch.ones", "numpy.prod", "torch.nn.BatchNorm1d", "torch.nn.BCELoss" ] ]
kevinyamauchi/skan
[ "df59b90279d14f31d767d00d74fcac2b763c6975" ]
[ "skan/csr.py" ]
[ "import numpy as np\nimport pandas as pd\nfrom scipy import sparse, ndimage as ndi\nfrom scipy.sparse import csgraph\nfrom scipy import spatial\nimport numba\n\nfrom .nputil import pad, raveled_steps_to_neighbors\n\n\n## NBGraph and Numba-based implementation\n\ncsr_spec = [\n ('indptr', numba.int32[:]),\n ('...
[ [ "numpy.add.reduceat", "scipy.sparse.csgraph.connected_components", "numpy.min", "numpy.cumsum", "numpy.issubdtype", "numpy.broadcast_to", "numpy.max", "numpy.full", "numpy.bincount", "numpy.empty", "pandas.DataFrame", "scipy.ndimage.map_coordinates", "numpy.nonz...
lgbouma/tessmaps
[ "569bbc24f2fb9b00c537329a6cb919200dd258f3" ]
[ "src/tessmaps.py" ]
[ "# -*- coding: utf-8 -*-\n'''\nfrom tessmaps import make_rect_map\nmake_rect_map(sector_number, coords, names=names\n annotate_bools=annotate_bools)\n'''\nfrom __future__ import division, print_function\n\nimport os, argparse\nimport matplotlib as mpl\nmpl.use('Agg')\nimport matplotlib.pyplot as plt\ni...
[ [ "matplotlib.use", "numpy.array", "numpy.ones_like", "matplotlib.pyplot.figure", "matplotlib.colors.BoundaryNorm", "numpy.arange", "numpy.remainder", "numpy.abs", "matplotlib.colors.ListedColormap", "pandas.read_csv" ] ]
Cogito2012/DRIVE
[ "dba7e72ae3d1a5c2841d39d8fc51af48dd161f9e" ]
[ "src/saliency/mlnet.py" ]
[ "import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom torchvision import models, transforms\nimport math\n\nclass ResNet_FPN(torch.nn.Module):\n def __init__(self, n_layers=50, preTrained=False):\n super(ResNet_FPN, self).__init__()\n if n_layers == 50:\n self.net =...
[ [ "torch.cat", "torch.nn.ModuleList", "torch.nn.UpsamplingBilinear2d", "torch.max", "torch.nn.init.kaiming_normal_", "torch.ones", "torch.nn.Conv2d", "torch.nn.functional.relu", "torch.nn.init.xavier_normal_", "torch.nn.Dropout2d", "torch.mean", "torch.sum" ] ]
npfp/agents
[ "21ae8a6b7ccf80b7c693cf34debe68a616c8387e" ]
[ "tf_agents/agents/ppo/ppo_policy_test.py" ]
[ "# coding=utf-8\n# Copyright 2018 The TF-Agents Authors.\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 b...
[ [ "tensorflow.nest.pack_sequence_as", "tensorflow.compat.v1.global_variables_initializer", "tensorflow.ones_like", "tensorflow.nest.flatten", "tensorflow.nest.map_structure", "tensorflow.constant", "tensorflow.compat.v1.initializers.constant", "tensorflow.test.main", "numpy.all",...
juholeinonen/ParlAI
[ "612daf902d9194cead7b380f39ffbcc738c36a88" ]
[ "projects/blenderbot2/agents/blenderbot2.py" ]
[ "#!/usr/bin/env python3\n# Copyright (c) Facebook, Inc. and its affiliates.\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\"\"\"\nBlenderBot2 Agent Code.\n\nBlenderBot 2 combines a long-term memory module with a retriever module.\n\nTh...
[ [ "torch.LongTensor", "torch.nn.functional.log_softmax" ] ]
whwu95/DSANet
[ "5c877ebdc2126f1e170b1f4079451110cf4422d7" ]
[ "codes/models/builder.py" ]
[ "import torch.nn as nn\n\nfrom ..utils import Registry, build_from_cfg\n\nRECOGNIZERS = Registry('recognizer')\nBACKBONES = Registry('backbone')\nHEADS = Registry('head')\nSPATIAL_TEMPORAL_MODULES = Registry('spatial_temporal_module')\nSEGMENTAL_CONSENSUSES = Registry('segmental_consensus')\n\n\ndef build(cfg, regi...
[ [ "torch.nn.Sequential" ] ]
zhengxuanyu/NNByPytorch
[ "f90b807a44234a48f914e03e45c9691f17eb3189" ]
[ "NN_PyTorch/09_optimizer.py" ]
[ "import torch\r\nimport torch.nn as nn\r\nimport torch.utils.data as data\r\nimport torch.nn.functional as F\r\nimport matplotlib.pyplot as plt\r\n\r\n\r\n# hyper parameters\r\nLR = 0.01\r\nBATCH_SIZE = 32\r\nEPOCH = 12\r\n\r\nx = torch.unsqueeze(torch.linspace(-1, 1, 1000), dim=1)\r\ny = x.pow(2) + 0.1*torch.norma...
[ [ "torch.nn.Linear", "torch.nn.MSELoss", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.ylim", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "torch.linspace", "torch.nn.ReLU", "torch.utils.data.DataLoader", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.show", ...
Jan20/mnist
[ "00d3e2be1887206218ccdabb07052e7a36d10731" ]
[ "app/learning/visualization.py" ]
[ "import keras.callbacks\nimport matplotlib.pyplot as plt\nfrom keras import models\nfrom keras.models import load_model\nfrom keras.preprocessing import image\nfrom numpy import expand_dims, ndarray, zeros, clip\n\n\ndef display_progress(history: keras.callbacks.History):\n \"\"\"\n Visualizes the training an...
[ [ "matplotlib.pyplot.matshow", "numpy.zeros", "matplotlib.pyplot.grid", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.title", "matplotlib.pyplot.figure", "numpy.clip", "matplotlib.pyplot.show", "numpy.expand_dims", "matplotlib.pyplot.imshow" ]...
arokem/ffn
[ "95d55f77e9560a8d34715ec2bdfef554b205824d" ]
[ "compute_partitions.py" ]
[ "r\"\"\"Computes the partition map for a segmentation.\n\nFor every labeled voxel of the input volume, computes the fraction of identically\nlabeled voxels within a neighborhood of radius `lom_radius`, and then quantizes\nthat number according to `thresholds`.\n\nSample invocation:\n python compute_partitions.py \...
[ [ "numpy.array", "numpy.pad", "numpy.zeros", "numpy.sum", "numpy.prod", "numpy.all", "numpy.unique" ] ]
Wisc-HCI/wiscutils
[ "fd53f06d3d3e70aef7e8a7a7121edfc02acf0220" ]
[ "wisc_tools/src/wisc_tools/structures/structures.py" ]
[ "import numpy as np\nimport math\nfrom scipy import interpolate\nfrom pyquaternion import Quaternion as pyQuaternion\nfrom wisc_tools.convenience import pairwise\nfrom wisc_tools.conversions import transformations\nfrom wisc_msgs.msg import Euler, EulerPose, EEPoseGoals\nfrom geometry_msgs.msg import Vector3 as ros...
[ [ "numpy.array", "scipy.interpolate.interp1d" ] ]
magicake/2017-2018
[ "2c795e47e0036e73ff9f88dcb0972cf6c0ec2a91" ]
[ "hsv_sprite_shifter/color_change.py" ]
[ "#SY Dec 2018\n#github.com/magicake\n\nfrom PIL import Image\nimport numpy as np\nfrom random import randint\nfrom timeit import default_timer as timer\n\ndef rgb_to_hsv(rgb):\n rgb = rgb.astype('float')\n hsv = np.zeros_like(rgb)\n hsv[..., 3:] = rgb[..., 3:]\n r, g, b = rgb[..., 0], rgb[..., 1], rgb[....
[ [ "numpy.max", "numpy.zeros_like", "numpy.array", "numpy.min", "numpy.select", "numpy.empty_like" ] ]
ronekko/adaptive_computation_time
[ "eff1b9d9ae0205668db72f29e54c3e6a63640876" ]
[ "links/stateless_simple_act.py" ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed May 10 19:42:51 2017\n\n@author: sakurai\n\"\"\"\n\nimport numpy as np\nimport chainer\nimport chainer.functions as F\nimport chainer.functions as L\nimport six\n\n\nclass StatelessSimpleACT(chainer.Chain):\n def __init__(self, in_size, s_size, out_size,\n ...
[ [ "numpy.full", "numpy.arange" ] ]
JeongsooHa/ray
[ "cc93fee4a47dc9b9f754d0b53ae2f1e4f598aeb1" ]
[ "rllib/agents/es/es_tf_policy.py" ]
[ "# Code in this file is copied and adapted from\n# https://github.com/openai/evolution-strategies-starter.\n\nimport gym\nimport numpy as np\n\nimport ray\nimport ray.experimental.tf_utils\nfrom ray.rllib.evaluation.sampler import _unbatch_tuple_actions\nfrom ray.rllib.models import ModelCatalog\nfrom ray.rllib.pol...
[ [ "numpy.array", "numpy.random.randn", "numpy.abs" ] ]
Multilevel-NN/deepxde
[ "10c7c6e0de610ee560089eb11e01496b84383721" ]
[ "examples/Beltrami_flow.py" ]
[ "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport numpy as np\n\nimport deepxde as dde\n\n\ndef main():\n a = 1\n d = 1\n Re = 1\n\n def pde(x, u):\n u_vel, v_vel, w_vel, p = u[:, 0:1], u[:, 1:2], u[:, 2:3], u[:, 3:4]\n\n ...
[ [ "numpy.sin", "numpy.zeros", "numpy.ones", "numpy.exp", "numpy.ravel", "numpy.cos", "numpy.absolute", "numpy.hstack", "numpy.linspace" ] ]
yuriok/QGrain
[ "39a136d4e89716a26a88d68ffa00d36ef6036279" ]
[ "QGrain/kernels.py" ]
[ "import numpy as np\nimport torch\nfrom QGrain import DistributionType\nfrom QGrain.distributions import BaseDistribution\nfrom torch.nn import Module, Parameter, ReLU, Softmax\n\n\ndef normal_pdf(x, loc, scale):\n pdf = 1 / (scale*np.sqrt(2*np.pi)) * torch.exp(-torch.square(x - loc) / (2*scale**2))\n return ...
[ [ "torch.rand", "torch.arccos", "torch.nn.Softmax", "torch.greater_equal", "torch.square", "torch.no_grad", "torch.abs", "torch.nn.ReLU", "numpy.sqrt", "torch.zeros_like", "torch.Tensor", "torch.exp", "torch.sum" ] ]
adityapb/compyle
[ "0aab06b48eefb2b3cf4689ec35b11e3d55771d5a" ]
[ "compyle/jit.py" ]
[ "from textwrap import dedent\n\nimport numpy as np\nimport inspect\nimport ast\nimport importlib\nimport warnings\nimport time\nfrom pytools import memoize\nfrom .config import get_config\nfrom .cython_generator import CythonGenerator\nfrom .transpiler import Transpiler, BUILTINS\nfrom .types import (dtype_to_ctype...
[ [ "numpy.asarray" ] ]
supriya-gdptl/IM-NET-pytorch
[ "c64895471a6b2e60189ae643c045fb6c2eb69a5c" ]
[ "utils.py" ]
[ "import numpy as np \nimport math\n\n\ndef write_ply_point(name, vertices):\n\tfout = open(name, 'w')\n\tfout.write(\"ply\\n\")\n\tfout.write(\"format ascii 1.0\\n\")\n\tfout.write(\"element vertex \"+str(len(vertices))+\"\\n\")\n\tfout.write(\"property float x\\n\")\n\tfout.write(\"property float y\\n\")\n\tfout.w...
[ [ "numpy.sum", "numpy.random.shuffle", "numpy.zeros", "numpy.random.random" ] ]
KyleKing/PersonalFinanceExplorer
[ "e46e139e006788b8e942a4b4b72c80c8a8623fd6" ]
[ "pfe/profile.py" ]
[ "\"\"\"Profile Settings Page.\"\"\"\n\nimport dash_html_components as html\nimport dash_table\nimport pandas as pd\nfrom dash.dependencies import Input, Output\nfrom dash_charts import appUtils\nfrom icecream import ic\n\nfrom .plaidWrapper import PlaidDashWrapper\n\n\nclass TabProfile(appUtils.TabBase):\n \"\"\...
[ [ "pandas.DataFrame", "pandas.read_csv" ] ]
RitchieLabIGH/IRFinder
[ "89fc165c1f8f5ffbbbb766f67c3f7d79e266f8f8" ]
[ "src/cnnfilter/testCNN/actions/extract.py" ]
[ "import numpy as np\nfrom scipy.interpolate import interp1d\n\n\n\n\n\ndef getImageArrayFromRegion(region, img_size=None):\n '''\n Return the numpy array representing the image from a given region\n '''\n\n\n read_img, ann_img = generateImagesArrayGreyFromRegion(region,img_size)\n\n return read_img\n...
[ [ "numpy.round", "numpy.array", "numpy.arange", "numpy.append" ] ]
Jackzhou1999/Mask_detection
[ "41b1995591e419a35e75c8ea8508f62db30de1b7" ]
[ "train.py" ]
[ "#-------------------------------------#\r\n# 对数据集进行训练\r\n#-------------------------------------#\r\nimport os\r\nimport numpy as np\r\nimport time\r\nimport torch\r\nfrom torch.autograd import Variable\r\nimport torch.nn as nn\r\nimport torch.optim as optim\r\nimport torch.nn.functional as F\r\nimport torch....
[ [ "torch.optim.lr_scheduler.StepLR", "numpy.reshape", "numpy.random.seed", "matplotlib.pyplot.grid", "torch.no_grad", "matplotlib.pyplot.legend", "numpy.random.shuffle", "numpy.shape", "torch.from_numpy", "torch.load", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.sh...
gbellandi/pystran
[ "6a283a0a5b2c3dbeb52e8f7f64170be2d829063f" ]
[ "pystran/distributions.py" ]
[ "\"\"\"\r\nCreated on Wed Oct 10 16:37:52 2012\r\n@author: VHOEYS\r\n\r\nPROBABILITY DISTRIBUTIONS\r\n\r\nA more extended set of distributions is available in the scipy.stats library,\r\nhttp://docs.scipy.org/doc/scipy/reference/stats.html\r\nor by pymc: https://pymc-devs.github.io/pymc/distributions.html\r\n\"\"\"...
[ [ "numpy.random.normal", "numpy.random.lognormal", "numpy.zeros", "numpy.log", "numpy.exp", "numpy.random.triangular", "numpy.random.uniform", "numpy.size", "numpy.sqrt" ] ]
antoinedemathelin/adapt
[ "cae888b1a0ae2d82772ae8575457f5ad7799a8b7" ]
[ "tests/test_utils.py" ]
[ "\"\"\"\nTest functions for utils module.\n\"\"\"\n\n\nimport numpy as np\nimport pytest\nimport tensorflow as tf\nimport tensorflow.keras.backend as K\nfrom sklearn.linear_model import LinearRegression, LogisticRegression, Ridge\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.preprocessing import Standar...
[ [ "numpy.full", "numpy.array", "numpy.array_equal", "tensorflow.GradientTape", "numpy.zeros", "tensorflow.keras.layers.Input", "tensorflow.keras.wrappers.scikit_learn.KerasClassifier", "tensorflow.keras.backend.variable", "sklearn.preprocessing.StandardScaler", "numpy.ones", ...
Anon-Artist/autogluon
[ "f1f76b1b14feca29f39c3e3051070a260ee602aa" ]
[ "tabular/src/autogluon/tabular/models/tab_transformer/tab_transformer_model.py" ]
[ "\"\"\" TabTransformer model \"\"\"\nimport logging\nimport os\nimport time\n\nimport numpy as np\nimport pandas as pd\nfrom autogluon.core.utils.loaders import load_pkl\nfrom tqdm import tqdm\n\nfrom .hyperparameters.parameters import get_default_param\nfrom .hyperparameters.searchspaces import get_default_searchs...
[ [ "torch.device", "numpy.isnan", "torch.nn.MSELoss", "torch.nn.Softmax", "torch.autograd.Variable", "torch.save", "torch.enable_grad", "torch.no_grad", "torch.optim.lr_scheduler.ExponentialLR", "torch.cuda.is_available", "torch.load", "torch.nn.CrossEntropyLoss" ] ]
LuisFMCuriel/ai-traineree
[ "121da3ea48992d9db3ede3634e4e5f48f50f4cc3", "121da3ea48992d9db3ede3634e4e5f48f50f4cc3" ]
[ "ai_traineree/runners/env_runner.py", "ai_traineree/policies.py" ]
[ "import json\nimport logging\nimport os\nimport sys\nimport time\nfrom collections import deque\nfrom pathlib import Path\nfrom typing import Any, Iterable, List, Optional, Tuple\n\nimport numpy as np\nimport torch.multiprocessing as mp\n\nfrom ai_traineree.agents import AgentBase\nfrom ai_traineree.experience impo...
[ [ "torch.multiprocessing.Process", "torch.multiprocessing.Pipe", "numpy.empty", "numpy.zeros" ], [ "torch.zeros", "torch.nn.functional.softplus", "torch.arange", "torch.clamp", "torch.distributions.Dirichlet", "torch.full", "torch.tanh", "torch.exp" ] ]
retip94/konin-flats-scraper
[ "7db18da33b858532f698ce20f3a450df68cf6d63" ]
[ "scraper/main.py" ]
[ "import os\nimport requests\nfrom bs4 import BeautifulSoup\nimport pandas as pd\nfrom functools import partial, reduce\nimport time\nimport multiprocessing\nfrom collections import defaultdict\nfrom gatheringMethods import *\nfrom time import localtime, strftime\nimport jinja2\nimport ftplib\nimport random\nimport ...
[ [ "pandas.read_pickle", "pandas.DataFrame", "pandas.concat" ] ]
shreyaskar123/EHR-Discontinuity
[ "8d2becfd784b9cbe697f8308d60023701971ef5d", "8d2becfd784b9cbe697f8308d60023701971ef5d" ]
[ "EHR_Claims/GBT/Hemorrhage_SMOTE_EHR_CLAIMS_GBT.py", "EHR_Only/BART/Hemorrhage_SMOTE.py" ]
[ "#!/usr/bin/env python\n# coding: utf-8\n\n# In[ ]:\n\n\n\n\n\n# In[1]:\n\n\nimport pandas as pd\nmedicare = pd.read_csv(\"/netapp2/home/se197/data/CMS/Data/medicare.csv\")\n\n\n\ntrain_set = medicare[medicare.Hospital != 'BWH'] # MGH; n = 204014\nvalidation_set = medicare[medicare.Hospital == 'BWH'] # BWH and Neit...
[ [ "numpy.percentile", "numpy.mean", "sklearn.metrics.accuracy_score", "sklearn.model_selection.KFold", "sklearn.metrics.fbeta_score", "sklearn.metrics.log_loss", "sklearn.model_selection.GridSearchCV", "pandas.read_csv", "sklearn.metrics.f1_score", "sklearn.metrics.roc_auc_sc...
robinupham/gaussian_cl_likelihood
[ "91fb635f9360340555eb0c920925f37fda69a8a5" ]
[ "python/like_cl_wishart.py" ]
[ "\"\"\"\nLikelihood module to evaluate the joint likelihood of a set of tomographic 3x2pt power spectra on the full sky\nusing the exact Wishart likelihood.\n\nThe main functions are setup, which should be called once per analysis, and execute, which is called for every new\npoint in parameter space.\n\"\"\"\n\nimp...
[ [ "numpy.concatenate", "numpy.full", "numpy.array", "numpy.asarray", "numpy.zeros", "numpy.allclose", "numpy.loadtxt", "numpy.amax", "numpy.isfinite", "numpy.amin", "scipy.stats.wishart.logpdf", "numpy.diag" ] ]
akutkin/SACA
[ "b866b6d9465310d4cd5bb4d2e92595d918b681d0" ]
[ "vlbi_errors/model_bllac_ra.py" ]
[ "import numpy as np\nfrom uv_data import UVData\nfrom components import ModelImageComponent\nfrom model import Model\nfrom from_fits import create_model_from_fits_file\nfrom utils import mas_to_rad\nfrom stats import LnLikelihood\nfrom spydiff import import_difmap_model\nfrom scipy.optimize import minimize, fmin\n\...
[ [ "numpy.loadtxt", "numpy.arange", "numpy.isfinite" ] ]
Axeln78/ogb
[ "c7a3f06d1c9d1d506e52467ed07ec9dcdbc2b583" ]
[ "ogb/io/read_graph_raw.py" ]
[ "import pandas as pd\nimport os.path as osp\nimport os\nimport numpy as np\nfrom ogb.utils.url import decide_download, download_url, extract_zip\nfrom tqdm import tqdm\n\n### reading raw files from a directory.\ndef read_csv_graph_raw(raw_dir, add_inverse_edge = True, additional_node_files = [], additional_edge_fil...
[ [ "numpy.repeat" ] ]
savannahwild/colony-com
[ "55164b51b8ec3fc2023f29dc14ab387de5cd3159" ]
[ "examples/example_simple.py" ]
[ "from plate import Plate\nfrom species import Species\nimport numpy as np\nimport helper_functions\n\n\ndef main():\n ## experimental parameters\n D = 3E-3 # nutrient diffusion coeff (#mm2/min)\n rho_n = 0.3 # consumption rate of nutrients by X\n rc = 6E-3 # growth rate of X on N\n D...
[ [ "numpy.ones", "numpy.arange", "numpy.zeros" ] ]
gwaygenomics/2018_05_30_ResistanceMechanisms_Kapoor
[ "62d31c133fbf02954c28cade32319b37ccc0f359" ]
[ "0.generate-profiles/scripts/nbconverted/normalize-flawed-plate-design.py" ]
[ "#!/usr/bin/env python\n# coding: utf-8\n\n# # Correct for flawed plate design\n# \n# We collected many plates in batches 9 and 10, but unfortunately, we applied only one perturbation per plate. This prevents us from using our standard per-plate normalization strategy.\n# \n# We perform a different normalization st...
[ [ "pandas.DataFrame", "pandas.Categorical", "pandas.concat", "numpy.log10", "pandas.melt", "sklearn.decomposition.PCA", "pandas.read_csv" ] ]
OpenGridMap/power-grid-detection
[ "221fcf0461dc869c8c64b11fa48596f83c20e1c8" ]
[ "utils/img/helpers.py" ]
[ "import os\n\nimport numpy as np\nfrom PIL import Image\nfrom shapely.geometry import Polygon, MultiPolygon\n\nimport config\nfrom utils.dataset.annotations import annotations_iter, get_rect_from_annotation\nfrom utils.geo.coordinate import Coordinate\n\n\ndef crop_rect(im_src, x, y, width, height, dest_path=None):...
[ [ "numpy.random.randint", "numpy.asarray" ] ]
virajkanwade/spyder
[ "fee3df9d922f4ff66103218f54bc41d99e2fae53" ]
[ "spyder/plugins/plots/widgets/tests/test_plots_widgets.py" ]
[ "# -*- coding: utf-8 -*-\n# -----------------------------------------------------------------------------\n# Copyright © Spyder Project Contributors\n#\n# Licensed under the terms of the MIT License\n# (see spyder/__init__.py for details)\n# --------------------------------------------------------------------------...
[ [ "matplotlib.figure.Figure", "matplotlib.backends.backend_agg.FigureCanvasAgg", "numpy.random.rand" ] ]
xingzix/Membership_Inference
[ "35f064e8fc584e3ff1e06ee5659874f14576cc30" ]
[ "code/svm.py" ]
[ "from sklearn.svm import LinearSVR\n\ndef sklearn_train_svm(X, y, C):\n return LinearSVR(C=C).fit(X, y)" ]
[ [ "sklearn.svm.LinearSVR" ] ]
michelle-aubin/pytorch-YOLOv4
[ "35472dee8d519e00bc369c2c221b08fc279a508f" ]
[ "save_darknet_as_pytorch.py" ]
[ "from tool import darknet2pytorch\nimport torch\nfrom tool.torch_utils import *\n\n# load weights from darknet format\nmodel = darknet2pytorch.Darknet('yolov4-obj.cfg', inference=True)\nmodel.load_weights('yolov4-obj_best.weights')\n\n# save weights to pytorch format\ntorch.save(model.state_dict(), 'yolov4-obj.pth'...
[ [ "torch.load" ] ]
shadowleaves/deep_learning
[ "4cb9cc79c706c611b35cb420bf87a5e245325494" ]
[ "theano/imdb.py" ]
[ "from __future__ import print_function\n# from six.moves import xrange\nimport six.moves.cPickle as pickle\n\nimport gzip\nimport os\n\nimport numpy\nimport theano\n\n\ndef prepare_data(seqs, labels, maxlen=None):\n \"\"\"Create the matrices from the datasets.\n\n This pad each sequence to the same lenght: th...
[ [ "numpy.max", "numpy.random.permutation", "numpy.zeros", "numpy.round" ] ]
Unathi-Skosana/qiskit-aqua
[ "e13f66eda6d8b819a6f132319a2bac819941f6b1" ]
[ "qiskit/aqua/algorithms/minimum_eigen_solvers/main.py" ]
[ "if __name__ == '__main__':\n import numpy as np\n from qiskit import Aer\n from qiskit.aqua.algorithms.minimum_eigen_solvers import VQSD\n from qiskit.quantum_info.states import Statevector\n from qiskit.aqua.components.initial_states import Custom\n from qiskit.aqua.components.optimizers import ...
[ [ "numpy.inner", "numpy.conj", "numpy.sqrt", "numpy.eye" ] ]
akleb/multipoint
[ "e7a25006b143b427874aef49f5579c1e798793f1" ]
[ "tests/reg_tests/test_MPSparse.py" ]
[ "import unittest\nimport numpy as np\nimport copy\nfrom mpi4py import MPI\nfrom multipoint import multiPointSparse\nfrom pyoptsparse import Optimization\n\ngcomm = MPI.COMM_WORLD\n\n\ndef set1_obj(x):\n rank = gcomm.rank\n g1_drag = x[\"v1\"] ** 2 * (rank + 1)\n g1_lift = x[\"v1\"] * 2 * 3.14159 * (rank + ...
[ [ "numpy.average", "numpy.any", "numpy.ones", "numpy.zeros" ] ]
pseudoyim/conda_build_dojo
[ "8ddb4f958909461d551ca202c61a76c5508eac54" ]
[ "dojo/utils.py" ]
[ "'''\nUtilities for dojo commands.\n'''\nimport io\nimport json\nimport os\nimport pandas as pd\nimport requests\nimport sys\nimport yaml\nfrom collections import Counter\nfrom colorama import Fore, Back, Style\nfrom datetime import datetime\nfrom dojo import ROOT_DIR, LESSONS_DIR\nfrom pathlib import Path\nfrom ta...
[ [ "pandas.DataFrame", "pandas.read_csv" ] ]
qcwthu/Lifelong-Fewshot-Language-Learning
[ "cf7d17ce7de6a707d929d0542b3d5e639569855f" ]
[ "convertmodel.py" ]
[ "import os\nos.environ[\"CUDA_VISIBLE_DEVICES\"] = \"7\"\nfrom transformers import T5Tokenizer, T5ForConditionalGeneration, T5Config, load_tf_weights_in_t5\nfrom transformers.utils import logging\nimport tensorflow as tf\nlogging.set_verbosity_info()\n\ndef convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, pytor...
[ [ "tensorflow.train.list_variables" ] ]
turing-usp/Turing-Talks
[ "cb9b85b70e6a53d2eafd9593759ef828d7dddf3d" ]
[ "Redes Neurais/Autoencoder/testing.py" ]
[ "import Autoencoder\nimport torch\nimport torch.nn as nn\nimport torchvision\nimport torchvision.datasets as datasets\nimport matplotlib.pyplot as plt\n\n# Getting random sample from testing set\nto_tensor = torchvision.transforms.ToTensor()\ntest_data = datasets.CIFAR10(root='./dataset', train=False, download=True...
[ [ "torch.nn.MSELoss", "matplotlib.pyplot.subplots", "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.load", "matplotlib.pyplot.show" ] ]
ion-g-ion/paper-cme-tt
[ "274e1c32d8d58a33e57e3ce47f662e512e59161a", "274e1c32d8d58a33e57e3ce47f662e512e59161a" ]
[ "code/simplegene_tt_convergence.py", "code/3stage_parameters2.py" ]
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Sep 9 10:01:49 2020\n\n@author: ion\n\"\"\"\n\nimport tensorflow as tf\nimport t3f\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom CME import CME\nimport timeit\nimport scipy.integrate\nimport numba\nimport scipy.sparse\nfrom tt_ex...
[ [ "numpy.array", "numpy.zeros", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.ylabel", "numpy.abs", "matplotlib.pyplot.loglog" ], [ "numpy.meshgrid", "numpy.exp", ...
KaihuaTang/ResNet-Pytorch-Face-Recognition
[ "73b77ef86ec7e6c0589c60f74e5c10a69b0366a2" ]
[ "ResNet.py" ]
[ "import torch.nn as nn\r\nimport torch\r\nimport math\r\n\r\ndef resnet50(pretrained=False, **kwargs):\r\n \"\"\"Constructs a ResNet-50 model.\r\n Args:\r\n pretrained (bool): If True, returns a model pre-trained on ImageNet\r\n \"\"\"\r\n model = ResNet([3, 4, 6, 3], **kwargs)\r\n if pretrain...
[ [ "torch.nn.Linear", "torch.nn.MaxPool2d", "torch.nn.Sequential", "torch.nn.AvgPool2d", "torch.nn.BatchNorm2d", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.load" ] ]
teslakit/teslak
[ "1495bfa2364ddbacb802d145b456a35213abfb7c" ]
[ "teslakit/numerical_models/swan/geo.py" ]
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom math import radians, degrees, sin, cos, asin, acos, sqrt, atan2, pi\nimport numpy as np\n\ndef gc_distance(lat1, lon1, lat2, lon2):\n 'Calculate great circle distance and azimuth (exact. parsed ml)'\n\n # distance\n lon1, lat1, lon2, lat2 = map(radian...
[ [ "numpy.sin", "numpy.tan", "numpy.arctan2", "numpy.sqrt", "numpy.cos", "numpy.abs" ] ]
Axel13fr/kmall
[ "c48fce9d891e186a99d1fc76255db449b1bdbe48" ]
[ "KMALL/kmall.py" ]
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nA python class to read Kongsberg KMALL data format for swath mapping\nbathymetric echosounders.\n\"\"\"\nimport pandas as pd\nimport sys\nimport numpy as np\nimport struct\nimport datetime\nimport argparse\nimport os\nimport re\nimport bz2\nimport copy\nimp...
[ [ "numpy.max", "numpy.full", "numpy.array", "numpy.isnan", "numpy.concatenate", "numpy.zeros", "pandas.set_option", "numpy.round", "pandas.DataFrame", "numpy.min", "numpy.mean", "numpy.where", "numpy.bitwise_and", "numpy.sort", "numpy.abs", "numpy.uniq...
IBSHAMI/Bike_sharing_prediction
[ "702f0baacd4ae3e050c5b91f800ed54df85ac939" ]
[ "utils.py" ]
[ "import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.model_selection import train_test_split\n\n\ndef one_hot_encode(df, columns, drop_columns):\n \"\"\"\n One hot encode a dataframe with categorical columns\n \"\"\"\n ...
[ [ "sklearn.model_selection.train_test_split", "pandas.concat", "pandas.get_dummies", "sklearn.preprocessing.StandardScaler" ] ]
lapid92/model_optimization
[ "3fc6db67cde912a1e22399bd43bc345ba035b8b6" ]
[ "model_compression_toolkit/pytorch/mixed_precision/mixed_precision_wrapper.py" ]
[ "# Copyright 2022 Sony Semiconductors Israel, 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# Un...
[ [ "torch.as_tensor", "torch.no_grad", "torch.Tensor", "torch.from_numpy" ] ]
kodexp/smt
[ "cc390b795ea21eed66aae95218d5dfb67ed87a88" ]
[ "smt/utils/line_search.py" ]
[ "\"\"\"\nAuthor: Dr. John T. Hwang <hwangjt@umich.edu>\n \nThis package is distributed under New BSD license.\n\"\"\"\n\nfrom __future__ import print_function\nimport numpy as np\nimport scipy.sparse\nimport six\nfrom six.moves import range\n\nVALID_LINE_SEARCHES = (\"backtracking\", \"bracketed\", \"quadrat...
[ [ "numpy.zeros", "numpy.roots", "numpy.isreal", "numpy.linalg.solve", "numpy.abs" ] ]
jkznst/maskrcnn-benchmark
[ "7d238568e6240397ddacdb1b87d08334e8c358b4" ]
[ "maskrcnn_benchmark/data/datasets/occludedlinemod.py" ]
[ "import os\n\nimport torch\nimport torch.utils.data\nfrom PIL import Image\nimport sys\n\nif sys.version_info[0] == 2:\n import xml.etree.cElementTree as ET\nelse:\n import xml.etree.ElementTree as ET\n\n\nfrom maskrcnn_benchmark.structures.bounding_box import BoxList\nfrom maskrcnn_benchmark.structures.keypo...
[ [ "torch.tensor", "torch.ones" ] ]
arnon-weinberg/Upscale-interpolate-STARnet
[ "d898d38364a36f4633cfba8f914db20d9b900217" ]
[ "eval.py" ]
[ "from __future__ import print_function\nimport argparse\n\nimport os\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\nfrom torch.autograd import Variable\nfrom torch.utils.data import DataLoader\nfrom fbpn_sr_rbpn_v1 import Net as FBPNSR_RBPN_V1\nfrom fbpn_sr_rbpn_v2 import Net as FBPNSR_RBPN_V2\n...
[ [ "torch.cuda.manual_seed", "torch.autograd.Variable", "torch.no_grad", "torch.manual_seed", "torch.cuda.is_available", "torch.utils.data.DataLoader", "torch.load", "torch.nn.DataParallel" ] ]
goncaloperes/robustness_metrics
[ "5ee77294432e1265e432b6e84e06e2a5ae2af387" ]
[ "robustness_metrics/metrics/uncertainty_test.py" ]
[ "# coding=utf-8\n# Copyright 2021 The Robustness Metrics Authors.\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 r...
[ [ "numpy.random.rand", "numpy.min", "tensorflow.stack", "tensorflow.nn.softmax", "numpy.bincount", "numpy.max", "tensorflow.random.set_seed", "numpy.sqrt", "numpy.square", "tensorflow.abs", "numpy.array", "tensorflow.zeros", "tensorflow.random.uniform", "tenso...
apoz00003/banana
[ "50bf516cc4f7d4d93985e42d0c4dcbc62fb8058a" ]
[ "banana/interfaces/custom/coils.py" ]
[ "import os\nimport os.path as op\nfrom copy import deepcopy\nfrom collections import defaultdict\nimport logging\nimport re\nimport numpy as np\nimport nibabel as nib\nfrom nipype.interfaces.base import (\n TraitedSpec, traits, BaseInterface, BaseInterfaceInputSpec, File,\n Directory, isdefined)\nfrom banana....
[ [ "numpy.isnan", "numpy.angle", "numpy.random.rand", "numpy.zeros", "numpy.exp", "numpy.abs" ] ]
Chick-star/sagemaker-xgboost-container
[ "e06e278b3a34515f79fa73ab770b574b9aafe5f0" ]
[ "test/unit/algorithm_mode/test_custom_metrics.py" ]
[ "# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the 'License'). You\n# may not use this file except in compliance with the License. A copy of\n# the License is located at\n#\n# http://aws.amazon.com/apache2.0/\n#\n# or in the 'lice...
[ [ "numpy.array", "numpy.ones", "numpy.random.rand" ] ]
MECLabTUDA/QA_Seg
[ "ef1b029e78a6fc5db07d127df375fef3b2c5b7a2", "72a961e081ac814243ae65b46e0276079af5680f" ]
[ "mp/utils/pytorch/compute_normalization_values.py", "mp/utils/preprocess_utility_functions.py" ]
[ "# ------------------------------------------------------------------------------\n# Torchvision requires the mean and standard deviation to be calculated manually \n# for normalization. This method can be used for that. However, this is mainly \n# for colored 2D images and therefore rarely relevant for medical dat...
[ [ "torch.empty", "torch.utils.data.DataLoader", "torch.sqrt", "torch.sum" ], [ "numpy.max", "numpy.array", "numpy.ma.masked_not_equal", "numpy.ones", "numpy.min", "numpy.shape", "torch.from_numpy", "torch.squeeze", "numpy.ma.filled", "torch.cuda.is_availab...
khakhulin/Text2Img
[ "acb002904122e1f2c0abed3fff69daccfff88c12" ]
[ "modules/self_attention.py" ]
[ "# https://github.com/voletiv/self-attention-GAN-pytorch/blob/master/sagan_models.py\n\nimport torch\nimport torch.nn as nn\n\nfrom torch.nn.utils import spectral_norm\nfrom torch.nn.init import xavier_uniform_\n\n\ndef init_weights(m):\n if type(m) == nn.Linear or type(m) == nn.Conv2d:\n xavier_uniform_(...
[ [ "torch.nn.Linear", "torch.zeros", "torch.nn.Softmax", "torch.nn.MaxPool2d", "torch.nn.init.xavier_uniform_", "torch.nn.Conv2d", "torch.nn.Embedding" ] ]
jmuhlich/gr_metrics
[ "fb6175b08d036e83aa97a1fdc435250a1b6029a2" ]
[ "SRC/python/examples/plot_toy_example.py" ]
[ "import csv\nimport numpy as np\nimport pandas as pd\nimport os.path as path\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport gr50\n\n# Read the data file.\nbase_path = path.join(path.dirname(path.abspath(__file__)), '..', '..', '..')\ninput_path = path.join(base_path, 'OUTPUT', 'toy_example_output.t...
[ [ "numpy.log10", "matplotlib.pyplot.show", "pandas.read_csv" ] ]
rdn86/tensorflow
[ "adefac94c838c2c353ca62f8cc23dbb39a8cf6cd" ]
[ "tensorflow/contrib/gan/python/estimator/__init__.py" ]
[ "# Copyright 2016 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 applicab...
[ [ "tensorflow.python.util.all_util.remove_undocumented" ] ]
cutz-j/ACCV
[ "3d20bccef0de85e667c5b42d4837e2fe3373e27b" ]
[ "critic/resnet_generator.py" ]
[ "\"\"\"\nStarGAN v2\nCopyright (c) 2020-present NAVER Corp.\n\nThis work is licensed under the Creative Commons Attribution-NonCommercial\n4.0 International License. To view a copy of this license, visit\nhttp://creativecommons.org/licenses/by-nc/4.0/ or send a letter to\nCreative Commons, PO Box 1866, Mountain Vie...
[ [ "torch.nn.Linear", "torch.nn.functional.avg_pool2d", "torch.nn.ModuleList", "torch.nn.Tanh", "torch.nn.LeakyReLU", "torch.nn.functional.interpolate", "torch.nn.Conv2d", "torch.nn.InstanceNorm2d", "torch.chunk" ] ]
cristipp/decaNLP
[ "d776d9f600c127a0a3e28c85960cf0ea615e8f63" ]
[ "models/self_attentive_pointer_generator.py" ]
[ "import os\nimport math\nimport numpy as np\n\nimport torch\nfrom torch import nn\nfrom torch.nn import functional as F\nfrom torch.autograd import Variable\n\nfrom .common import positional_encodings_like, INF, EPSILON, TransformerEncoder, TransformerDecoder, PackedLSTM, LSTMDecoderAttention, LSTMDecoder, Embeddin...
[ [ "torch.nn.Linear", "torch.nn.Dropout", "torch.cat", "torch.stack", "torch.nn.Sigmoid", "torch.nn.functional.softmax", "torch.nn.Embedding" ] ]
nicholasturner1/lecun1989-repro
[ "6931f1737964ba9e0da11411f3c91ab7c6aa4d3d" ]
[ "scripts/modern.py" ]
[ "\"\"\"\n\nrepro.py gives:\n23\neval: split train. loss 4.073383e-03. error 0.62%. misses: 45\neval: split test . loss 2.838382e-02. error 4.09%. misses: 82\n\nwe can try to use our knowledge from 33 years later to improve on this,\nbut keeping the model size same.\n\nChange 1: replace tanh on last layer with FC an...
[ [ "torch.manual_seed", "torch.load", "torch.use_deterministic_algorithms", "numpy.random.seed" ] ]
rassouly/exopy_hqc_legacy
[ "9c26ef65950400b20c43695b54c7dab744e3133f" ]
[ "exopy_hqc_legacy/instruments/drivers/visa/agilent_psa.py" ]
[ "# -*- coding: utf-8 -*-\n#==============================================================================\n# module : agilent_psa.py\n# author : Benjamin Huard\n# license : MIT license\n#==============================================================================\n\"\"\"\nThis module defines drivers for agilent P...
[ [ "numpy.array", "numpy.linspace", "numpy.rec.fromarrays" ] ]
Waztom/pipelines
[ "63ac14d05446ced622fd2acb86c9b84dcc5feae8" ]
[ "src/python/pipelines/rdkit/pbf_ev.py" ]
[ "#\n# Copyright (C) 2015 Greg Landrum\n#\n# @@ All Rights Reserved @@\n# This file is part of the RDKit.\n# The contents are covered by the terms of the BSD license\n# which is included in the file license.txt, found at the root\n# of the RDKit source tree.\n\nimport argparse\nfrom builtins import range\n\nfr...
[ [ "numpy.array", "numpy.dot", "numpy.zeros", "numpy.sum", "numpy.linalg.eigh", "numpy.degrees", "numpy.argsort" ] ]
seakers/dtnsim
[ "9ea1da84e0565d97b3ea184facb597302bf4d99e" ]
[ "RL/tabular_Q_learning.py" ]
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport os\n\nimport gym\nimport gym_cdtn\nimport itertools\nimport matplotlib\nimport matplotlib.style\nimport numpy as np\nimport pandas as pd\nimport sys\nimport pickle\n\nfrom collections import defaultdict\nimport plotting\n\nmatplotlib.style.use('ggplot')\n\n...
[ [ "numpy.array", "matplotlib.style.use", "numpy.zeros", "numpy.ones", "numpy.exp", "numpy.savez", "numpy.argmax" ] ]
IBM/geospatial-event-observations
[ "6e9bd8759f8b66c841ce0afea1ddd173c668f293" ]
[ "be-image/server/execution/execution.py" ]
[ "#\n# Licensed Materials - Property of IBM\n# 6949-04J\n# © Copyright IBM Corp. 2020 All Rights Reserved\n#\nimport glob\nimport json\nimport numpy as np\nimport os\nimport pandas as pd\nimport requests\nfrom sqlalchemy import text, create_engine\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalc...
[ [ "pandas.notnull", "pandas.notna" ] ]