repo_name
stringlengths
6
130
hexsha
list
file_path
list
code
list
apis
list
VascoLopes/LCMNAS
[ "f5a5707c3bd6306a5831d1c78a30a1fd2d7c9912" ]
[ "data_loader_cifar100.py" ]
[ "import torch\nimport numpy as np\nfrom sklearn import model_selection\n\nfrom torchvision import datasets\nfrom torchvision import transforms\nfrom torch.utils.data.sampler import SubsetRandomSampler, SequentialSampler\n\nfrom cutout import Cutout\nfrom autoaugment import CIFAR10Policy\n\nimport pickle\n\ndef get_...
[ [ "torch.utils.data.sampler.SequentialSampler", "torch.utils.data.DataLoader" ] ]
natcs98/NER-biaffine
[ "c3fc62aa101c1772616a81356944a7fbd6abf520" ]
[ "model/layer/biaffineLayer.py" ]
[ "import torch.nn as nn\nimport torch\n\n\nclass BiaffineLayer(nn.Module):\n def __init__(self, inSize1, inSize2, classSize, dropout=0.3):\n super(BiaffineLayer, self).__init__()\n\n self.bilinearMap = nn.Parameter(torch.FloatTensor(inSize1 + 1, classSize, inSize2 + 1))\n self.classSize = cla...
[ [ "torch.FloatTensor", "torch.matmul", "torch.ones" ] ]
ernewton/rogui
[ "0e138a6142fbd07586cb3689c432c2ae9805f2dc" ]
[ "create_random.py" ]
[ "import numpy as np\nrand = np.random.RandomState(42)\nt = 1000 * rand.rand(300)\ny = 0.005*np.sin(2 * np.pi * t/50.) + 0.002 * rand.randn(len(t))\ndy = 0.001 + 0.002* rand.rand(len(t))\ni = range(300)\n\nfrom astropy.io import ascii\nfrom astropy.table import Table\ndata = Table([i, t, y, dy], names=['i', 'time', ...
[ [ "numpy.sin", "numpy.random.RandomState" ] ]
SahilDhull/autonomous
[ "378fc7d6c5a9c34c4e915f080fb78ed5c11195d6", "378fc7d6c5a9c34c4e915f080fb78ed5c11195d6", "378fc7d6c5a9c34c4e915f080fb78ed5c11195d6", "378fc7d6c5a9c34c4e915f080fb78ed5c11195d6" ]
[ "src/Optimal path/test.py", "Sim_ATAV/vehicle_control/controller_commons/controller_commons.py", "Sim_ATAV/simulation_control/vehicles_manager.py", "Webots_Projects/controllers/calibration_recorder/calibration_recorder.py" ]
[ "##Remaining tasks: -ve value of velocity, maxlimit of velocity, 0-acceleration\nimport numpy as np\nimport math\nimport copy\nimport dubins\nimport shapely.geometry as geom\nimport threading \nfrom statistics import median \n\n\n\n\n#Change radius of curvature for 0.9\nfrom vel_acc_to_throttle import *\n\n\nloc...
[ [ "numpy.array", "numpy.arange" ], [ "numpy.array", "numpy.subtract", "numpy.cross", "numpy.linalg.norm" ], [ "numpy.array" ], [ "numpy.rot90", "numpy.array", "numpy.fliplr" ] ]
gitlost-murali/generating-reviews-discovering-sentiment
[ "0032e4b87903713ad4242599f5dda2eb7b8c40fd" ]
[ "utils.py" ]
[ "import os\nimport html\nimport numpy as np\nimport pandas as pd\nimport tensorflow as tf\nfrom sklearn.linear_model import LogisticRegression\n\ndef train_with_reg_cv(trX, trY, vaX, vaY, teX=None, teY=None, penalty='l1',\n C=2**np.arange(-8, 1).astype(np.float), seed=42):\n scores = []\n for i, c in e...
[ [ "numpy.sum", "sklearn.linear_model.LogisticRegression", "numpy.argmax", "numpy.arange", "pandas.read_csv" ] ]
python-polymatrix-games/polymatrix
[ "cd7966ff0f028bb9bcd80f5c5340918b1748735e" ]
[ "polymatrix/payoff.py" ]
[ "import numpy as np\nfrom .logger import log\nclass PayoffFunction():\n def __init__(self, alpha, players, function='pairwise_fractional'):\n self.players = players\n self.alpha = alpha\n self.function = self.choose_function(function_name=function)\n\n def __call__(self, player1: int, pla...
[ [ "numpy.random.randint", "numpy.zeros" ] ]
Howzit123/plantcv
[ "b4ff6ad765da36353f40827ce3816b33d1d3596a" ]
[ "plantcv/plantcv/analyze_object.py" ]
[ "# Analyzes an object and outputs numeric properties\n\nimport os\nimport cv2\nimport numpy as np\nfrom plantcv.plantcv import print_image\nfrom plantcv.plantcv import plot_image\nfrom plantcv.plantcv import params\nfrom plantcv.plantcv import outputs\nfrom plantcv.plantcv import within_frame\n\n\ndef analyze_objec...
[ [ "numpy.array", "numpy.zeros", "numpy.lexsort", "numpy.copy", "numpy.shape", "numpy.argmax", "numpy.transpose", "numpy.sqrt", "numpy.absolute", "numpy.vstack" ] ]
andim/paper-tcellimprint
[ "e89605e51014fa3f347f96bab3d3d84c2b013a2f" ]
[ "code/clonesizedistributions/plot-emerson-stepbystep.py" ]
[ "import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport matplotlib\n\nimport sys\nsys.path.append('..')\nfrom lib import *\nfrom lib.fitting import *\n\nfrom common import *\n\nplt.style.use('../custom.mplstyle')\n\nmeta = pd.read_csv(data_directory + 'emerson-counts.csv')\nprint(meta.shap...
[ [ "pandas.cut", "matplotlib.pyplot.subplots", "numpy.arange", "matplotlib.colors.Normalize", "matplotlib.pyplot.style.use", "matplotlib.pyplot.show", "pandas.read_csv" ] ]
xuewyang/Fashion-Image-Captioning-Benchmark
[ "5494e6fb453d01984f18e9872412897bbab95681" ]
[ "captioning/models/ShowTellModel.py" ]
[ "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom torch.autograd import *\nfrom . import utils\n\nfrom .CaptionModel import CaptionModel\n\n\nclass ShowTellModel(CaptionModel):...
[ [ "torch.nn.Linear", "torch.nn.Dropout", "torch.max", "torch.FloatTensor", "torch.multinomial", "torch.LongTensor", "torch.div", "torch.exp", "torch.nn.Embedding" ] ]
dhruvsharma15/Research-Paper-Tagger
[ "1f25d23d8e33e6325386c3eaa9ee43eb579eb92a" ]
[ "DL_model/test.py" ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Dec 4 11:35:47 2018\n\n@author: dhruv\n\"\"\"\n\n\nimport numpy as np\nimport tensorflow as tf\nimport pickle\nimport time\nstart = time.perf_counter()\nimport os\nimport pickle\n\n###### this data has been vectorized, that is, processed to be containing the word ve...
[ [ "numpy.array", "tensorflow.shape", "tensorflow.train.AdamOptimizer", "tensorflow.round", "tensorflow.contrib.rnn.BasicLSTMCell", "tensorflow.contrib.layers.fully_connected", "tensorflow.Session", "tensorflow.train.get_checkpoint_state", "tensorflow.global_variables", "tenso...
ahouseholder/SSVC
[ "eefcab9148f3357b1cac509602f60a0210e0de51" ]
[ "src/ssvc.py" ]
[ "#!/usr/bin/env python\n'''\nfile: ssvc\nauthor: adh\ncreated_at: 12/2/19 2:23 PM\n'''\n\nimport pandas as pd\n\n_app_cols = ['Exploitation', 'Exposure', 'MissionImpact', 'SafetyImpact', 'Outcome']\n_dev_cols = ['Exploitation', 'Utility', 'TechnicalImpact', 'SafetyImpact', 'Outcome']\n\n_df_applier = pd.read_csv(\"...
[ [ "pandas.read_csv" ] ]
theimgclist/SelfDrivingCarTerm1
[ "4769975fae4d466990ac315f9650b6aaf416d239" ]
[ "src/slidingwindowssearch.py" ]
[ "import numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.image as mpimg\nimport glob\nimport cv2\n\n# Read in a thresholded image\nwarped = mpimg.imread('warped_example.jpg')\n# window settings\nwindow_width = 50 \nwindow_height = 80 # Break image into 9 vertical layers since image height is 720\nmar...
[ [ "numpy.zeros_like", "numpy.array", "matplotlib.image.imread", "matplotlib.pyplot.title", "numpy.ones", "numpy.convolve", "numpy.argmax", "numpy.dstack", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow" ] ]
kkly1995/algorithms
[ "526ea30dd499696788915981cf978af1ee24dae4" ]
[ "assets/codes/bktree.py" ]
[ "\n# pip install python-levenshtein\nimport Levenshtein as lev\nimport numpy as np\nimport string\n\nclass WordSearch:\n def __init__(self,wordbank,compare=lev.distance):\n ''' Base class for word searching.'''\n self.wordbank=wordbank\n self.compare=compare\n self.ncompares=0\n\n def query(self,key):...
[ [ "numpy.random.choice", "numpy.unique" ] ]
wudidaizi/RAVEN
[ "10d126930ed31056e55803da4f8d606cde2b56d2", "10d126930ed31056e55803da4f8d606cde2b56d2" ]
[ "app/Matrix_Capsules_EM/datasets/norb.py", "app/Matrix_Capsules_EM/train.py" ]
[ "from __future__ import print_function\nimport torch.utils.data as data\nfrom PIL import Image\nimport os\nimport os.path\nimport errno\nimport numpy as np\nimport torch\nimport codecs\nimport struct\n\n\nclass NORB(data.Dataset):\n \"\"\"`NORB <https://cs.nyu.edu/~ylclab/data/norb-v1.0/>`_ Dataset.\n The tra...
[ [ "torch.save", "numpy.reshape", "numpy.zeros", "torch.from_numpy" ], [ "torch.device", "torch.cuda.manual_seed", "torch.no_grad", "torch.manual_seed", "torch.cuda.is_available" ] ]
yunshengtian/ppo-mujoco
[ "1989bc5491d2abc3d015d0ec81d34ea166c3352b" ]
[ "external/vec_env/vec_monitor.py" ]
[ "from . import VecEnvWrapper\nfrom external.bench.monitor import ResultsWriter\nimport numpy as np\nimport time\nfrom collections import deque\n\nclass VecMonitor(VecEnvWrapper):\n def __init__(self, venv, filename=None, keep_buf=0, info_keywords=()):\n VecEnvWrapper.__init__(self, venv)\n self.epr...
[ [ "numpy.zeros" ] ]
Lila14/miniMDS
[ "0ac01964edebc3d33e666f66a59f36f05702bede" ]
[ "scripts/chromsde_input.py" ]
[ "import numpy as np\nimport sys\nsys.path.append(\"..\")\nimport data_tools as dt\n\nin_path = sys.argv[1]\nmat_path = sys.argv[2]\nid_path = sys.argv[3]\n\nstructure = dt.structureFromBed(in_path, None, None)\ncontactMat = dt.matFromBed(in_path, structure)\nn = len(contactMat)\nmaxNumDigits = int(np.ceil(np.log10(...
[ [ "numpy.savetxt", "numpy.amax" ] ]
lanl/swiftbat_python
[ "8424d4bb56e6ab07c4806050d4ce647c134a8189" ]
[ "swiftbat/swinfo.py" ]
[ "#! /usr/bin/env python\n\n\nfrom __future__ import print_function, division, absolute_import\n\nimport functools\nfrom pathlib import Path\n\n\"\"\"\nswinfo\nMore utilities for dealing with Swift Data\nDavid Palmer palmer@lanl.gov\n\n\n\"\"\"\n\n\"\"\"\nCopyright (c) 2018, Triad National Security, LLC. All right...
[ [ "numpy.array", "numpy.asarray", "numpy.arange", "numpy.isscalar", "numpy.int16" ] ]
nignatovsky/open_model_zoo
[ "60e560aea990f8530a8918c141a667eb506fd455" ]
[ "tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/text_detection.py" ]
[ "\"\"\"\nCopyright (c) 2018-2021 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law ...
[ [ "numpy.exp", "numpy.where", "numpy.size", "numpy.cos", "numpy.max", "numpy.concatenate", "numpy.zeros_like", "numpy.linalg.norm", "numpy.sin", "numpy.logical_and", "numpy.transpose", "numpy.array", "numpy.zeros", "numpy.round", "numpy.roll", "numpy.s...
arita37/data
[ "0d1a38fd9b564cfb9c34ad521e7df2b3b6e2316b" ]
[ "adfraud/generate_train.py" ]
[ "import pandas as pd, numpy as np, random, copy, os, sys\nrandom.seed(100)\n\n\n########################################################################################################\ndef generate_train(df, col=None, pars=None):\n \"\"\"\n By IP Apress\n channel 10...
[ [ "pandas.to_datetime", "pandas.DataFrame", "numpy.sum", "pandas.Series", "pandas.read_csv", "pandas.read_parquet" ] ]
lperezmo/gpvolve
[ "a2cb204a91e0c17f5bb789a5a333cb155d037591", "4e45b53b72184425c24d57b2e8779d3d51de39d7" ]
[ "tests/test_base.py", "gpvolve/simulate/simulate.py" ]
[ "import pytest\nimport gpvolve.check as check\nimport gpmap\nimport numpy as np\nfrom gpvolve.base import apply_fitness_function\nfrom gpvolve.phenotype_to_fitness import linear\nfrom gpvolve.utils import find_peaks\n\n\ndef test_check_gpm():\n with pytest.raises(TypeError):\n check.gpm_sanity(\"stupid\")...
[ [ "numpy.testing.assert_array_equal", "numpy.random.randint" ], [ "numpy.array", "numpy.isnan", "numpy.round", "numpy.sum", "numpy.min" ] ]
tgouss/BiorbdOptim
[ "2aa43850ddd6e8d210731a5b3894eeb27fb8e781" ]
[ "biorbd_optim/limits/objective_functions.py" ]
[ "from enum import Enum\nimport numpy as np\nimport casadi\nfrom casadi import dot, sum1\n\nfrom .penalty import PenaltyType, PenaltyFunctionAbstract\nfrom ..misc.enums import Instant\nfrom ..misc.options_lists import OptionList, OptionGeneric\n\n\nclass ObjectiveOption(OptionGeneric):\n def __init__(\n se...
[ [ "numpy.ndarray", "numpy.nansum" ] ]
lucidrains/anymal-belief-state-encoder-decoder-pytorch
[ "e8d4acfa2c81073a88980832185212ba2802287b" ]
[ "anymal_belief_state_encoder_decoder_pytorch/running.py" ]
[ "import torch\nfrom torch import nn\n\nclass RunningStats(nn.Module):\n def __init__(self, shape, eps = 1e-5):\n super().__init__()\n shape = shape if isinstance(shape, tuple) else (shape,)\n\n self.shape = shape\n self.eps = eps\n self.n = 0\n\n self.register_buffer('ol...
[ [ "torch.zeros", "torch.zeros_like" ] ]
Rubikplayer/flame-fitting
[ "db3d622547b83ab158dceb46a5d049781e6e6c3a" ]
[ "smpl_webuser/lbs.py" ]
[ "'''\nCopyright 2015 Matthew Loper, Naureen Mahmood and the Max Planck Gesellschaft. All rights reserved.\nThis software is provided for research purposes only.\nBy using this software you agree to the terms of the SMPL Model license here http://smpl.is.tue.mpg.de/license\n\nMore information about SMPL is availabl...
[ [ "numpy.ones", "numpy.zeros" ] ]
bbbbbbzhou/APA2Seg-Net
[ "b9260442bc06181a0ce8ec943f7a6efcfba017b7" ]
[ "data/apada2seg_dataset.py" ]
[ "import os.path\nimport torchvision.transforms as transforms\nfrom data.base_dataset import BaseDataset, get_transform\nfrom PIL import Image\nimport torch\nimport random\nimport data.random_pair as random_pair\nimport pdb\n\n\nclass TrainDataset(BaseDataset):\n def initialize(self, opt):\n self.opt = opt...
[ [ "torch.Tensor" ] ]
matthew-brett/scipy
[ "564df53b3d32c37589834a55814a615e1332ebb0" ]
[ "scipy/stats/tests/test_continuous_basic.py" ]
[ "\nimport numpy as np\nimport numpy.testing as npt\nimport pytest\nfrom pytest import raises as assert_raises\nfrom scipy.integrate import IntegrationWarning\n\nfrom scipy import stats\nfrom scipy.special import betainc\nfrom .common_tests import (check_normalization, check_moment, check_mean_expect,\n ...
[ [ "numpy.testing.assert_allclose", "scipy.stats.burr.moment", "numpy.testing.suppress_warnings", "scipy.stats.distributions.chi2.sf", "scipy.stats.chi.moment", "numpy.histogram", "scipy.stats.fisk.moment", "numpy.log", "numpy.testing.assert_array_almost_equal", "scipy.stats.r...
j-gallistl/reda
[ "13b1f9e1cda92bbbbafc5c28be2c691d3b722740" ]
[ "lib/reda/utils/fix_sign_with_K.py" ]
[ "\"\"\"\nFix signs in resistance measurements using the K factors. The sign of negative\nresistance measurements can be switched if the geometrical factor is negative.\n\"\"\"\nimport numpy as np\n\n\ndef fix_sign_with_K(dataframe):\n \"\"\"Swap electrode denotations so that geometrical (K) factors become\n p...
[ [ "pandas.DataFrame", "numpy.array", "numpy.arctan2", "numpy.where" ] ]
luistrovao/Interface-Python
[ "974663747754830605643158b1bb70e84eb3520b" ]
[ "funcoes.py" ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Nov 12 14:33:27 2019\n\n@author: Gladson\n\"\"\"\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom sklearn.cluster import KMeans\nimport numpy as np\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.tree import DecisionTreeRegressor\nfrom ...
[ [ "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid", "matplotlib.pyplot.plot", "matplotlib.pyplot.boxplot", "matplotlib.pyplot.savefig", "sklearn.cluster.KMeans", "matplotlib.pyplot.figure", "matplotlib.pyplot.title", "matplotlib.pyplot.legend", "matplotlib.pyplot.hist", ...
GeGao2014/fairlearn
[ "b0841c8b07ead6a285bdbc0ea61cac2338cbc96e", "b0841c8b07ead6a285bdbc0ea61cac2338cbc96e", "b0841c8b07ead6a285bdbc0ea61cac2338cbc96e" ]
[ "fairlearn/metrics/_extra_metrics.py", "fairlearn/metrics/_group_metric_result.py", "test/unit/postprocessing/conftest.py" ]
[ "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License.\n\n\"\"\"A variety of extra metrics useful for assessing fairness.\n\nThese are metrics which are not part of `scikit-learn`.\n\"\"\"\n\nimport sklearn.metrics as skm\n\nfrom ._metrics_engine import make_group_metric\n\n...
[ [ "sklearn.metrics.confusion_matrix", "sklearn.metrics.recall_score" ], [ "numpy.array_equal" ], [ "numpy.hstack", "numpy.linspace", "numpy.stack", "numpy.array" ] ]
bccho/pass-glm
[ "4ad14dd043532419dc413c509672b54d1eb8d516" ]
[ "passglm/utils.py" ]
[ "# Authors: Trevor Campbell <tdjc@mit.edu>\n# Jonathan Huggins <jhuggins@mit.edu>\n\nfrom __future__ import absolute_import, print_function\n\nimport os\nimport errno\nimport inspect\nimport time\n\nimport numpy as np\nimport scipy.sparse as sp\nimport numpy.core.numeric as _nx\n\n\ndef format_seconds(secs...
[ [ "scipy.sparse.issparse", "scipy.sparse.csr_matrix", "numpy.zeros", "numpy.core.numeric.array" ] ]
shenqiang-Yuan/mysecondRepo
[ "cbe701ecd586860ff3444f4ad5aea25e209260ea" ]
[ "semantic-segmentation/libraries/semantic/metrics.py" ]
[ "#!/usr/bin/python3\n\nimport keras.backend as KB\nimport tensorflow as tf\n\n\ndef sparse_accuracy_ignoring_last_label(y_true, y_pred):\n nb_classes = KB.int_shape(y_pred)[-1]\n y_pred = KB.reshape(y_pred, (-1, nb_classes))\n\n y_true = KB.one_hot(tf.to_int32(KB.flatten(y_true)),\n ...
[ [ "tensorflow.to_float", "tensorflow.unstack", "tensorflow.stack", "tensorflow.cast" ] ]
ares89/pytorch-image-models
[ "dc51334cdc05757dc9004583aac8668ebd892b03" ]
[ "timm/models/vision_transformer.py" ]
[ "\"\"\" Vision Transformer (ViT) in PyTorch\n\nA PyTorch implement of Vision Transformers as described in:\n\n'An Image Is Worth 16 x 16 Words: Transformers for Image Recognition at Scale'\n - https://arxiv.org/abs/2010.11929\n\n`How to train your ViT? Data, Augmentation, and Regularization in Vision Transformer...
[ [ "torch.nn.Linear", "torch.zeros", "torch.cat", "torch.nn.Dropout", "torch.nn.Identity", "torch.nn.init.constant_", "torch.nn.Tanh", "torch.no_grad", "torch.nn.functional.interpolate", "numpy.load", "torch.nn.init.xavier_uniform_", "torch.linspace", "torch.from_n...
xjqbest/PGL
[ "da9d2e0af8d41e29a73c6b349c2f7b3d664d2acc" ]
[ "pgl/graph_wrapper.py" ]
[ "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless req...
[ [ "numpy.array", "numpy.arange", "numpy.insert", "numpy.cumsum" ] ]
cambouvy/BSc-Thesis-Project
[ "ca2504cb828ab068545e130eac393ceb34f2a457", "ca2504cb828ab068545e130eac393ceb34f2a457" ]
[ "qklnn/misc/binning.py", "qklnn/dataset/filtering.py" ]
[ "import pandas as pd\nimport numpy as np\nimport xarray as xr\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as patches\nfrom matplotlib.gridspec import GridSpec\nfrom IPython import embed\n\n# store = pd.HDFStore('./clipped_nions0_zeffx1_nustar1e-3_sepfluxes.h5')\nstore = pd.HDF...
[ [ "numpy.max", "numpy.array", "matplotlib.pyplot.setp", "numpy.sum", "numpy.hstack", "numpy.min", "matplotlib.pyplot.figure", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.subplot2grid", "pandas.HDFStore", "matplotlib.pyplot.show", "matplotlib.patches.Rectangle...
r-a-morrison/fe_alloy_sound_velocities
[ "8da1b0d073e93fb4b4be3d61b73e58b7a7a3097b" ]
[ "100_vD_FeNiSi_Debye/pick_choice.py" ]
[ "# Substitute for psvl\n\n# Front matter\n##############\nimport os\nfrom os import fdopen, remove\nfrom tempfile import mkstemp\nfrom shutil import move\nimport glob\nimport re\nimport time\nimport pandas as pd\nimport numpy as np\nfrom scipy import constants\nfrom scipy.optimize import curve_fit\nimport matplotli...
[ [ "pandas.read_csv", "numpy.abs", "matplotlib.rc" ] ]
karolzak/Multimodal-Toolkit
[ "2308578e3ab09fa0f8cc2c9bbb9c141bb3ccc721" ]
[ "multimodal_transformers/model/tabular_transformers.py" ]
[ "from torch import nn\nfrom transformers import (\n BertForSequenceClassification,\n RobertaForSequenceClassification,\n DistilBertForSequenceClassification,\n AlbertForSequenceClassification,\n XLNetForSequenceClassification,\n XLMForSequenceClassification\n)\nfrom transformers.models.bert.modeli...
[ [ "torch.nn.Linear", "torch.nn.Dropout", "torch.nn.ReLU" ] ]
skoblov-lab/KUPPNet
[ "835821882cd21e4f9e03fa3e0e64679107fc4658" ]
[ "src/predict.py" ]
[ "from itertools import chain, filterfalse, tee\nfrom numbers import Integral\nfrom typing import Iterable, Optional, Mapping, Text\n\nimport numpy as np\nfrom functools import reduce\n\nfrom src.structures import NetInput, Interval, Seq\n\n\ndef predict_and_dump(inp: NetInput, model: \"keras model\", hparams: Mappi...
[ [ "numpy.where", "numpy.array" ] ]
CDB-2000/mhfp
[ "1c281cf77c7129829cae7648cc83673b4f8315e8" ]
[ "mhfp/lsh_forest.py" ]
[ "import warnings\nimport numpy as np\nfrom functools import partial\nfrom operator import itemgetter\nfrom collections import defaultdict\nfrom mhfp.encoder import MHFPEncoder\n\n# Adapted from:\n# https://github.com/ekzhu/datasketch/blob/master/datasketch/lshforest.py \n\nclass LSHForestHelper():\n \"\"\"A class...
[ [ "numpy.array" ] ]
VidocqH/pytorch
[ "6a085648d81ce88ff59d6d1438fdb3707a0d6fb7" ]
[ "torch/distributed/algorithms/join.py" ]
[ "import warnings\nfrom abc import ABC, abstractmethod\nfrom typing import Any, List, NamedTuple\n\nimport torch\nimport torch.distributed as dist\n\n\nclass _JoinHook(ABC):\n r\"\"\"\n This defines a join hook, which provides two entry points in the join\n context manager: a main hook, which is called repe...
[ [ "torch.zeros", "torch.distributed.get_rank", "torch.distributed.all_reduce", "torch.ones" ] ]
cabelo/visionpaste
[ "bd9d4d40f677e5aac24b4602d3b410b7d7444aa7" ]
[ "api/capture.py" ]
[ "from torchvision import models\nfrom PIL import Image\nimport matplotlib.pyplot as plt\nimport torch\nimport numpy as np\nimport cv2\nimport base64\nimport torchvision.transforms as T\n\ndef decode_segmap(image, source, nc=21):\n\n label_colors = np.array([(0, 0, 0), # 0=background\n # 1=aeroplane,...
[ [ "numpy.zeros_like", "numpy.array", "numpy.ones_like", "numpy.stack", "matplotlib.pyplot.show", "matplotlib.pyplot.axis", "matplotlib.pyplot.imshow" ] ]
hross/optuna
[ "2f896b2b51a99a6ebe7206310c5b9d3cb88fc782" ]
[ "examples/pruning/mxnet_integration.py" ]
[ "\"\"\"\nOptuna example that demonstrates a pruner for MXNet.\n\nIn this example, we optimize the validation accuracy of hand-written digit recognition using\nMXNet and MNIST, where the architecture of the neural network and the learning rate of optimizer\nis optimized. Throughout the training of neural networks, a...
[ [ "numpy.random.RandomState" ] ]
Ojjie/Sem5-Assignments
[ "c1c96ae468792f1fc1310ef6e2e8a8b8c97f1434" ]
[ "MI/Assignment 1/Assignment1.py" ]
[ "'''\r\nAssume df is a pandas dataframe object of the dataset given\r\n'''\r\nimport numpy as np\r\nimport pandas as pd\r\nimport random\r\n\r\n'''Calculate the entropy of the enitre dataset'''\r\n\t#input:pandas_dataframe\r\n\t#output:int/float/double/large\r\n\r\ndef get_entropy_of_dataset(df):\r\n\tentropy = 0 \...
[ [ "numpy.log2" ] ]
9173860/WMSeg
[ "526d3ad0bf17bc657d9100cbcb7a0d8682b10643" ]
[ "pytorch_pretrained_bert/modeling_transfo_xl.py" ]
[ "# coding=utf-8\n# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.\n# Copyright (c) 2018, NVIDIA CORPORATION. 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 w...
[ [ "torch.nn.Linear", "torch.cat", "torch.nn.ParameterList", "torch.einsum", "torch.nn.ModuleList", "torch.ones", "torch.load", "torch.chunk", "torch.ger", "torch.nn.init.constant_", "torch.tril", "tensorflow.train.list_variables", "torch.nn.init.normal_", "num...
henriettekhn/MLinPractice
[ "ad05f0137a407a17e75ffca08706c5250bcd0d49" ]
[ "test/preprocessing/tokenizer_test.py" ]
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Oct 7 14:30:41 2021\n\n@author: ml\n\"\"\"\n\nimport unittest\nimport pandas as pd\nfrom script.preprocessing.tokenizer import Tokenizer\n\nclass TokenizerTest(unittest.TestCase):\n \n def setUp(self):\n self.INPUT_COLUMN = \"inp...
[ [ "pandas.DataFrame" ] ]
prozyy/Pose3D-RIE
[ "32488a29b5444e85cd4d60744b97ae3b6c3098c7" ]
[ "common/loss.py" ]
[ "# Copyright (c) 2018-present, Facebook, Inc.\n# All rights reserved.\n#\n# This source code is licensed under the license found in the\n# LICENSE file in the root directory of this source tree.\n#\n\nimport torch\nimport numpy as np\n\ndef mpjpe_loss(predicted, target):\n \"\"\"\n Mean per-joint position err...
[ [ "numpy.matmul", "numpy.sum", "numpy.linalg.det", "numpy.mean", "numpy.diff", "numpy.linalg.svd", "torch.sum" ] ]
cuckoong/mne-python
[ "09ede511b83720076d26e22b71c5eb5cad5c2f9f" ]
[ "mne/report.py" ]
[ "\"\"\"Generate self-contained HTML reports from MNE objects.\"\"\"\n\n# Authors: Alex Gramfort <alexandre.gramfort@inria.fr>\n# Mainak Jas <mainak@neuro.hut.fi>\n# Teon Brooks <teon.brooks@gmail.com>\n#\n# License: BSD (3-clause)\n\nimport base64\nfrom io import BytesIO\nimport os\nimport os.path...
[ [ "numpy.rot90", "numpy.array", "numpy.zeros", "numpy.roll", "matplotlib.pyplot.close", "matplotlib.pyplot.subplots", "numpy.isscalar", "numpy.arange", "matplotlib.figure.Figure", "matplotlib.backends.backend_agg.FigureCanvasAgg", "numpy.array_split" ] ]
ConnollyLeon/DeepSpeed
[ "2d84d1c185ef0345eaf43a7240d61b33eda43497" ]
[ "deepspeed/ops/adam/cpu_adam.py" ]
[ "'''\r\nCopyright 2020 The Microsoft DeepSpeed Team\r\n'''\r\n\r\nimport math\r\nimport torch\r\nimport time\r\nfrom pathlib import Path\r\nfrom ..op_builder import CPUAdamBuilder\r\n\r\n\r\nclass DeepSpeedCPUAdam(torch.optim.Optimizer):\r\n optimizer_id = 0\r\n\r\n def __init__(self,\r\n mode...
[ [ "torch.zeros_like", "torch.no_grad", "torch.enable_grad" ] ]
hutuxian/FleetX
[ "843c7aa33f5a14680becf058a3aaf0327eefafd4" ]
[ "deprecated/examples/distribute_ctr/infer.py" ]
[ "# Copyright (c) 2019 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.mean" ] ]
jvishnuvardhan/datasets
[ "b8e38187058f1221e67c6291b3f29385ebb35fa2", "b8e38187058f1221e67c6291b3f29385ebb35fa2" ]
[ "tensorflow_datasets/conftest.py", "tensorflow_datasets/testing/test_case.py" ]
[ "# coding=utf-8\n# Copyright 2021 The TensorFlow Datasets 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 ...
[ [ "tensorflow.compat.v1.enable_v2_behavior" ], [ "tensorflow.compat.v1.test.get_temp_dir" ] ]
ishandutta2007/sonnet
[ "417a5bb73e579963728e3f9b40ad583ac014601a" ]
[ "sonnet/python/modules/pondering_rnn.py" ]
[ "# Copyright 2017 The Sonnet 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 required ...
[ [ "tensorflow.zeros", "tensorflow.sigmoid", "tensorflow.where", "tensorflow.reduce_any", "tensorflow.equal", "tensorflow.while_loop", "tensorflow.TensorShape", "tensorflow.ones", "tensorflow.constant" ] ]
xipeng-jin/pgmpy
[ "54c6222d1d5f33efa6699a7de7a7b2d91b1f9160" ]
[ "pgmpy/tests/test_estimators/test_MaximumLikelihoodEstimator.py" ]
[ "import unittest\n\nimport pandas as pd\nimport numpy as np\n\nfrom pgmpy.models import BayesianModel\nfrom pgmpy.estimators import MaximumLikelihoodEstimator\nfrom pgmpy.factors.discrete import TabularCPD\n\n\nclass TestMLE(unittest.TestCase):\n def setUp(self):\n self.m1 = BayesianModel([(\"A\", \"C\"),...
[ [ "pandas.DataFrame" ] ]
bsipocz/specutils
[ "926920e1d70a0df1f7862363ca027eb723a61518" ]
[ "specutils/io/IUE.py" ]
[ "import numpy as np\n\nfrom astropy.io import fits\nfrom astropy.nddata.nduncertainty import StdDevUncertainty\n\nfrom ..spectrum1d import Spectrum1D\n\nclass ApertureException(Exception):\n\n def __init__(self, apertures):\n self.apertures = apertures\n \n def __str__(self):\n\n message = \"...
[ [ "numpy.where", "numpy.array", "numpy.arange" ] ]
ethiery/HPCassignments
[ "c2d0eac5808394b5061efafc2d072551e631647d" ]
[ "2_funWithMPI/videoGenerator.py" ]
[ "import sys\nimport os\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.animation as animation\n\ndef readFile(file):\n x, y = [], []\n with open(file, 'r') as f:\n f.readline() #skip first line\n for line in f:\n values = line.split(' ')\n x.append(f...
[ [ "matplotlib.animation.FFMpegWriter", "matplotlib.pyplot.xlim", "matplotlib.pyplot.ylim", "matplotlib.pyplot.figure", "matplotlib.pyplot.scatter" ] ]
CentreInnovationLevio/global-attribution-mapping
[ "068ce6071003433ef4a8381ae4dc0f54da4aa06e" ]
[ "gam/spearman_distance.py" ]
[ "\"\"\"\nImplementation of Spearman's Rho squared as a pairwise distance metric\nBase on\nhttp://www.plhyu.com/administrator/components/com_jresearch/files/publications/Mixtures_of_weighted_distance-based_models_for_ranking_data_with_applications_in_political_studies.pdf\n\nTODO:\n- add tests\n\"\"\"\n\nfrom sklear...
[ [ "numpy.sum" ] ]
jaehwlee/silence-remover
[ "5b45131d2c1979fed04ce2e09c2be4d6924b65e5" ]
[ "utils.py" ]
[ "import numpy as np\nimport librosa\n\n\ndef remove_silence(audio, top_db=53, frame_length=1024, hop_length=256, skip_idx=0):\n # Trim leading and trailing silence from an audio signal\n _, trim_index = librosa.effects.trim(audio, top_db=20)\n audio = audio[max(trim_index[0], 0):min(trim_index[1], len(aud...
[ [ "numpy.concatenate", "numpy.array", "numpy.zeros" ] ]
pnkraemer/probabilistic-bvp-solver
[ "0124349918106f36ba51d5697dc403c2d238b815" ]
[ "bvps/bridges.py" ]
[ "\"\"\"Integrated bridges.\"\"\"\n\nimport numpy as np\nfrom probnum import statespace\n\nfrom .ode_measmods import from_boundary_conditions\nfrom .problems import SecondOrderBoundaryValueProblem\n\nSMALL_VALUE = 0.0\n\n\nclass GaussMarkovBridge(statespace.Integrator, statespace.LTISDE):\n \"\"\"\n Examples\n...
[ [ "numpy.abs", "numpy.zeros" ] ]
mayerjRRR/TricycleGAN
[ "6c0ef0a258266599a7eb35d2a1dac437f7068346" ]
[ "src/utils/image_utils.py" ]
[ "import numpy as np\nimport cv2\nimport os\n\nvideo_formats = [\".mp4\"]\nimage_formats = [\".jpg\", \".jpeg\", \".png\"]\n\n\ndef is_directory(path):\n return os.path.isdir(path)\n\n\ndef is_video(file_path):\n file_ending = get_file_format(file_path)\n return file_ending in video_formats\n\n\ndef is_imag...
[ [ "numpy.array" ] ]
flo-compbio/SingleCellOpenProblems
[ "c4b519252a867745448e5e0a133ba2bdbfd164b6" ]
[ "scripts/collate_dataset.py" ]
[ "import numpy as np\nimport json\nimport os\nimport sys\nimport openproblems\n\n\ndef main(task_name, dataset_name, input_dir, output_file):\n\n task = eval(\"openproblems.tasks.{}\".format(task_name))\n dataset = getattr(task.datasets, dataset_name)\n\n result = []\n for method in task.METHODS:\n ...
[ [ "numpy.argsort" ] ]
j1a0m0e4sNTU/Variational-Autoencoder-for-images
[ "f5d4bbd75e09bfcf20fa11b8b895420cc186d2bc" ]
[ "models/vae_01.py" ]
[ "import torch\nimport torch.nn as nn\nimport numpy as np\n\ndef Conv2d(in_planes, out_planes, kernel_size = 3):\n layer = nn.Sequential(\n nn.Conv2d(in_channels= in_planes, out_channels= out_planes, kernel_size= kernel_size, padding= (kernel_size-1)//2),\n nn.BatchNorm2d(out_planes),\n nn.Re...
[ [ "torch.zeros", "torch.nn.Linear", "numpy.random.normal", "torch.rand_like", "torch.nn.MaxPool2d", "torch.nn.BatchNorm2d", "torch.nn.ConvTranspose2d", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.tensor", "torch.exp" ] ]
AlmaLuna94/NeuronsAndMotors
[ "ce3d3cf471c10cd9ef7925db7b2aafb067f73a75" ]
[ "loop.py" ]
[ "##A loop that implements a method like the ones in main_file(Needs to be renamed) and testImageNeurons. Then takes those results and sends them to the motors. \n# Actually sending them to the motors have not been fully implemented yet. But the file in KTH-Neuro-Computing-Systems/Multi-motor does this. So just conn...
[ [ "torch.zeros", "torch.ones", "torch.from_numpy", "torch.tensor", "torch.as_tensor", "scipy.signal.convolve2d", "torch.topk" ] ]
UsernameChun/nums
[ "3a10598cc32b9763f1f2733e9e1089399d48ef3c" ]
[ "nums/core/grid/grid.py" ]
[ "# Copyright (C) 2020 NumS Development Team.\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.product", "numpy.empty", "numpy.min", "numpy.finfo", "numpy.iinfo", "numpy.dtype" ] ]
precedenceguo/gluon-cv
[ "f116fbd3b0cebbf2a34f08461471db3b4e1c7133" ]
[ "gluoncv/model_zoo/yolo/yolo_target.py" ]
[ "\"\"\"Target generators for YOLOs.\"\"\"\n# pylint: disable=arguments-differ, unsupported-assignment-operation\nfrom __future__ import absolute_import\nfrom __future__ import division\n\nimport numpy as np\nfrom mxnet import gluon\nfrom mxnet import nd\nfrom mxnet import autograd\nfrom ...nn.bbox import BBoxCorner...
[ [ "numpy.nonzero", "numpy.log", "numpy.cumsum" ] ]
guangtunbenzhu/BGT-Cosmology
[ "2dbedfb6ead3ecd2f43a2716cfd388a5a65979ee", "2dbedfb6ead3ecd2f43a2716cfd388a5a65979ee" ]
[ "Spectroscopy/specutils.py", "Spectroscopy/plotutils.py" ]
[ "\n\"\"\" \nUseful small tools for spectroscopic analysis\n\"\"\"\n\n# Python 3 vs. 2\nfrom __future__ import print_function, division\n\n# Standard Library Modules\nimport numpy as np\nfrom scipy.interpolate import UnivariateSpline, interp1d\nfrom scipy import constants\n\n# Third Party Modules\n\n# Your Own Modul...
[ [ "scipy.interpolate.interp1d", "numpy.array", "numpy.zeros", "numpy.log", "scipy.interpolate.UnivariateSpline", "numpy.where", "numpy.arange", "numpy.power", "numpy.amax", "numpy.amin", "numpy.searchsorted", "numpy.log10", "numpy.in1d" ], [ "numpy.ones_li...
shagunsodhani/ParlAI
[ "5b634b844807372adfb0f6d6e5c42341ac8138f0" ]
[ "parlai/agents/drqa/utils.py" ]
[ "# Copyright (c) 2017-present, Facebook, Inc.\n# All rights reserved.\n# This source code is licensed under the BSD-style license found in the\n# LICENSE file in the root directory of this source tree. An additional grant\n# of patent rights can be found in the PATENTS file in the same directory.\nimport torch\nimp...
[ [ "torch.cat", "torch.LongTensor" ] ]
Freddo1/Emotion-detection
[ "224d7c6229de9fdc946f5492337b000e99f74a0b" ]
[ "Master_detection/detect_faces_cmd.py" ]
[ "#python detect_faces_cmd.py -p Detection_models/deploy.prototxt.txt -d Detection_models/ResNet_300x300.caffemodel\nimport sys,os\nsys.path.append(os.getcwd())\nfrom imutils.video import VideoStream\nimport numpy as np\nimport argparse\nimport time\nimport cv2\n\n# Required arguments are paths to prototxt, detectio...
[ [ "numpy.array" ] ]
everythoughthelps/SfmLearner-Pytorch
[ "b506ac3532e15632443f51d373804de1d69c6d32", "b506ac3532e15632443f51d373804de1d69c6d32" ]
[ "models/modeling/backbone/resnet.py", "models/modeling/backbone/drn.py" ]
[ "import math\nimport torch.nn as nn\nimport torch.utils.model_zoo as model_zoo\nfrom models.modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d\n\nclass Bottleneck(nn.Module):\n expansion = 4\n\n def __init__(self, inplanes, planes, stride=1, dilation=1, downsample=None, BatchNorm=None):\n ...
[ [ "torch.rand", "torch.nn.MaxPool2d", "torch.nn.Sequential", "torch.utils.model_zoo.load_url", "torch.nn.ReLU", "torch.nn.Conv2d" ], [ "torch.rand", "torch.nn.MaxPool2d", "torch.nn.Sequential", "torch.utils.model_zoo.load_url", "torch.nn.ReLU", "torch.nn.Conv2d" ...
Tough2011/PaddleSleeve
[ "e654598a370220fbbc96ae527833676183909383" ]
[ "AdvBox/examples/image_cls/imagenet_tutorial_gp.py" ]
[ "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless ...
[ [ "numpy.asarray", "numpy.copy", "numpy.transpose", "numpy.argmax", "numpy.clip", "numpy.squeeze", "numpy.expand_dims", "numpy.floor" ] ]
onlyforreg/deep-learning-from-scratch
[ "e71797f95b8442e592a4424df91dac06cc4934f6" ]
[ "ch04/train_neuralnet.py" ]
[ "# coding: utf-8\nimport sys, os\nsys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定\nsys.path.append(os.getcwd())\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom dataset.mnist import load_mnist\nfrom two_layer_net import TwoLayerNet\n\n# データの読み込み\n(x_train, t_train), (x_test, t_test) = load_mnist(n...
[ [ "numpy.random.choice", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.ylim", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.show" ] ]
atzenn/detectron2
[ "989f52d67d05445ccd030d8f13d6cc53e297fb91" ]
[ "detectron2/modeling/poolers.py" ]
[ "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\nimport math\nimport sys\nimport torch\nfrom torch import nn\nfrom torchvision.ops import RoIPool\n\nfrom detectron2.layers import ROIAlign, ROIAlignRotated, cat\n\n\ndef assign_boxes_to_levels(box_lists, min_level, max_level, canonical_box_si...
[ [ "torch.zeros", "torch.nonzero", "torch.clamp", "torch.log2" ] ]
Little-Sky/highway-env
[ "e48a6237e45ead4242e7e62ab5b88c3b75b8aa59" ]
[ "highway_env/vehicle/uncertainty/prediction.py" ]
[ "import copy\nfrom typing import List, Tuple, Callable, Union, TYPE_CHECKING\nimport numpy as np\n\nfrom highway_env import utils\nfrom highway_env.interval import polytope, vector_interval_section, integrator_interval, \\\n interval_negative_part, intervals_diff, intervals_product, LPV, interval_absolute_to_loc...
[ [ "numpy.array", "numpy.sin", "numpy.zeros", "numpy.minimum", "numpy.eye", "numpy.identity", "numpy.tensordot", "numpy.transpose", "numpy.cos", "numpy.clip", "numpy.flip", "numpy.maximum" ] ]
stanford-futuredata/sketchstore
[ "c209e4d01343a05dc5aecdb7a9801fc639019fd3", "c209e4d01343a05dc5aecdb7a9801fc639019fd3" ]
[ "python/tests/test_bias_optimizer.py", "python/linear_bench.py" ]
[ "import unittest\nimport pandas as pd\nimport numpy as np\n\n# import storyboard.bias_optimizer as bopt\nimport storyboard.bias_solver as bopt\n\n\nclass BiasOptimizerTest(unittest.TestCase):\n def test_bias(self):\n xs = [\n np.array(pd.Series(np.random.zipf(a=1.1, size=30000)).value_counts())...
[ [ "numpy.random.zipf", "numpy.array" ], [ "pandas.read_csv", "numpy.sort", "numpy.array_split", "numpy.random.RandomState" ] ]
Roypic/Attention_Code
[ "5b6cbfc36e49101567d19d65894641550917a66e" ]
[ "external_attention_block/SK-Net.py" ]
[ "#code from https://zhuanlan.zhihu.com/p/379501097?utm_source=qq&utm_medium=social&utm_oi=1042802029118377984\nimport torch\nimport torch.nn as nn\nclass SKConv(nn.Module):\n def __init__(self, features, M=2, G=32, r=16, stride=1, L=32):\n \"\"\" Constructor\n Args:\n features: input cha...
[ [ "torch.cat", "torch.nn.Softmax", "torch.nn.ModuleList", "torch.nn.BatchNorm2d", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.nn.AdaptiveAvgPool2d", "torch.sum" ] ]
zhanwenchen/scikit-image
[ "af8a78e5b12ebb5709a57f9350b4b1f4c8f0c7db" ]
[ "doc/examples/edges/plot_skeleton.py" ]
[ "\"\"\"\n===========\nSkeletonize\n===========\n\nSkeletonization reduces binary objects to 1 pixel wide representations. This\ncan be useful for feature extraction, and/or representing an object's topology.\n\n``skeletonize`` works by making successive passes of the image. On each pass,\nborder pixels are identifi...
[ [ "matplotlib.pyplot.show", "matplotlib.pyplot.subplots" ] ]
codecrap/qtt
[ "39a8bf21f7bcab94940a66f4d553a14bf34f82b0" ]
[ "src/qtt/instrument_drivers/virtualAwg/virtual_awg.py" ]
[ "import logging\nfrom typing import List\n\nimport numpy as np\nfrom qcodes import Instrument\n\nfrom qtt.instrument_drivers.virtualAwg.awgs.common import AwgCommon\nfrom qtt.instrument_drivers.virtualAwg.awgs.KeysightM3202A import KeysightM3202A_AWG\nfrom qtt.instrument_drivers.virtualAwg.awgs.Tektronix5014C impor...
[ [ "numpy.sum", "numpy.prod" ] ]
Cagla-oksuz/Object-Detection-and-counting-with-Fast-R-CNN
[ "ad614c056b401c5f8755b9319deae78b869bf8a3" ]
[ "models_tez/research/object_detection/utils/object_detection_evaluation.py" ]
[ "# Copyright 2017 The TensorFlow 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 requ...
[ [ "numpy.concatenate", "numpy.append", "numpy.array", "numpy.empty", "numpy.zeros", "tensorflow.py_func", "numpy.sum", "numpy.ones", "numpy.any", "numpy.nanmean", "numpy.float32", "numpy.isscalar", "tensorflow.control_dependencies", "numpy.argwhere", "nump...
Landslide-Analytics-System/GLAS
[ "1a51a7365dcd6a29ded6798d29f3a1f90b93a0c3" ]
[ "forecasting models/figures.py" ]
[ "import matplotlib.pyplot as plt\nimport seaborn as sns\n\ndef saveConfusionMatrix(filename, title, matrix):\n plt.clf()\n sns.set(font_scale=1.5)\n sns.heatmap(matrix, annot=True, cmap=\"magma_r\")\n plt.xlabel('Predicted')\n plt.ylabel('True')\n plt.tight_layout()\n plt.title(title)\n plt....
[ [ "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig", "matplotlib.pyplot.title", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.clf" ] ]
LiuPhyMan/SpecFit
[ "570b3696b22114fb85731c86eb01eb2bf3a00b72" ]
[ "demo_new_fit.py" ]
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on 16:30 2019/3/11\n\n@author: Liu Jinbao\n@mail: liu.jinbao@outlook.com\n@project: SpecFit\n@IDE: PyCharm\n\"\"\"\nimport numpy as np\nfrom scipy.optimize import curve_fit\nfrom spectra import OHSpectra\nfrom matplotlib import pyplo...
[ [ "numpy.array", "numpy.ones_like", "scipy.optimize.curve_fit", "matplotlib.pyplot.errorbar", "numpy.linspace", "numpy.diag" ] ]
jorgemauricio/automatizacion_python
[ "8969c6335d60b93cbfb61dd98fda7880275a63ba" ]
[ "generar_graficas_por_estacion.py" ]
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Jul 17 16:17:25 2017\n\n@author: jorgemauricio\n\"\"\"\n\n# librerías\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport requests\nimport json\n\ndef main():\n # leer csv\n df = pd.read_csv(\"data/estado1_5...
[ [ "pandas.read_csv", "matplotlib.pyplot.figure" ] ]
nathantgray/HELICS-Examples
[ "0d4ed1d8ee0de967b2d385679100c47ea81cdbcc" ]
[ "user_guide_examples/fundamental/fundamental_message_comm/combo/Charger.py" ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on 9/15/2020\n\nThis is a simple EV federate that models a set of EV terminals in an\nEV charging garage. Each terminal can support charging at levels 1, 2,\nand 3 but the EVs that come to charge have a randomly assigned charging\nlevel.\n\nManaging these terminals is a cen...
[ [ "numpy.random.normal", "numpy.array", "numpy.random.choice", "numpy.random.seed", "matplotlib.pyplot.grid", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.title", "numpy.interp", "matplotlib.pyplot.savefig", "numpy.arange", "matplotlib.pypl...
lbny/argus
[ "5160839bd747f5073a892736ea3405f0fc126691" ]
[ "argus/explore/chart.py" ]
[ "import matplotlib.pyplot as plt\nimport pandas as pd\nimport numpy as np\nimport seaborn as sns\nimport itertools\n\nfrom argus.utils import to_array, to_ndarray\n\ndef plot_mirrorline(df, x_column, scale=False):\n if isinstance(x_column, str):\n x_points = df[x_column]\n else:\n x_points = to_...
[ [ "numpy.array", "pandas.DataFrame", "matplotlib.pyplot.legend", "matplotlib.pyplot.subplots", "numpy.arange", "matplotlib.pyplot.show" ] ]
tsutterley/PointDatabase
[ "094ea04133790f788410f73fb0b406a2d65273c4" ]
[ "read_DEM_index.py" ]
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Mar 13 15:25:04 2019\n\n@author: ben\n\"\"\"\nfrom .geo_index import geo_index\nfrom .read_DEM import read_DEM\nfrom .point_data import point_data\nfrom .WV_date import WV_date\nimport numpy as np\n\ndef read_DEM_index(xy0, W, GI=None, IndexFi...
[ [ "numpy.zeros_like", "numpy.isfinite" ] ]
initc/bert-fairseq
[ "9f1e34d30dde8b5d3fd397d413bb6a530add8713" ]
[ "fairseq/data/indexed_dataset.py" ]
[ "# Copyright (c) 2017-present, Facebook, Inc.\n# All rights reserved.\n#\n# This source code is licensed under the license found in the LICENSE file in\n# the root directory of this source tree. An additional grant of patent rights\n# can be found in the PATENTS file in the same directory.\n\nimport os\nimport stru...
[ [ "numpy.array", "numpy.copyto", "numpy.empty", "torch.from_numpy" ] ]
NiklasHoltmeyer/FashionNets
[ "918e57f122b8cfa36dba1d0b993c763ba35ac815", "918e57f122b8cfa36dba1d0b993c763ba35ac815" ]
[ "fashionnets/models/embedding/resnet50.py", "fashionnets/train_jobs/loader/dataset_loader.py" ]
[ "import tensorflow as tf\nfrom fashionnets.models.layer.ResNetIdentityBlock import ResnetIdentityBlock\nfrom fashiondatasets.utils.logger.defaultLogger import defaultLogger\nfrom tensorflow.keras.applications import resnet\nfrom tensorflow.keras.regularizers import l2\nfrom tensorflow.python.keras.models import Seq...
[ [ "tensorflow.keras.applications.resnet.ResNet50", "tensorflow.keras.layers.AveragePooling2D", "tensorflow.keras.layers.Flatten", "tensorflow.keras.layers.Dense", "tensorflow.keras.regularizers.l2" ], [ "tensorflow.convert_to_tensor", "numpy.load", "tensorflow.numpy_function", ...
gyshi/intel-models
[ "4ead44aa254a84109ac8019f5d386e3adb75ac26", "4ead44aa254a84109ac8019f5d386e3adb75ac26" ]
[ "models/face_detection_and_alignment/tensorflow/facenet/fp32/validate_on_lfw.py", "models/image_recognition/tensorflow/densenet169/inference/fp32/accuracy.py" ]
[ "\"\"\"Validate a face recognizer on the \"Labeled Faces in the Wild\" dataset (http://vis-www.cs.umass.edu/lfw/).\nEmbeddings are calculated using the pairs from http://vis-www.cs.umass.edu/lfw/pairs.txt and the ROC curve\nis calculated and plotted. Both the model metagraph and the model parameters need to exist\n...
[ [ "numpy.zeros_like", "tensorflow.train.start_queue_runners", "numpy.array", "numpy.ones_like", "numpy.zeros", "tensorflow.train.Coordinator", "tensorflow.get_default_graph", "scipy.interpolate.interp1d", "tensorflow.Graph", "tensorflow.Session", "numpy.mean", "tensor...
sansculotte/glitchbox
[ "1bf7b95b3dd114d5c19fec62197103ae572a9e48" ]
[ "audiopack.py" ]
[ "from collections import namedtuple\nfrom scipy.io import wavfile\n#from drawSVG import Line\nimport numpy as np\n\n\"\"\"\nAn audio-visualizing library\n\"\"\"\n\n#\n##\n### Audio data functions\n##\n#\n\ndef pcm2float(sig, dtype='float64'):\n \"\"\"Convert PCM signal to floating point with a range from -1 to 1...
[ [ "scipy.io.wavfile.read", "numpy.asarray", "numpy.lib.pad", "numpy.iinfo", "numpy.dtype" ] ]
tgdif/pyoneer
[ "7d9e3ca10b9209bb62eb446ef73b468668bed453", "7d9e3ca10b9209bb62eb446ef73b468668bed453" ]
[ "pyoneer/activations/activations_test.py", "pyoneer/regularizers/regularizers_test.py" ]
[ "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport tensorflow as tf\n\nfrom pyoneer.activations.activations_impl import swish\n\n\nclass ActivationsTest(tf.test.TestCase):\n def test_swish(self):\n x = tf.constant([-1.0, 0.0, +1.0])\n ...
[ [ "tensorflow.constant", "tensorflow.test.main" ], [ "tensorflow.ones", "tensorflow.test.main" ] ]
zhongmicai/pacbio_variant_caller_from_3rdReads
[ "43d28cbd4e76ed2a4e820ded11a80592675db6c9" ]
[ "scripts/PrintGapSupport.py" ]
[ "#!/usr/bin/env python\n\nimport argparse\nimport numpy as np\nimport math\nimport sys\nimport pdb\nimport bisect\n\nap = argparse.ArgumentParser(description=\"Print gap support from output of PrintGaps.py.\")\nap.add_argument(\"table\", help=\"Input tabular file\")\nap.add_argument(\"out\", help=\"Output file, std...
[ [ "numpy.unique" ] ]
jg10545/patchwork
[ "6fe85ac46eef4e7763129b7f1e77700f939da738" ]
[ "patchwork/viz/_feature.py" ]
[ "# -*- coding: utf-8 -*-\nimport numpy as np\nfrom PIL import Image\nfrom scipy.spatial.distance import cdist\n\n\ndef _build_query_image(features, labels, labeldict, num_returned=4):\n \"\"\"\n For a label dictionary and set of associated features- build a\n numpy array that we can use as a tensorboard im...
[ [ "numpy.concatenate", "scipy.spatial.distance.cdist", "numpy.arange", "numpy.expand_dims" ] ]
ydwu4/dgl-hack
[ "b0fee8b9723c71f45bcf00301653fc71bfa82bc1" ]
[ "apps/life_sci/examples/property_prediction/utils.py" ]
[ "import dgl\nimport numpy as np\nimport random\nimport torch\n\nfrom dgllife.utils.featurizers import one_hot_encoding\nfrom dgllife.utils.splitters import RandomSplitter\n\ndef set_random_seed(seed=0):\n \"\"\"Set random seed.\n Parameters\n ----------\n seed : int\n Random seed to use\n \"\"...
[ [ "torch.cuda.manual_seed", "torch.stack", "numpy.random.seed", "torch.ones", "torch.manual_seed", "torch.cuda.is_available" ] ]
xiong-jie-y/pika
[ "f570a9df443ed36ecd7313e0747b77a3152e343f" ]
[ "pikapi/motion/complimentary_filter.py" ]
[ "import math\nfrom functools import reduce\nfrom typing import Optional\nimport numpy as np\n\nfrom scipy.spatial.transform.rotation import Rotation\n\n\ndef rpy_to_rotation(rpy):\n rot_axises = np.array([[0, 0, -1], [1, 0, 0], [0, 1, 0]], dtype=np.float32)\n rots = [\n Rotation.from_rotvec(ax * angle)...
[ [ "scipy.spatial.transform.rotation.Rotation.from_rotvec", "numpy.array", "scipy.spatial.transform.rotation.Rotation.identity" ] ]
mattbellis/earthquake-ray-visualization
[ "260870c4737785341098c97a604ec64e3b9a6568" ]
[ "eq_tools.py" ]
[ "import numpy as np\nimport matplotlib.pylab as plt\n\n################################################################################\ndef get_earth_data(filename='Earth_density_and_earthquake_velocity_data_SMOOTHED.csv'):\n vals = np.loadtxt(filename,skiprows=1,dtype=float,unpack=True,delimiter=',')\n radi...
[ [ "numpy.arccos", "matplotlib.pylab.ylabel", "numpy.tan", "matplotlib.pylab.tight_layout", "numpy.cos", "numpy.deg2rad", "matplotlib.pylab.xlim", "numpy.sin", "numpy.arcsin", "matplotlib.pylab.subplot", "numpy.arange", "numpy.sqrt", "matplotlib.pylab.gca", "ma...
GrMysov/seasonality-and-feature-selection
[ "bb459b4436bfd3a149145f9d9cf6da70904f5c0f" ]
[ "choice-models-estimation/LogregModelBlender.py" ]
[ "import math\nimport numpy as np\nimport pandas as pd\nimport dill\n\nimport pyspark\nfrom pyspark.sql import functions as f\nfrom pyspark.sql.types import *\n\n\nimport ChoiceModelEstimator\n\n\nclass LogregModelBlender:\n def __init__(self, outer_feats, model_names, model_feats, \n regularizati...
[ [ "numpy.hstack", "numpy.exp", "numpy.expand_dims" ] ]
mycask/cat-classifier-dnn
[ "f21c0911f93dddadb4dfce0e74a98f6c3fff031d" ]
[ "classify.py" ]
[ "#!/usr/bin/env python3\n\nimport os\nimport sys\nimport json\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport model\n\n\ndef classify_images(dirname, verbose=False):\n \"\"\"Classify all images in a given directory.\n\n The directory must contain 64x64 PNG images only.\n\n Arguments:\n di...
[ [ "numpy.array", "matplotlib.pyplot.imread" ] ]
shingiyeon/cs474
[ "fd984740abff0eb54150a8a958804de46f56bea8" ]
[ "input_utils.py" ]
[ "import numpy as np\nimport tensorflow as tf\n\n\ndef tensorize_labeled_spans(tuples, label_dict):\n if len(tuples) > 0:\n starts, ends, labels = zip(*tuples)\n else:\n starts, ends, labels = [], [], []\n\n if label_dict:\n return np.array(starts), np.array(ends), np.array([label_dict.get(c, 0) for c in...
[ [ "numpy.concatenate", "numpy.array", "numpy.zeros_like", "numpy.zeros", "numpy.expand_dims", "numpy.unique" ] ]
burmist-git/cta-lstchain
[ "f0ed94d73fe7f4e72adbc803fb977b730bd591d2" ]
[ "lstchain/reco/utils.py" ]
[ "#!/usr/bin/env python3\n\"\"\"Module with auxiliar functions:\nTransform AltAz coordinates into Camera coordinates (This should be\nimplemented already in ctapipe but I haven't managed to find how to\ndo it)\nCalculate source position from disp_norm distance.\nCalculate disp_ distance from source position.\n\nUsag...
[ [ "numpy.array", "numpy.sin", "numpy.empty", "numpy.matmul", "numpy.clip", "numpy.isnan", "numpy.zeros", "numpy.copy", "numpy.interp", "numpy.sign", "numpy.arctan", "numpy.einsum", "numpy.cos", "numpy.sqrt", "numpy.isfinite" ] ]
MorganNotFound/Python_3.8.3_32bit
[ "385c261c18d44a8c22c8cef7aff94c9a252d1b8a" ]
[ "Lib/site-packages/gobang/algorithm/mcts.py" ]
[ "\"\"\"Monte Carlo Tree Search, as described in Silver et al 2015.\n\nThis is a \"pure\" implementation of the AlphaGo MCTS algorithm in that it is not specific to the\ngame of Go; everything in this file is implemented generically with respect to some state, actions,\npolicy function, and value function.\n\"\"\"\n...
[ [ "numpy.sqrt" ] ]
LANL-Seismoacoustics/infrapy
[ "132c1f5f9c074eca7300ab35d23109d8423a9912" ]
[ "scripts/read_rassoc_numdet.py" ]
[ "\n\n#!/usr/bin/env python\nimport sys, pdb\nimport sqlalchemy as sa\nfrom sqlalchemy.orm import Session\nfrom sqlalchemy.ext.declarative import declarative_base\n#from pisces.io.trace import read_waveform\nfrom obspy.core import UTCDateTime\nfrom obspy.core import trace\nfrom obspy.core import Stream\nfrom obspy.c...
[ [ "numpy.unique" ] ]
iamlab-cmu/perception
[ "e7bcf171e19116ecb118a52c878257a9784fd8c2" ]
[ "perception/chessboard_registration.py" ]
[ "\"\"\"\nClasses for easy chessboard registration\nAuthors: Jeff Mahler and Jacky Liang\n\"\"\"\nimport cv2\nimport logging\nimport math\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport time\n\nfrom autolab_core import PointCloud, RigidTransform, Point\nfrom .image import DepthImage\n\nclass ChessboardR...
[ [ "numpy.array", "numpy.linalg.norm", "numpy.zeros", "numpy.median", "numpy.round", "numpy.linalg.inv", "matplotlib.pyplot.plot", "matplotlib.pyplot.title", "numpy.ones", "numpy.mean", "matplotlib.pyplot.figure", "matplotlib.pyplot.show", "numpy.abs", "matplot...
jianzhnie/AutoTabular
[ "d630c78290a52f8c73885afb16884e18135c34f6", "d630c78290a52f8c73885afb16884e18135c34f6", "d630c78290a52f8c73885afb16884e18135c34f6", "d630c78290a52f8c73885afb16884e18135c34f6" ]
[ "autotabular/pipeline/components/feature_preprocessing/pca.py", "examples/automlbechmark/run_experiments/credit/credit_optuna/randomforest_sklearn.py", "autotabular/algorithms/deepctr/layers/layer.py", "tests/test_pipeline/components/data_preprocessing/test_exclude_missing.py" ]
[ "import numpy as np\nfrom autotabular.pipeline.components.base import AutotabularPreprocessingAlgorithm\nfrom autotabular.pipeline.constants import DENSE, UNSIGNED_DATA\nfrom autotabular.util.common import check_for_bool\nfrom ConfigSpace.configuration_space import ConfigurationSpace\nfrom ConfigSpace.hyperparamete...
[ [ "numpy.isfinite" ], [ "sklearn.ensemble.RandomForestClassifier", "sklearn.metrics.accuracy_score", "pandas.concat", "pandas.read_csv", "sklearn.metrics.roc_auc_score" ], [ "torch.zeros", "numpy.cumsum" ], [ "pandas.DataFrame" ] ]
FushimaTakesato/opendrive_viewer
[ "3d0b9d19ed7e02761b6ba8812fbd3df7bc318f51" ]
[ "opendrive_viewer.py" ]
[ "#!/usr/bin/env python\n# coding: utf-8\n\nimport xml.etree.ElementTree as ET\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport math\nimport sys\nimport os\n\nclass planView:\n def __init__(self):\n pass\n def setGeometry(self, s, x, y, hdg, length):\n self.s = s\n self.x = x\n...
[ [ "numpy.array", "numpy.dot", "numpy.sin", "matplotlib.pyplot.plot", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "numpy.cos", "numpy.deg2rad", "matplotlib.pyplot.scatter" ] ]
choyingw/CFCNet
[ "7ad0928e52767175669f3c4eb9e88fcbdd2d6b01" ]
[ "models/base_model.py" ]
[ "import os\nimport torch\nfrom collections import OrderedDict\nfrom torch.optim import lr_scheduler\n\nclass BaseModel():\n @staticmethod\n def modify_commandline_options(parser, is_train):\n return parser\n\n def name(self):\n return 'BaseModel'\n\n def initialize(self, opt):\n sel...
[ [ "torch.device", "torch.optim.lr_scheduler.StepLR", "torch.no_grad", "torch.cuda.is_available", "torch.optim.lr_scheduler.LambdaLR" ] ]