code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# -*- coding: utf-8 -*-
"""
Utility functions for PypeIt parameter sets
"""
import os
import time
import glob
import warnings
import textwrap
from IPython import embed
import numpy as np
from astropy.table import Table
from configobj import ConfigObj
from pypeit import msgs
#--------------------------------------... | [
"os.path.expanduser",
"pypeit.msgs.error",
"astropy.table.Table",
"numpy.arange",
"pypeit.msgs.info",
"os.path.join",
"pypeit.msgs.newline",
"numpy.argsort",
"os.path.isfile",
"numpy.array",
"pypeit.msgs.warn",
"time.localtime",
"glob.glob"
] | [((8023, 8037), 'glob.glob', 'glob.glob', (['out'], {}), '(out)\n', (8032, 8037), False, 'import glob\n'), ((12311, 12322), 'astropy.table.Table', 'Table', (['data'], {}), '(data)\n', (12316, 12322), False, 'from astropy.table import Table\n'), ((14062, 14101), 'pypeit.msgs.info', 'msgs.info', (['"""Loading the reducti... |
import numpy as np
from tqdm.autonotebook import tqdm
import gc
import warnings
import sklearn.utils
_remove_cache = {}
def remove_retrain(nmask, X_train, y_train, X_test, y_test, attr_test, model_generator, metric, trained_model, random_state):
""" The model is retrained for each test sample with the important f... | [
"numpy.tile",
"numpy.eye",
"numpy.all",
"numpy.reshape",
"numpy.random.rand",
"numpy.argsort",
"numpy.zeros",
"numpy.linalg.inv",
"numpy.random.seed",
"warnings.warn",
"numpy.cov",
"numpy.arange",
"numpy.random.shuffle"
] | [((1059, 1159), 'warnings.warn', 'warnings.warn', (['"""The retrain based measures can incorrectly evaluate models in some cases!"""'], {}), "(\n 'The retrain based measures can incorrectly evaluate models in some cases!'\n )\n", (1072, 1159), False, 'import warnings\n'), ((1813, 1836), 'numpy.zeros', 'np.zeros',... |
import warnings
import pickle as pkl
import sys, os
import scipy.sparse as sp
import networkx as nx
import torch
import numpy as np
from sklearn import datasets
from sklearn.preprocessing import LabelBinarizer, scale
from sklearn.model_selection import train_test_split
from ogb.nodeproppred import DglNodePropPredData... | [
"networkx.from_dict_of_lists",
"utils.sparse_mx_to_torch_sparse_tensor",
"torch.LongTensor",
"numpy.sort",
"torch.max",
"pickle.load",
"numpy.array",
"numpy.zeros",
"torch.tensor",
"torch.sum",
"numpy.vstack",
"warnings.simplefilter",
"scipy.sparse.vstack",
"torch.BoolTensor"
] | [((416, 447), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (437, 447), False, 'import warnings\n'), ((675, 686), 'numpy.zeros', 'np.zeros', (['l'], {}), '(l)\n', (683, 686), True, 'import numpy as np\n'), ((716, 745), 'numpy.array', 'np.array', (['mask'], {'dtype': 'np.bool'... |
import os
import numpy as np
import pydub as pd
from src.SBS.messenger import Messenger as messenger
from abc import ABC, abstractmethod
class ImageMessage(messenger, ABC):
""" Abstract methods """
def __init__(self, images_path=None):
super().__init__(images_path)
@abstractmethod
def __... | [
"numpy.array"
] | [((996, 1008), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1004, 1008), True, 'import numpy as np\n'), ((1025, 1037), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1033, 1037), True, 'import numpy as np\n')] |
import numpy as np
import tensorflow as tf
# Disable unnecessary tfp warning, refer to https://stackoverflow.com/questions/35911252/disable-tensorflow-debugging-information
tf.logging.set_verbosity(tf.logging.INFO)
## Issue: as tfp isn't include in tensorflow 1.10.0, just workaround it! Orlando
# import tensorflow_prob... | [
"numpy.mean",
"numpy.tile",
"ex_utils.build_mlp",
"tensorflow.placeholder",
"numpy.asarray",
"tensorflow.logging.set_verbosity",
"numpy.squeeze",
"numpy.exp",
"tensorflow.concat",
"tensorflow.constant",
"tensorflow.zeros_initializer",
"tensorflow.reduce_mean",
"tensorflow.train.AdamOptimizer... | [((173, 214), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (197, 214), True, 'import tensorflow as tf\n'), ((2120, 2138), 'numpy.asarray', 'np.asarray', (['counts'], {}), '(counts)\n', (2130, 2138), True, 'import numpy as np\n'), ((3379, 3395), 'numpy... |
# import the necessary packages
import numpy as np
import argparse
import cv2
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", help = "path to the image")
args = vars(ap.parse_args())
# load the image
image = cv2.imread(args["image"])
# define the... | [
"argparse.ArgumentParser",
"numpy.hstack",
"cv2.inRange",
"cv2.bitwise_and",
"numpy.array",
"cv2.waitKey",
"cv2.imread"
] | [((139, 164), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (162, 164), False, 'import argparse\n'), ((281, 306), 'cv2.imread', 'cv2.imread', (["args['image']"], {}), "(args['image'])\n", (291, 306), False, 'import cv2\n'), ((604, 634), 'numpy.array', 'np.array', (['lower'], {'dtype': '"""uint... |
"""
#Trains a ResNet on the CIFAR10 dataset.
"""
from __future__ import print_function
from tensorflow import keras
from keras.layers import Dense, Conv2D, BatchNormalization, Activation
from keras.layers import AveragePooling2D, Input, Flatten
from tensorflow.keras.optimizers import Adam
from keras.callbacks import ... | [
"numpy.sqrt",
"sys.exit",
"keras.layers.Dense",
"numpy.mean",
"argparse.ArgumentParser",
"os.path.isdir",
"tensorflow.keras.utils.to_categorical",
"keras.callbacks.LearningRateScheduler",
"keras.layers.Flatten",
"keras.datasets.cifar10.load_data",
"keras.models.Sequential",
"time.time",
"ten... | [((926, 937), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (935, 937), False, 'import os\n'), ((975, 1041), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Tensorflow Cifar10 Training"""'}), "(description='Tensorflow Cifar10 Training')\n", (998, 1041), False, 'import argparse\n'), ((2156, ... |
import pandas as pd
import numpy as np
data_schema = pd.read_csv('developer_survey_2020/survey_results_schema.csv', names=['key','text'], skiprows=[0])
df_schema = pd.DataFrame(data_schema, columns=['key','text'])
survey_columns = df_schema['key'].to_numpy()
data_survey = pd.read_csv('developer_survey_2020/survey_re... | [
"pandas.DataFrame",
"numpy.delete",
"pandas.read_csv"
] | [((54, 157), 'pandas.read_csv', 'pd.read_csv', (['"""developer_survey_2020/survey_results_schema.csv"""'], {'names': "['key', 'text']", 'skiprows': '[0]'}), "('developer_survey_2020/survey_results_schema.csv', names=['key',\n 'text'], skiprows=[0])\n", (65, 157), True, 'import pandas as pd\n'), ((165, 215), 'pandas.... |
import json
import logging
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pykeen.models import models
HERE = os.path.dirname(__file__)
RESULTS = os.path.join(HERE, 'results')
SUMMARY_DIRECTORY = os.path.join(HERE, 'summary')
os.makedirs(SUMMARY_DIRECTORY, exist_ok=True)
logger ... | [
"logging.getLogger",
"os.path.exists",
"numpy.mean",
"os.listdir",
"os.makedirs",
"os.path.join",
"matplotlib.pyplot.close",
"os.path.dirname",
"os.path.isdir",
"numpy.std",
"json.load",
"matplotlib.pyplot.subplots",
"json.dump"
] | [((150, 175), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (165, 175), False, 'import os\n'), ((186, 215), 'os.path.join', 'os.path.join', (['HERE', '"""results"""'], {}), "(HERE, 'results')\n", (198, 215), False, 'import os\n'), ((236, 265), 'os.path.join', 'os.path.join', (['HERE', '"""su... |
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"tensorflow_probability.python.math.psd_kernels.internal.util.pad_shape_with_ones",
"tensorflow_probability.bijectors.Affine",
"absl.testing.parameterized.parameters",
"tensorflow_probability.math.psd_kernels.FeatureTransformed",
"numpy.sum",
"tensorflow.compat.v2.test.main",
"tensorflow_probability.mat... | [((1717, 1951), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (["{'feature_ndims': 1, 'dims': 3}", "{'feature_ndims': 1, 'dims': 4}", "{'feature_ndims': 2, 'dims': 2}", "{'feature_ndims': 2, 'dims': 3}", "{'feature_ndims': 3, 'dims': 2}", "{'feature_ndims': 3, 'dims': 3}"], {}), "({'feature_ndims... |
import numpy as np
import pytest
from ansys.dpf import core as dpf
from ansys.dpf.core import examples
@pytest.fixture()
def local_server():
try :
for server in dpf._server_instances :
if server() != dpf.SERVER:
server().info #check that the server is responsive
... | [
"ansys.dpf.core.Model",
"numpy.allclose",
"ansys.dpf.core.examples.download_all_kinds_of_complexity",
"ansys.dpf.core.start_local_server",
"pytest.fixture",
"ansys.dpf.core.upload_file_in_tmp_folder",
"ansys.dpf.core.operators.logic.identical_fields"
] | [((106, 122), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (120, 122), False, 'import pytest\n'), ((474, 490), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (488, 490), False, 'import pytest\n'), ((701, 717), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (715, 717), False, 'import pytest\n'), (... |
"""
Created on Thu Jan 26 17:04:11 2017
@author: <NAME>, <EMAIL>
Fit unet style nodule identifier on Luna databaset using 8-grid scheme
Physical resolution 2x2x2mm
Data aggregated, shuffled; wrap augmentation used (swrap)
"""
import numpy as np
from keras.models import load_model,Model
from keras.layers import Ma... | [
"keras.backend.sum",
"keras.backend.flatten",
"numpy.moveaxis",
"keras.layers.UpSampling3D",
"image_as_mod3d_2dmask.ImageDataGenerator",
"numpy.arange",
"numpy.reshape",
"keras.models.Model",
"numpy.vstack",
"numpy.random.seed",
"numpy.concatenate",
"keras.optimizers.Adam",
"keras.layers.Con... | [((645, 675), 'keras.backend.set_image_dim_ordering', 'K.set_image_dim_ordering', (['"""th"""'], {}), "('th')\n", (669, 675), True, 'from keras import backend as K\n'), ((738, 755), 'keras.backend.flatten', 'K.flatten', (['y_true'], {}), '(y_true)\n', (747, 755), True, 'from keras import backend as K\n'), ((771, 788), ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ResNet-based Multi-Label Classification for Quantitative Precipitation Estimation.
- ref: https://www.kaggle.com/kumar1541/resnet-in-keras
- Read in QPESUMS data and precipitation data
- Initialize the CNN model
- Train and test
- Output the model
This version is based ... | [
"logging.debug",
"pandas.read_csv",
"tensorflow.keras.layers.BatchNormalization",
"sklearn.model_selection.StratifiedKFold",
"numpy.array",
"tensorflow.keras.layers.Dense",
"sklearn.model_selection.KFold",
"os.walk",
"tensorflow.keras.layers.Input",
"numpy.histogram",
"tensorflow.keras.layers.Co... | [((2055, 2068), 'os.walk', 'os.walk', (['srcx'], {}), '(srcx)\n', (2062, 2068), False, 'import os, csv, logging, argparse, glob, h5py, pickle\n'), ((2241, 2261), 'pandas.DataFrame', 'pd.DataFrame', (['xfiles'], {}), '(xfiles)\n', (2253, 2261), True, 'import pandas as pd\n'), ((2420, 2455), 'pandas.read_csv', 'pd.read_c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Trains and tests a loudness-threshold classifier for every given .pkl file.
For usage information, call without any parameters.
Author: <NAME>
"""
from __future__ import print_function
import sys
import os
from argparse import ArgumentParser
import numpy as np
imp... | [
"numpy.mean",
"scipy.ndimage.filters.median_filter",
"numpy.savez",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"numpy.log10",
"numpy.partition",
"matplotlib.pyplot.figure",
"numpy.concatenate",
"numpy.maximum",
"numpy.load",
"matplotlib.pyplot.axvline"
... | [((481, 514), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': 'descr'}), '(description=descr)\n', (495, 514), False, 'from argparse import ArgumentParser\n'), ((1626, 1645), 'numpy.load', 'np.load', (['targetfile'], {}), '(targetfile)\n', (1633, 1645), True, 'import numpy as np\n'), ((1735, 1775), 'nu... |
"""
Derived module from dmdbase.py for dmd with control.
Reference:
- <NAME>., <NAME>. and <NAME>., 2016. Dynamic mode decomposition
with control. SIAM Journal on Applied Dynamical Systems, 15(1), pp.142-161.
"""
from .dmdbase import DMDBase
from past.utils import old_div
import numpy as np
class DMDc(DMDBase):
... | [
"numpy.linalg.eig",
"numpy.linalg.pinv",
"numpy.reciprocal",
"numpy.log",
"numpy.diag",
"numpy.exp",
"numpy.array",
"numpy.isnan",
"numpy.vstack",
"numpy.zeros_like"
] | [((3279, 3314), 'numpy.exp', 'np.exp', (["(omega * self.dmd_time['dt'])"], {}), "(omega * self.dmd_time['dt'])\n", (3285, 3314), True, 'import numpy as np\n'), ((5011, 5042), 'numpy.vstack', 'np.vstack', (['[X, self._controlin]'], {}), '([X, self._controlin])\n', (5020, 5042), True, 'import numpy as np\n'), ((5671, 569... |
#!/usr/bin/env python
# Copyright 2014-2021 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | [
"pyscf.lib.takebak_2d",
"pyscf.fci.solver",
"numpy.sqrt",
"pyscf.lib.take_2d",
"numpy.einsum",
"pyscf.lib.with_doc",
"pyscf.lib.load_library",
"numpy.arange",
"numpy.where",
"numpy.dot",
"pyscf.fci.direct_spin1.make_rdm12s",
"numpy.eye",
"functools.reduce",
"pyscf.gto.Mole",
"pyscf.fci.a... | [((782, 808), 'pyscf.lib.load_library', 'lib.load_library', (['"""libfci"""'], {}), "('libfci')\n", (798, 808), False, 'from pyscf import lib\n'), ((4868, 4909), 'pyscf.lib.with_doc', 'lib.with_doc', (['spin_square_general.__doc__'], {}), '(spin_square_general.__doc__)\n', (4880, 4909), False, 'from pyscf import lib\n'... |
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# r... | [
"logging.getLogger",
"scipy.stats.entropy",
"scipy.stats.norm.ppf",
"scipy.stats.norm.fit",
"numpy.array",
"tqdm.auto.tqdm"
] | [((1583, 1610), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1600, 1610), False, 'import logging\n'), ((4142, 4169), 'numpy.array', 'np.array', (['final_predictions'], {}), '(final_predictions)\n', (4150, 4169), True, 'import numpy as np\n'), ((4993, 5012), 'scipy.stats.norm.fit', 'nor... |
#!/usr/bin/env python
#++++++++++++++++++++++++++++++++++++++++
# LAPART 1 Test +++++++++++++++++++++++++
# +++++++++++++++++++++++++++++++++++++++
# Copyright C. 2017, <NAME> ++++++
#++++++++++++++++++++++++++++++++++++++++
import time
import math
import numpy as np
import pandas as pd
from .art import ART
def norm... | [
"pandas.read_csv",
"numpy.hstack",
"numpy.append",
"numpy.array",
"numpy.transpose",
"time.time"
] | [((3946, 3957), 'time.time', 'time.time', ([], {}), '()\n', (3955, 3957), False, 'import time\n'), ((1754, 1770), 'numpy.transpose', 'np.transpose', (['TA'], {}), '(TA)\n', (1766, 1770), True, 'import numpy as np\n'), ((1783, 1799), 'numpy.transpose', 'np.transpose', (['TB'], {}), '(TB)\n', (1795, 1799), True, 'import ... |
"""
This module is a rework of
https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/preprocessing/_discretization.py
However, it is purely written in pandas instead of numpy because it is more
intuitive
Also, some custom modifications were included to allign it with our
Python Predictions methodology
Auth... | [
"logging.getLogger",
"pandas.cut",
"pandas.IntervalIndex.from_tuples",
"numpy.linspace",
"copy.deepcopy"
] | [((489, 516), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (506, 516), False, 'import logging\n'), ((10846, 10892), 'pandas.cut', 'pd.cut', ([], {'x': 'data[column_name]', 'bins': 'interval_idx'}), '(x=data[column_name], bins=interval_idx)\n', (10852, 10892), True, 'import pandas as pd\... |
import collections
import copy
import tensorflow as tf
import numpy as np
import os
import multiprocessing
import functools
from abc import ABC, abstractmethod
from rl.tools.utils.misc_utils import unflatten, flatten, cprint
tf_float = tf.float32
tf_int = tf.int32
"""
For compatibility with stop_gradient
"""
def t... | [
"numpy.prod",
"tensorflow.reduce_sum",
"tensorflow.get_default_session",
"multiprocessing.cpu_count",
"tensorflow.gradients",
"tensorflow.group",
"tensorflow.get_variable_scope",
"copy.deepcopy",
"copy.copy",
"tensorflow.cast",
"tensorflow.Session",
"tensorflow.placeholder",
"functools.wraps... | [((464, 494), 'tensorflow.gradients', 'tf.gradients', (['tensor', 'var_list'], {}), '(tensor, var_list)\n', (476, 494), True, 'import tensorflow as tf\n'), ((11442, 11536), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'inter_op_parallelism_threads': 'num_cpu', 'intra_op_parallelism_threads': 'num_cpu'}), '(inter_o... |
import json
# from collections import OrderedDict
from bokeh.io import show, save, output_file
from bokeh.plotting import figure
from bokeh.models import HoverTool
from bokeh.palettes import Set1_6
import numpy as np
from PIL import Image
import os
Image.MAX_IMAGE_PIXELS = None
if __name__ == '__main__':
tools_li... | [
"bokeh.io.output_file",
"bokeh.io.show",
"os.listdir",
"bokeh.io.save",
"PIL.Image.open",
"numpy.asarray",
"os.path.join",
"os.path.isfile",
"numpy.empty",
"json.load",
"bokeh.models.HoverTool"
] | [((617, 635), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (627, 635), False, 'import os\n'), ((1621, 1660), 'bokeh.io.output_file', 'output_file', (['f"""result/{html_name}.html"""'], {}), "(f'result/{html_name}.html')\n", (1632, 1660), False, 'from bokeh.io import show, save, output_file\n'), ((2958, 2... |
import pickle
from collections import defaultdict, namedtuple
import numpy as np
import argparse
import os
import model.config as config
import preprocessing.util as util
from termcolor import colored
import tensorflow as tf
class VocabularyCounter(object):
"""counts the frequency of each word and each character... | [
"preprocessing.util.load_wiki_name_id_map",
"tensorflow.train.Int64List",
"tensorflow.train.SequenceExample",
"numpy.save",
"os.path.exists",
"argparse.ArgumentParser",
"os.path.normpath",
"numpy.empty",
"tensorflow.train.FloatList",
"tensorflow.python_io.TFRecordWriter",
"tensorflow.train.Featu... | [((10066, 10204), 'collections.namedtuple', 'namedtuple', (['"""GmonlySample"""', "['chunk_id', 'chunk_words', 'begin_gm', 'end_gm', 'ground_truth',\n 'cand_entities', 'cand_entities_scores']"], {}), "('GmonlySample', ['chunk_id', 'chunk_words', 'begin_gm', 'end_gm',\n 'ground_truth', 'cand_entities', 'cand_entit... |
import numpy as np
import skimage.morphology as io
from skimage.morphology import disk
import matplotlib.pyplot as plt
import matplotlib.tri as tri
from matplotlib.path import Path
import scipy.ndimage as ndi
import math
import pymorph as pm
from PIL import Image
from PIL import ImageFilter
import os
class ImgMesh():
... | [
"matplotlib.tri.Triangulation",
"math.sqrt",
"numpy.array",
"pymorph.dilate",
"matplotlib.path.Path",
"numpy.delete",
"matplotlib.pyplot.plot",
"numpy.max",
"numpy.empty",
"numpy.concatenate",
"numpy.min",
"numpy.meshgrid",
"numpy.size",
"pymorph.sedisk",
"numpy.shape",
"skimage.morpho... | [((398, 470), 'os.chdir', 'os.chdir', (['"""/home/hatef/Desktop/PhD/Phase_01_imageProcessing/ImagePython"""'], {}), "('/home/hatef/Desktop/PhD/Phase_01_imageProcessing/ImagePython')\n", (406, 470), False, 'import os\n'), ((478, 494), 'PIL.Image.open', 'Image.open', (['name'], {}), '(name)\n', (488, 494), False, 'from P... |
#%%
import cv2;
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
# not used in this stub but often useful for finding various files
#project_dir = Path(__file__).resolve().parents[2]
# find .env automagically by walking up directories until it's found, then
# load up the .env entries as environ... | [
"pandas.read_csv",
"scipy.ndimage.measurements.label",
"cv2.imshow",
"numpy.array",
"matplotlib.colors.keys",
"matplotlib.pyplot.imshow",
"cv2.calcHist",
"os.listdir",
"seaborn.distplot",
"cv2.threshold",
"numpy.where",
"matplotlib.pyplot.plot",
"scipy.ndimage.label",
"matplotlib.pyplot.st... | [((629, 747), 'cv2.imread', 'cv2.imread', (['"""C:\\\\Users\\\\Helldragger\\\\Documents\\\\projects\\\\MetaWatch\\\\MetaWatch\\\\src\\\\features\\\\original.jpg"""'], {}), "(\n 'C:\\\\Users\\\\Helldragger\\\\Documents\\\\projects\\\\MetaWatch\\\\MetaWatch\\\\src\\\\features\\\\original.jpg'\n )\n", (639, 747), Fa... |
import numpy as np
from scipy.ndimage import affine_transform
def apply_offset(matrix, x, y, z):
""" Needed in order to rotate along center of the voxelgrid.
Parameters
----------
matrix : (4,4) ndarray
x, y, z : uint
Dimensions of the voxelgrid.
"""
o_x = float(x) / 2 + 0.5
o... | [
"scipy.ndimage.affine_transform",
"numpy.rollaxis",
"numpy.asarray",
"numpy.max",
"numpy.array",
"numpy.dot",
"numpy.stack",
"numpy.deg2rad",
"numpy.cos",
"numpy.random.uniform",
"numpy.min",
"numpy.sin"
] | [((394, 466), 'numpy.array', 'np.array', (['[[1, 0, 0, o_x], [0, 1, 0, o_y], [0, 0, 1, o_z], [0, 0, 0, 1]]'], {}), '([[1, 0, 0, o_x], [0, 1, 0, o_y], [0, 0, 1, o_z], [0, 0, 0, 1]])\n', (402, 466), True, 'import numpy as np\n'), ((577, 652), 'numpy.array', 'np.array', (['[[1, 0, 0, -o_x], [0, 1, 0, -o_y], [0, 0, 1, -o_z... |
# Copyright 2019 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | [
"tensorflow.eye",
"tensorflow.Variable",
"tensorflow.sin",
"numpy.kron",
"tensorflow.GradientTape",
"tensorflow.exp",
"tensorflow.constant",
"tensorflow.nest.flatten",
"copy.copy",
"tensorflow.cast",
"tensorflow.zeros",
"tensorflow.cos",
"tensorflow.stack"
] | [((1228, 1257), 'tensorflow.constant', 'tf.constant', (['I'], {'dtype': 'C_DTYPE'}), '(I, dtype=C_DTYPE)\n', (1239, 1257), True, 'import tensorflow as tf\n'), ((1262, 1291), 'tensorflow.constant', 'tf.constant', (['X'], {'dtype': 'C_DTYPE'}), '(X, dtype=C_DTYPE)\n', (1273, 1291), True, 'import tensorflow as tf\n'), ((1... |
from fractions import Fraction
import operator
import pandas as pd
import numpy as np
from abc import ABCMeta, abstractmethod
from probability.concept.random_variable import RandomVariable, SetOfRandomVariable
from typing import Callable
def joint_distribution(data):
from probability.new.joint_distribution impo... | [
"numpy.isclose",
"fractions.Fraction",
"probability.concept.random_variable.RandomVariable",
"probability.new.joint_distribution.JointDistribution.from_dataframe",
"probability.new.joint_distribution.JointDistribution.from_series"
] | [((396, 434), 'probability.new.joint_distribution.JointDistribution.from_dataframe', 'JointDistribution.from_dataframe', (['data'], {}), '(data)\n', (428, 434), False, 'from probability.new.joint_distribution import JointDistribution\n'), ((460, 495), 'probability.new.joint_distribution.JointDistribution.from_series', ... |
# Trained net for region specific Classification
# 1. If not already set, download and set coco API and data set (See instruction)
# 1. Set Train image folder path in: TrainImageDir
# 2. Set the path to the coco Train annotation json file in: TrainAnnotationFile
# 3. Run the script
# 4. The trained net weight will app... | [
"os.path.exists",
"torch.log",
"os.makedirs",
"Resnet50AttentionFullAttentionAndBiasAllLayers.zero_grad",
"torch.load",
"Resnet50AttentionFullAttentionAndBiasAllLayers.cuda",
"torch.from_numpy",
"numpy.array",
"Resnet50AttentionFullAttentionAndBiasAllLayers.AddAttententionLayer",
"Resnet50Attentio... | [((2512, 2740), 'OpenSurfaceReader.Reader', 'Reader.Reader', ([], {'ImageDir': 'TrainImageDir', 'AnnotationDir': 'AnnotationDir', 'MaxBatchSize': 'MaxBatchSize', 'MinSize': 'MinSize', 'MaxSize': 'MaxSize', 'MaxPixels': 'MaxPixels', 'AnnotationFileType': '"""png"""', 'ImageFileType': '"""jpg"""', 'BackgroundClass': '(0)... |
import itertools
import numpy as np
def get_ways_to_split_nitems_to_kbins(
nitems, kbins, item_separator="┃", item_symbol="🧍"
):
items = [item_symbol] * nitems
# E.g., 3 bins = 2item separators
separators = [item_separator] * (kbins - 1)
symbols = items + separators
ways = set(itertools.pe... | [
"itertools.permutations",
"numpy.max"
] | [((307, 338), 'itertools.permutations', 'itertools.permutations', (['symbols'], {}), '(symbols)\n', (329, 338), False, 'import itertools\n'), ((1259, 1276), 'numpy.max', 'np.max', (['customers'], {}), '(customers)\n', (1265, 1276), True, 'import numpy as np\n'), ((1377, 1442), 'itertools.permutations', 'itertools.permu... |
from argparse import ArgumentParser
import json
import os
import cv2
import numpy as np
from modules.input_reader import VideoReader, ImageReader
from modules.draw import Plotter3d, draw_poses
from modules.parse_poses import parse_poses
def rotate_poses(poses_3d, R, t):
R_inv = np.linalg.inv(R)
for pose_id in... | [
"modules.parse_poses.parse_poses",
"cv2.imshow",
"numpy.array",
"numpy.arange",
"cv2.setMouseCallback",
"argparse.ArgumentParser",
"modules.input_reader.VideoReader",
"modules.draw.Plotter3d",
"modules.inference_engine_openvino.InferenceEngineOpenVINO",
"numpy.dot",
"cv2.waitKey",
"cv2.getTick... | [((285, 301), 'numpy.linalg.inv', 'np.linalg.inv', (['R'], {}), '(R)\n', (298, 301), True, 'import numpy as np\n'), ((745, 892), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Lightweight 3D human pose estimation demo. Press esc to exit, "p" to (un)pause video or process next image."""'}), '(desc... |
"""
Module for calculating window related data. Windows can be indexed relative to
two starting indices.
- Local window index
- Window index relative to the TimeData is called "local_win"
- Local window indices always start at 0
- Global window index
- The global window index is relative to the project ... | [
"resistics.sampling.to_n_samples",
"math.floor",
"resistics.common.History",
"numpy.lib.stride_tricks.sliding_window_view",
"numpy.arange",
"resistics.errors.WriteError",
"pandas.DataFrame",
"resistics.errors.ChannelNotFoundError",
"numpy.floor",
"resistics.errors.ProcessRunError",
"resistics.sa... | [((10612, 10633), 'resistics.sampling.to_seconds', 'to_seconds', (['increment'], {}), '(increment)\n', (10622, 10633), False, 'from resistics.sampling import to_seconds\n'), ((10774, 10801), 'resistics.sampling.to_seconds', 'to_seconds', (['(time - ref_time)'], {}), '(time - ref_time)\n', (10784, 10801), False, 'from r... |
import rps.robotarium as robotarium
from rps.utilities import *
from rps.utilities.barrier_certificates import *
from rps.utilities.controllers import *
from rps.utilities.transformations import *
from reachGoal import reachGoal
from matplotlib import patches
import numpy as np
import time
N = 1
initial_conditions = n... | [
"reachGoal.reachGoal",
"rps.robotarium.Robotarium",
"numpy.array",
"matplotlib.patches.Ellipse",
"matplotlib.patches.Circle",
"numpy.arange"
] | [((363, 489), 'rps.robotarium.Robotarium', 'robotarium.Robotarium', ([], {'number_of_robots': 'N', 'show_figure': '(True)', 'initial_conditions': 'initial_conditions', 'sim_in_real_time': '(False)'}), '(number_of_robots=N, show_figure=True,\n initial_conditions=initial_conditions, sim_in_real_time=False)\n', (384, 4... |
from time import time
from numpy import arange, mean
def set_time(times, sample_rate, samples):
"""
times = time stamps by fifo in each payload
sample_rate = sample rate
samples = number of data samples
"""
fifos = len(times)
differences = []
if fifos > 1:
for index, time in... | [
"numpy.mean",
"time.time",
"numpy.arange"
] | [((682, 688), 'time.time', 'time', ([], {}), '()\n', (686, 688), False, 'from time import time\n'), ((417, 434), 'numpy.mean', 'mean', (['differences'], {}), '(differences)\n', (421, 434), False, 'from numpy import arange, mean\n'), ((558, 626), 'numpy.arange', 'arange', (['(times[0] - samples / fifos * delta)', '(time... |
import numpy as np
from ..util.log import *
# Returns the (epsilon, delta) values of the adaptive concentration inequality
# for the given parameters.
#
# n: int (number of samples)
# delta: float (parameter delta)
# return: epsilon (parameter epsilon)
def get_type(n, delta):
n = np.float(n)
b = -np.log(delta ... | [
"numpy.abs",
"numpy.log",
"numpy.float"
] | [((286, 297), 'numpy.float', 'np.float', (['n'], {}), '(n)\n', (294, 297), True, 'import numpy as np\n'), ((1281, 1292), 'numpy.abs', 'np.abs', (['E_B'], {}), '(E_B)\n', (1287, 1292), True, 'import numpy as np\n'), ((307, 327), 'numpy.log', 'np.log', (['(delta / 24.0)'], {}), '(delta / 24.0)\n', (313, 327), True, 'impo... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
import numpy as np
import tensorflow as tf
from niftynet.io.image_reader import ImageReader
from niftynet.io.image_sets_partitioner import ImageSetsPartitioner
from niftynet.layer.discrete_label_normalisation import \
Discre... | [
"os.path.exists",
"tests.reader_modular_test.generate_2d_images",
"numpy.unique",
"niftynet.io.image_sets_partitioner.ImageSetsPartitioner",
"os.path.join",
"tensorflow.test.main",
"numpy.array",
"niftynet.layer.pad.PadLayer",
"niftynet.io.image_reader.ImageReader",
"numpy.all",
"niftynet.utilit... | [((571, 591), 'tests.reader_modular_test.generate_2d_images', 'generate_2d_images', ([], {}), '()\n', (589, 591), False, 'from tests.reader_modular_test import generate_2d_images, SEG_THRESHOLD\n'), ((1288, 1326), 'niftynet.utilities.util_common.ParserNamespace', 'ParserNamespace', ([], {'image': "('T1', 'FLAIR')"}), "... |
from __future__ import division
import os
import numpy as np
import pprint
import tensorflow as tf
import tensorflow.contrib.slim as slim
import pickle, csv
from utils import *
from model import UNet3D, SurvivalVAE
flags = tf.app.flags
flags.DEFINE_integer("epoch", 4, "Epoch to train [4]")
flags.DEFINE_string("train_... | [
"os.walk",
"tensorflow.app.run",
"model.SurvivalVAE",
"os.path.exists",
"os.listdir",
"tensorflow.Session",
"pprint.PrettyPrinter",
"tensorflow.ConfigProto",
"tensorflow.trainable_variables",
"csv.reader",
"pickle.load",
"model.UNet3D",
"tensorflow.reset_default_graph",
"pickle.dump",
"o... | [((2123, 2145), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {}), '()\n', (2143, 2145), False, 'import pprint\n'), ((2259, 2288), 'os.walk', 'os.walk', (['FLAGS.train_data_dir'], {}), '(FLAGS.train_data_dir)\n', (2266, 2288), False, 'import os\n'), ((7677, 7689), 'tensorflow.app.run', 'tf.app.run', ([], {}), '(... |
import matplotlib.pyplot as plt
import numpy
import seaborn
import tensorflow as tf
import muzero.models as models
from muzero.self_play import MCTS, Node, SelfPlay
class DiagnoseModel:
"""
Tools to understand the learned model.
Args:
weights: weights for the model to diagnose.
config: ... | [
"muzero.self_play.SelfPlay.select_action",
"muzero.self_play.MCTS",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"numpy.isnan",
"muzero.models.support_to_scalar",
"graphviz.Digraph",
"tensorflow.identity",
"muzero.models.MuZeroNetwork",
"numpy.transpose",
"muzero.self_play.Node",
"ma... | [((510, 543), 'muzero.models.MuZeroNetwork', 'models.MuZeroNetwork', (['self.config'], {}), '(self.config)\n', (530, 543), True, 'import muzero.models as models\n'), ((5128, 5144), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (5137, 5144), True, 'import matplotlib.pyplot as plt\n'), ((5477,... |
#
# Call Option Pricing with Circular Convolution (General)
# 06_fou/call_convolution_general.py
#
# (c) Dr. <NAME>
# Derivatives Analytics with Python
#
import numpy as np
from convolution import revnp, convolution
from parameters import *
# Parmeter Adjustments
M = 3 # number of time steps
dt, df, u, d, q = get_bin... | [
"convolution.revnp",
"numpy.resize",
"numpy.zeros",
"numpy.maximum",
"numpy.transpose",
"numpy.arange"
] | [((382, 398), 'numpy.arange', 'np.arange', (['(M + 1)'], {}), '(M + 1)\n', (391, 398), True, 'import numpy as np\n'), ((404, 433), 'numpy.resize', 'np.resize', (['mu', '(M + 1, M + 1)'], {}), '(mu, (M + 1, M + 1))\n', (413, 433), True, 'import numpy as np\n'), ((439, 455), 'numpy.transpose', 'np.transpose', (['mu'], {}... |
import os
from gym import spaces
import numpy as np
import pybullet as p
from .env import AssistiveEnv
class BedBathingEnv(AssistiveEnv):
def __init__(self, robot_type='pr2', human_control=False):
super(BedBathingEnv, self).__init__(robot_type=robot_type, task='bed_bathing', human_control=human_control, f... | [
"pybullet.setGravity",
"numpy.array",
"pybullet.resetBaseVelocity",
"numpy.linalg.norm",
"pybullet.createCollisionShape",
"pybullet.getNumJoints",
"pybullet.getQuaternionFromEuler",
"pybullet.createVisualShape",
"numpy.concatenate",
"pybullet.resetBasePositionAndOrientation",
"pybullet.getJointS... | [((2479, 2539), 'pybullet.getContactPoints', 'p.getContactPoints', ([], {'bodyA': 'self.tool', 'physicsClientId': 'self.id'}), '(bodyA=self.tool, physicsClientId=self.id)\n', (2497, 2539), True, 'import pybullet as p\n'), ((2621, 2682), 'pybullet.getContactPoints', 'p.getContactPoints', ([], {'bodyA': 'self.robot', 'ph... |
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "2,3"
import torch
from torch.utils import data
from torch.autograd import Variable
import torch.optim as optim
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
from albumentations import (
HorizontalFl... | [
"albumentations.RandomBrightnessContrast",
"albumentations.RandomGamma",
"albumentations.HueSaturationValue",
"torch.nn.functional.softmax",
"os.path.exists",
"arguments.get_arguments",
"numpy.mean",
"models.unet.UNet",
"albumentations.GaussNoise",
"pytorch_utils.calc_mse_loss",
"torch.autograd.... | [((1817, 1832), 'arguments.get_arguments', 'get_arguments', ([], {}), '()\n', (1830, 1832), False, 'from arguments import get_arguments\n'), ((1897, 1956), 'tensorboard_logger.Logger', 'tb_logger.Logger', ([], {'logdir': 'args.tensorboard_dir', 'flush_secs': '(2)'}), '(logdir=args.tensorboard_dir, flush_secs=2)\n', (19... |
from env_common import get_screen
from common import select_action_policy
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import RMSprop
from itertools import count
import numpy as np
import gym
import visdom
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# ... | [
"numpy.mean",
"torch.nn.BatchNorm2d",
"torch.ones",
"torch.distributions.Categorical",
"torch.FloatTensor",
"torch.exp",
"env_common.get_screen",
"torch.nn.Conv2d",
"torch.min",
"torch.cuda.is_available",
"itertools.count",
"common.select_action_policy",
"torch.nn.Linear",
"numpy.std",
"... | [((631, 646), 'visdom.Visdom', 'visdom.Visdom', ([], {}), '()\n', (644, 646), False, 'import visdom\n'), ((1000, 1023), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (1008, 1023), False, 'import gym\n'), ((1051, 1066), 'env_common.get_screen', 'get_screen', (['env'], {}), '(env)\n', (1061, 1... |
"""
Brief
=====
This module is not part of the public API. It contains encoding and decoding
functionality which is exclusively used by `io.write` and `io.read`. It enables
storing and transmitting Pyfar- and Numpy-objects without using the unsafe
pickle protocoll.
Design and Function
===================
The `_encod... | [
"json.loads",
"json.dumps",
"io.BytesIO",
"numpy.load",
"numpy.save"
] | [((5696, 5708), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (5706, 5708), False, 'import io\n'), ((5801, 5837), 'numpy.load', 'np.load', (['memfile'], {'allow_pickle': '(False)'}), '(memfile, allow_pickle=False)\n', (5808, 5837), True, 'import numpy as np\n'), ((6311, 6331), 'json.loads', 'json.loads', (['json_str'],... |
import numpy as np
from AnalyticGeometryFunctions import computeVectorNorm, computeAngleBetweenVectors
import pygame as pg
import os
# init variables
actionSpace = [[0, 1], [1, 0], [-1, 0], [0, -1], [1, 1], [-1, -1], [1, -1], [-1, 1]]
xBoundary = [0, 180]
yBoundary = [0, 180]
vel = 1
class OptimalPolicy:
def __i... | [
"os.listdir",
"pygame.quit",
"pygame.event.get",
"pygame.time.wait",
"pygame.display.flip",
"numpy.array",
"numpy.concatenate",
"numpy.random.uniform",
"AnalyticGeometryFunctions.computeAngleBetweenVectors",
"AnalyticGeometryFunctions.computeVectorNorm",
"numpy.int"
] | [((1762, 1806), 'numpy.concatenate', 'np.concatenate', (['[agentState, targetPosition]'], {}), '([agentState, targetPosition])\n', (1776, 1806), True, 'import numpy as np\n'), ((2109, 2142), 'AnalyticGeometryFunctions.computeVectorNorm', 'computeVectorNorm', (['relativeVector'], {}), '(relativeVector)\n', (2126, 2142),... |
import pdb
import copy
import numpy as np
from importlib_resources import files
import matplotlib.pyplot as plt
from matplotlib import font_manager
from matplotlib.figure import Figure
from .utilities import *
from .process_model import *
# Define font settings
fontsize = 12
font_files = font_manager.findSystemFont... | [
"matplotlib.figure.Figure",
"numpy.sort",
"numpy.asarray",
"numpy.any",
"numpy.max",
"numpy.sum",
"matplotlib.pyplot.figure",
"numpy.linspace",
"numpy.zeros",
"importlib_resources.files",
"copy.deepcopy",
"numpy.cumsum",
"numpy.maximum",
"matplotlib.font_manager.fontManager.addfont"
] | [((408, 451), 'matplotlib.font_manager.fontManager.addfont', 'font_manager.fontManager.addfont', (['font_file'], {}), '(font_file)\n', (440, 451), False, 'from matplotlib import font_manager\n'), ((784, 801), 'copy.deepcopy', 'copy.deepcopy', (['IN'], {}), '(IN)\n', (797, 801), False, 'import copy\n'), ((998, 1033), 'n... |
import numpy as np
from PIL import Image
from classification import Classification, _preprocess_input
from utils.utils import letterbox_image
class top1_Classification(Classification):
def detect_image(self, image):
crop_img = letterbox_image(image, [self.input_shape[0],self.input_shape[1]])
phot... | [
"utils.utils.letterbox_image",
"PIL.Image.open",
"numpy.argmax",
"numpy.array",
"classification._preprocess_input"
] | [((242, 308), 'utils.utils.letterbox_image', 'letterbox_image', (['image', '[self.input_shape[0], self.input_shape[1]]'], {}), '(image, [self.input_shape[0], self.input_shape[1]])\n', (257, 308), False, 'from utils.utils import letterbox_image\n'), ((324, 360), 'numpy.array', 'np.array', (['crop_img'], {'dtype': 'np.fl... |
from os.path import dirname, join, realpath
import pytest
from numpy import array, dtype, nan
from numpy.testing import assert_array_equal, assert_equal
from pandas_plink import example_file_prefix, read_plink, read_plink1_bin
def test_read_plink():
datafiles = join(dirname(realpath(__file__)), "data_files")
... | [
"os.path.join",
"pytest.warns",
"os.path.realpath",
"pandas_plink.read_plink",
"numpy.array",
"pandas_plink.read_plink1_bin",
"pytest.raises",
"numpy.dtype",
"numpy.testing.assert_array_equal",
"pandas_plink.example_file_prefix"
] | [((337, 360), 'os.path.join', 'join', (['datafiles', '"""data"""'], {}), "(datafiles, 'data')\n", (341, 360), False, 'from os.path import dirname, join, realpath\n'), ((384, 422), 'pandas_plink.read_plink', 'read_plink', (['file_prefix'], {'verbose': '(False)'}), '(file_prefix, verbose=False)\n', (394, 422), False, 'fr... |
#
# Copyright 2019 <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provi... | [
"numpy.eye",
"sys.path.insert",
"numpy.ones",
"argparse.ArgumentParser",
"export_pendulum_ode_model.export_pendulum_ode_model",
"numpy.diag",
"numpy.array",
"numpy.zeros",
"numpy.ndarray",
"numpy.linalg.norm",
"numpy.arange"
] | [((1506, 1553), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../getting_started/common"""'], {}), "(0, '../getting_started/common')\n", (1521, 1553), False, 'import sys\n'), ((6810, 6837), 'export_pendulum_ode_model.export_pendulum_ode_model', 'export_pendulum_ode_model', ([], {}), '()\n', (6835, 6837), False, 'f... |
import matplotlib.pyplot as plt
import numpy as np
def _enforce_ratio(goal_ratio, supx, infx, supy, infy):
"""
Computes the right value of `supx,infx,supy,infy` to obtain the desired
ratio in :func:`plot_eigs`. Ratio is defined as
::
dx = supx - infx
dy = supy - infy
max(dx,dy) ... | [
"numpy.abs",
"matplotlib.pyplot.Circle",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"numpy.max",
"matplotlib.pyplot.figure",
"numpy.min",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((3235, 3251), 'matplotlib.pyplot.title', 'plt.title', (['title'], {}), '(title)\n', (3244, 3251), True, 'import matplotlib.pyplot as plt\n'), ((3260, 3269), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (3267, 3269), True, 'import matplotlib.pyplot as plt\n'), ((3283, 3292), 'matplotlib.pyplot.gca', 'plt.gca'... |
import numpy as np
import unittest
import os
from openmdao.api import Problem, Group
from openmdao.utils.assert_utils import assert_near_equal, assert_check_partials
from pycycle.elements.shaft import Shaft
fpath = os.path.dirname(os.path.realpath(__file__))
ref_data = np.loadtxt(fpath + "/reg_data/shaft.csv",
... | [
"pycycle.elements.shaft.Shaft",
"openmdao.utils.assert_utils.assert_check_partials",
"openmdao.api.Group",
"os.path.realpath",
"openmdao.utils.assert_utils.assert_near_equal",
"unittest.main",
"numpy.loadtxt",
"openmdao.api.Problem"
] | [((273, 341), 'numpy.loadtxt', 'np.loadtxt', (["(fpath + '/reg_data/shaft.csv')"], {'delimiter': '""","""', 'skiprows': '(1)'}), "(fpath + '/reg_data/shaft.csv', delimiter=',', skiprows=1)\n", (283, 341), True, 'import numpy as np\n'), ((234, 260), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)... |
""" Demo script modified
Generates forward and backward flow for cityscapes sequence.
T0 = 19
T1 = 19+[1..10]
Uses two GPUs, one for fwd and the other for bwd
"""
import sys
sys.path.append('core')
import argparse
import os
import cv2
import glob
import numpy as np
import torch
from PIL import Image
fr... | [
"cv2.imwrite",
"os.path.exists",
"PIL.Image.open",
"argparse.ArgumentParser",
"torch.load",
"tqdm.tqdm",
"os.path.join",
"utils.utils.InputPadder",
"torch.from_numpy",
"raft.RAFT",
"os.path.dirname",
"utils.flow_viz.flow_to_image",
"numpy.zeros",
"numpy.concatenate",
"torch.no_grad",
"... | [((190, 213), 'sys.path.append', 'sys.path.append', (['"""core"""'], {}), "('core')\n", (205, 213), False, 'import sys\n'), ((960, 991), 'utils.flow_viz.flow_to_image', 'flow_viz.flow_to_image', (['flo_fwd'], {}), '(flo_fwd)\n', (982, 991), False, 'from utils import flow_viz\n'), ((1006, 1037), 'utils.flow_viz.flow_to_... |
"""
Module containing logic related to eager DataFrames
"""
import os
import sys
import warnings
from io import BytesIO, IOBase, StringIO
from pathlib import Path
from typing import (
Any,
BinaryIO,
Callable,
Dict,
Generic,
Iterable,
Iterator,
List,
Mapping,
Optional,
Sequenc... | [
"polars.utils._process_null_values",
"polars.utils.format_path",
"polars.internals.construction.arrow_to_pydf",
"io.BytesIO",
"polars.polars.PyDataFrame.read_json",
"polars.internals.wrap_s",
"polars.internals.construction.pandas_to_pydf",
"numpy.array",
"polars.internals.lit",
"polars.internals.c... | [((1764, 1796), 'typing.TypeVar', 'TypeVar', (['"""DF"""'], {'bound': '"""DataFrame"""'}), "('DF', bound='DataFrame')\n", (1771, 1796), False, 'from typing import Any, BinaryIO, Callable, Dict, Generic, Iterable, Iterator, List, Mapping, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union, overload\n'), ((2220, 224... |
# coding:utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.INFO)
# Our application logic will be here
def cnn_model_fn(features, labels, mode):
"""Model function for CN... | [
"tensorflow.contrib.learn.datasets.load_dataset",
"tensorflow.logging.set_verbosity",
"tensorflow.estimator.EstimatorSpec",
"tensorflow.estimator.inputs.numpy_input_fn",
"tensorflow.nn.softmax",
"tensorflow.cast",
"tensorflow.app.run",
"tensorflow.estimator.Estimator",
"numpy.asarray",
"tensorflow... | [((170, 211), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (194, 211), True, 'import tensorflow as tf\n'), ((482, 524), 'tensorflow.reshape', 'tf.reshape', (["features['x']", '[-1, 28, 28, 1]'], {}), "(features['x'], [-1, 28, 28, 1])\n", (492, 524), T... |
from typing import Tuple, Callable, Optional
from time import time
from numbers import Number
import numpy as np
from torch import optim, Tensor
import mrphy
from mrphy.mobjs import SpinCube, Pulse
def arctanLBFGS(
target: dict, cube: SpinCube, pulse: Pulse,
fn_err: Callable[[Tensor, Tensor, Optional[Tensor]... | [
"mrphy.utils.g2s",
"mrphy.utils.tρθ2rf",
"mrphy.utils.ts2s",
"torch.optim.LBFGS",
"mrphy.utils.rf2tρθ",
"numpy.full",
"time.time"
] | [((2060, 2095), 'mrphy.utils.rf2tρθ', 'mrphy.utils.rf2tρθ', (['pulse.rf', 'rfmax'], {}), '(pulse.rf, rfmax)\n', (2078, 2095), False, 'import mrphy\n'), ((2322, 2441), 'torch.optim.LBFGS', 'optim.LBFGS', (['[tρ, θ]'], {'lr': '(3.0)', 'max_iter': '(10)', 'history_size': '(30)', 'tolerance_change': '(0.0001)', 'line_searc... |
import itertools
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data
from torch_model_base import TorchModelBase
from sklearn.model_selection import train_test_split
import utils
from utils import START_SYMBOL, END_SYMBOL, UNK_SYMBOL
import time
__author__ = "<NAME>"
__version__ = "CS224u, St... | [
"numpy.prod",
"torch.nn.Dropout",
"torch.nn.CrossEntropyLoss",
"torch.LongTensor",
"utils.randvec",
"torch.nn.utils.rnn.pad_sequence",
"numpy.array",
"torch.cuda.is_available",
"torch.nn.LSTM",
"itertools.product",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.autograd.gradcheck",
"torch.... | [((40612, 40651), 'sklearn.model_selection.train_test_split', 'train_test_split', (['color_seqs', 'word_seqs'], {}), '(color_seqs, word_seqs)\n', (40628, 40651), False, 'from sklearn.model_selection import train_test_split\n'), ((41649, 41688), 'sklearn.model_selection.train_test_split', 'train_test_split', (['color_se... |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
"tensorflow_datasets.testing.FeatureExpectationItem",
"textwrap.dedent",
"tensorflow_datasets.core.features.Sequence",
"tensorflow.compat.v2.compat.as_bytes",
"tensorflow_datasets.testing.test_main",
"numpy.random.rand",
"tensorflow_datasets.core.features.TensorInfo",
"tensorflow_datasets.core.feature... | [((886, 909), 'tensorflow.compat.v2.enable_v2_behavior', 'tf.enable_v2_behavior', ([], {}), '()\n', (907, 909), True, 'import tensorflow.compat.v2 as tf\n'), ((13807, 13852), 'tensorflow_datasets.core.features.Tensor', 'features_lib.Tensor', ([], {'shape': '()', 'dtype': 'tf.int32'}), '(shape=(), dtype=tf.int32)\n', (1... |
import numpy as np
import torch
import torch.nn as nn
from collections import OrderedDict
def summary(model, x, *args, **kwargs):
"""Summarize the given input model.
Summarized information are 1) output shape, 2) kernel shape,
3) number of the parameters and 4) operations (Mult-Adds)
Args:
mo... | [
"torch.no_grad",
"collections.OrderedDict",
"numpy.prod"
] | [((2695, 2708), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2706, 2708), False, 'from collections import OrderedDict\n'), ((2767, 2782), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2780, 2782), False, 'import torch\n'), ((827, 840), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (... |
import argparse
import os
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
from PIL import Image
from utils import visualization_utils as vis_util
from utils import label_map_util
if tf.__version__ < '1.4.0':
raise ImportError('Please upgrade your tensorflow installation to v1.4.* ... | [
"utils.label_map_util.load_labelmap",
"tensorflow.Graph",
"PIL.Image.open",
"argparse.ArgumentParser",
"tensorflow.Session",
"os.path.join",
"tensorflow.GraphDef",
"utils.label_map_util.convert_label_map_to_categories",
"numpy.squeeze",
"utils.label_map_util.create_category_index",
"tensorflow.i... | [((392, 417), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (415, 417), False, 'import argparse\n'), ((708, 783), 'os.path.join', 'os.path.join', (['FLAGS.output_dir', '"""exported_graphs/frozen_inference_graph.pb"""'], {}), "(FLAGS.output_dir, 'exported_graphs/frozen_inference_graph.pb')\n", ... |
import numpy as np
from matrix import gemm
def main():
c = np.zeros((10, 10), np.int32)
c_np = np.zeros((10, 10), np.int32)
# 10x10 matrix -> assign random integers from 0 to 10
a = np.random.randint(0, 10, (10, 10), np.int32)
b = np.random.randint(0, 10, (10, 10), np.int32)
gemm(c, a, b... | [
"matrix.gemm",
"numpy.zeros",
"numpy.matmul",
"numpy.random.randint"
] | [((65, 93), 'numpy.zeros', 'np.zeros', (['(10, 10)', 'np.int32'], {}), '((10, 10), np.int32)\n', (73, 93), True, 'import numpy as np\n'), ((105, 133), 'numpy.zeros', 'np.zeros', (['(10, 10)', 'np.int32'], {}), '((10, 10), np.int32)\n', (113, 133), True, 'import numpy as np\n'), ((201, 245), 'numpy.random.randint', 'np.... |
# coding=utf-8
# Copyright 2019 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | [
"h5py.File",
"numpy.transpose",
"tensorflow.contrib.slim.tfexample_decoder.Tensor",
"tensorflow.FixedLenFeature"
] | [((3334, 3368), 'numpy.transpose', 'np.transpose', (['ims', '(0, 1, 3, 4, 2)'], {}), '(ims, (0, 1, 3, 4, 2))\n', (3346, 3368), True, 'import numpy as np\n'), ((2384, 2417), 'tensorflow.FixedLenFeature', 'tf.FixedLenFeature', (['[1]', 'tf.int64'], {}), '([1], tf.int64)\n', (2402, 2417), True, 'import tensorflow as tf\n'... |
import cv2
import numpy
from logger import logger
class Sentence(object):
def __init__(self):
self.x = -1
self.y = -1
self.words = []
self.mask = None
def compute(self, grayed, contour, all_words):
(self.x, self.y), (_, _), _ = cv2.minAreaRect(contour)
for wo... | [
"cv2.convertScaleAbs",
"cv2.drawContours",
"cv2.pointPolygonTest",
"numpy.int32",
"cv2.minAreaRect",
"numpy.zeros"
] | [((281, 305), 'cv2.minAreaRect', 'cv2.minAreaRect', (['contour'], {}), '(contour)\n', (296, 305), False, 'import cv2\n'), ((644, 682), 'numpy.zeros', 'numpy.zeros', (['grayed.shape', 'numpy.uint8'], {}), '(grayed.shape, numpy.uint8)\n', (655, 682), False, 'import numpy\n'), ((691, 746), 'cv2.drawContours', 'cv2.drawCon... |
import argparse
import tqdm
import random
import math
import os
import pandas as pd
import sklearn
import timeit
import numpy as np
import struct
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
import pickle
import torch
import pandas as pd
import torchvision
import ... | [
"torchnet.meter.ConfusionMeter",
"timeit.default_timer",
"numpy.array2string",
"torch.Tensor",
"torch.from_numpy",
"numpy.exp",
"numpy.array",
"torch.nn.NLLLoss",
"torchnet.meter.AUCMeter",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"torch.sum",
"torchvision.transform... | [((641, 658), 'torchnet.meter.ConfusionMeter', 'ConfusionMeter', (['(2)'], {}), '(2)\n', (655, 658), False, 'from torchnet.meter import ConfusionMeter\n'), ((715, 725), 'torchnet.meter.AUCMeter', 'AUCMeter', ([], {}), '()\n', (723, 725), False, 'from torchnet.meter import AUCMeter\n'), ((782, 797), 'visdom.Visdom', 'vi... |
# Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code mus... | [
"rcsenv.addResourcePath",
"os.path.join",
"numpy.diag",
"numpy.array",
"numpy.cos",
"numpy.random.uniform",
"numpy.sin",
"pyrado.tasks.reward_functions.ExpQuadrErrRewFcn"
] | [((2048, 2099), 'rcsenv.addResourcePath', 'rcsenv.addResourcePath', (['rcsenv.RCSPYSIM_CONFIG_PATH'], {}), '(rcsenv.RCSPYSIM_CONFIG_PATH)\n', (2070, 2099), False, 'import rcsenv\n'), ((2123, 2175), 'os.path.join', 'osp.join', (['rcsenv.RCSPYSIM_CONFIG_PATH', '"""QuanserQube"""'], {}), "(rcsenv.RCSPYSIM_CONFIG_PATH, 'Qu... |
"""Numerical sklearn privacy metric modules and their attackers."""
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.neural_network import MLPRegressor
from sklearn.svm import SVR
from sdmetrics.single_table.privacy.base import NumericalPrivacyMetric, PrivacyAttackerModel
class Nume... | [
"numpy.array",
"sklearn.svm.SVR"
] | [((1345, 1374), 'numpy.array', 'np.array', (['synthetic_data[key]'], {}), '(synthetic_data[key])\n', (1353, 1374), True, 'import numpy as np\n'), ((1401, 1436), 'numpy.array', 'np.array', (['synthetic_data[sensitive]'], {}), '(synthetic_data[sensitive])\n', (1409, 1436), True, 'import numpy as np\n'), ((2533, 2538), 's... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
import time
import sys
import paddle
import paddle.fluid as fluid
import reader
import argparse
import functools
import models
import utils
from utils.utility import add_arguments,pr... | [
"paddle.fluid.DataFeeder",
"reader.test",
"argparse.ArgumentParser",
"paddle.fluid.layers.softmax",
"paddle.fluid.default_startup_program",
"paddle.fluid.layers.data",
"paddle.fluid.CPUPlace",
"os.path.join",
"utils.utility.print_arguments",
"paddle.fluid.io.save_inference_model",
"paddle.fluid.... | [((356, 400), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (379, 400), False, 'import argparse\n'), ((427, 477), 'functools.partial', 'functools.partial', (['add_arguments'], {'argparser': 'parser'}), '(add_arguments, argparser=parser)\n', (444, 477)... |
#%%
import argparse
import torch
import numpy as np
from dataloader import *
from model import Model
from loss import *
import os
import random
from pathlib import Path
import wandb
import time
from utils.pyart import bnum2ls
# fix random seeds for reproducibility
SEED = 1
torch.manual_seed(SEED)
torch.cuda.manual_see... | [
"model.Model",
"wandb.log",
"wandb.init",
"numpy.array",
"argparse.ArgumentParser",
"pathlib.Path",
"torch.mean",
"numpy.random.seed",
"torch.abs",
"os.path.isfile",
"torch.save",
"utils.pyart.bnum2ls",
"time.time",
"torch.cuda.set_device",
"torch.device",
"torch.manual_seed",
"torch... | [((275, 298), 'torch.manual_seed', 'torch.manual_seed', (['SEED'], {}), '(SEED)\n', (292, 298), False, 'import torch\n'), ((299, 327), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['SEED'], {}), '(SEED)\n', (321, 327), False, 'import torch\n'), ((409, 429), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}),... |
# Script use to collect incumbents_v5.pkl
# Uses incumbents_v4.pkl and reorders the list in a semi-deterministic manner
import pickle
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.spatial import distance_matrix
# from scipy.spatial.distance import euclidean
from scipy.spatial import... | [
"numpy.log10",
"pickle.dump",
"matplotlib.pyplot.xscale",
"matplotlib.pyplot.plot",
"pickle.load",
"numpy.argmax",
"numpy.append",
"scipy.spatial.ConvexHull",
"matplotlib.pyplot.suptitle",
"numpy.argsort",
"matplotlib.pyplot.scatter",
"pandas.DataFrame",
"matplotlib.pyplot.yscale",
"matplo... | [((1755, 1773), 'pandas.DataFrame', 'pd.DataFrame', (['incs'], {}), '(incs)\n', (1767, 1773), True, 'import pandas as pd\n'), ((2059, 2076), 'scipy.spatial.ConvexHull', 'ConvexHull', (['model'], {}), '(model)\n', (2069, 2076), False, 'from scipy.spatial import ConvexHull, convex_hull_plot_2d\n'), ((2133, 2151), 'numpy.... |
# -*- coding: utf-8 -*-
"""
Boolean Network
================
Main class for Boolean network objects.
"""
# Copyright (C) 2021 by
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# All rights reserved.
# MIT license.
from collections import defaultdict
try:
import cStringIO.StringIO as StringIO... | [
"re.compile",
"numpy.log",
"cana.control.fvs.fvs_grasp",
"networkx.weakly_connected_components",
"copy.deepcopy",
"copy.copy",
"networkx.dfs_preorder_nodes",
"networkx.DiGraph",
"numpy.exp",
"numpy.linspace",
"cana.control.fvs.fvs_bruteforce",
"warnings.warn",
"io.StringIO",
"networkx.attr... | [((5259, 5275), 'io.StringIO', 'StringIO', (['string'], {}), '(string)\n', (5267, 5275), False, 'from io import StringIO\n'), ((5292, 5309), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (5303, 5309), False, 'from collections import defaultdict\n'), ((7957, 7974), 'collections.defaultdict', 'def... |
import numpy as np
import ecogdata.util as ut
def array_geometry(data, map, axis=-1):
# re-arange the 2D matrix of timeseries data such that the
# channel axis is ordered by the array geometry
map = map.as_row_major()
geo = map.geometry
dims = list(data.shape)
while axis < 0:
... | [
"numpy.zeros"
] | [((413, 450), 'numpy.zeros', 'np.zeros', (['(geo + (ts_dim,))', 'data.dtype'], {}), '(geo + (ts_dim,), data.dtype)\n', (421, 450), True, 'import numpy as np\n')] |
#!/usr/bin/evn python
"""
CMSC733 Spring 2019: Classical and Deep Learning Approaches for
Geometric Computer Vision
Project1: MyAutoPano: Phase 1 Starter Code
Author(s):
<NAME> (<EMAIL>)
M.Eng. Robotics,
University of Maryland, College Park
"""
# Python libraries
import argparse
import numpy as np
... | [
"cv2.BFMatcher",
"numpy.argsort",
"numpy.array",
"cv2.warpPerspective",
"numpy.linalg.norm",
"matplotlib.pyplot.imshow",
"numpy.mean",
"numpy.reshape",
"cv2.drawMatchesKnn",
"argparse.ArgumentParser",
"numpy.where",
"numpy.float64",
"skimage.feature.peak_local_max",
"cv2.cornerMinEigenVal"... | [((548, 585), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (560, 585), False, 'import cv2\n'), ((817, 828), 'numpy.where', 'np.where', (['m'], {}), '(m)\n', (825, 828), True, 'import numpy as np\n'), ((1003, 1037), 'skimage.feature.peak_local_max', 'peak_local_max'... |
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"sympy.Symbol",
"cirq.S",
"cirq.ry",
"cirq.Circuit",
"cirq.ISwapPowGate",
"cirq.SWAP",
"cirq.HPowGate",
"cirq.X.on_each",
"cirq.CSwapGate",
"cirq.T",
"pytest.skip",
"cirq.kraus",
"cirq.TOFFOLI",
"cirq.SwapPowGate",
"cirq.Z",
"cirq.rz",
"cirq.IdentityGate",
"cirq.H",
"cirq.Moment"... | [((1215, 1270), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode"""', "['noiseless', 'noisy']"], {}), "('mode', ['noiseless', 'noisy'])\n", (1238, 1270), False, 'import pytest\n'), ((3136, 3191), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode"""', "['noiseless', 'noisy']"], {}), "('mod... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
get_ipython().run_line_magic('matplotlib', 'inline')
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_csv('../input/kc_house_data.csv')
df.head()
# In[ ]:
# Get Year and Month
df['Year'], df['Month'] = df['da... | [
"sklearn.preprocessing.PolynomialFeatures",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.triu_indices_from",
"matplotlib.pyplot.figure",
"pandas.get_dummies",
"seaborn.axes_style",
"pandas.concat",
"sklearn.linear_model.LinearRegression"
] | [((202, 243), 'pandas.read_csv', 'pd.read_csv', (['"""../input/kc_house_data.csv"""'], {}), "('../input/kc_house_data.csv')\n", (213, 243), True, 'import pandas as pd\n'), ((414, 442), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 12)'}), '(figsize=(15, 12))\n', (424, 442), True, 'import matplotlib.p... |
import numpy as np
import torch
from scipy.signal import convolve2d, correlate2d
from torch.autograd import Function
from torch.nn.modules.module import Module
from torch.nn.parameter import Parameter
import EggNet.NeuralNetwork.Ext.NeuralNetworkExtension as NNExt
class ReLU_FPGA(torch.autograd.Function):
"""
... | [
"torch.as_tensor",
"torch.from_numpy",
"EggNet.NeuralNetwork.Ext.NeuralNetworkExtension.relu1D",
"numpy.sum",
"torch.randn"
] | [((1001, 1020), 'EggNet.NeuralNetwork.Ext.NeuralNetworkExtension.relu1D', 'NNExt.relu1D', (['NNExt'], {}), '(NNExt)\n', (1013, 1020), True, 'import EggNet.NeuralNetwork.Ext.NeuralNetworkExtension as NNExt\n'), ((3170, 3212), 'torch.as_tensor', 'torch.as_tensor', (['result'], {'dtype': 'input.dtype'}), '(result, dtype=i... |
import os
import numpy as np
import pandas as pd
baseline_data_dir = "../data/baselines"
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
# 2015_WP #
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++... | [
"os.path.abspath",
"numpy.array",
"numpy.zeros"
] | [((664, 704), 'numpy.array', 'np.array', (['[1, 9, 17, 25, 33, 41, 49, 57]'], {}), '([1, 9, 17, 25, 33, 41, 49, 57])\n', (672, 704), True, 'import numpy as np\n'), ((731, 747), 'numpy.zeros', 'np.zeros', (['(8, 8)'], {}), '((8, 8))\n', (739, 747), True, 'import numpy as np\n'), ((950, 979), 'numpy.array', 'np.array', (... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ===============================================================
# Copyright (C) 2019 HuangYk.
# Licensed under The MIT Lincese.
#
# Filename : optic_flow_loader.py
# Author : HuangYK
# Last Modified: 2019-07-16 21:41
# Description :
# =========================... | [
"numpy.array"
] | [((612, 627), 'numpy.array', 'np.array', (['opt_x'], {}), '(opt_x)\n', (620, 627), True, 'import numpy as np\n'), ((664, 679), 'numpy.array', 'np.array', (['opt_y'], {}), '(opt_y)\n', (672, 679), True, 'import numpy as np\n')] |
import numpy as np
import matplotlib.pyplot as plt
from keras.datasets import cifar10
from sklearn.ensemble import RandomForestClassifier
import time
start_time = time.time()
# データの読み込み
(x_train_origin, y_train), (x_test_origin, y_test) = cifar10.load_data()
# 小数化
x_train_origin = x_train_origin / 255
x_test_origin ... | [
"time.time",
"sklearn.ensemble.RandomForestClassifier",
"keras.datasets.cifar10.load_data",
"numpy.linalg.norm"
] | [((164, 175), 'time.time', 'time.time', ([], {}), '()\n', (173, 175), False, 'import time\n'), ((241, 260), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (258, 260), False, 'from keras.datasets import cifar10\n'), ((1119, 1154), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassi... |
from __future__ import print_function, unicode_literals
import tensorflow as tf
import numpy as np
import scipy.misc
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import os
from mpl_toolkits.mplot3d import Axes3D
import argparse
import cv2
import operator
import pickle
from nets.ColorHandPose3DNetw... | [
"numpy.array",
"tensorflow.gfile.GFile",
"pose.DeterminePositions.get_position_name_with_pose_id",
"operator.itemgetter",
"nets.ColorHandPose3DNetwork.ColorHandPose3DNetwork",
"tensorflow.GPUOptions",
"tensorflow.Graph",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"pose.utils.Fing... | [((654, 753), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Classify hand gestures from the set of images in folder"""'}), "(description=\n 'Classify hand gestures from the set of images in folder')\n", (677, 753), False, 'import argparse\n'), ((2049, 2075), 'os.path.abspath', 'os.pa... |
from __future__ import division, print_function
# Turn off plotting imports for production
if False:
if __name__ == '__main__':
import matplotlib
matplotlib.use('Agg')
import os
import argparse
import sys
import numpy as np
from scipy.stats import sigmaclip
import fitsio
from astropy.table impor... | [
"logging.getLogger",
"numpy.clip",
"astrometry.util.multiproc.multiproc",
"numpy.sqrt",
"numpy.log10",
"tractor.Tractor",
"numpy.log",
"scipy.stats.sigmaclip",
"numpy.argsort",
"tractor.PixPos",
"numpy.isfinite",
"astropy.table.vstack",
"astrometry.util.ttime.Time",
"tractor.brightness.Nan... | [((818, 867), 'logging.getLogger', 'logging.getLogger', (['"""legacyzpts.legacy_zeropoints"""'], {}), "('legacyzpts.legacy_zeropoints')\n", (835, 867), False, 'import logging\n'), ((933, 956), 'legacypipe.utils.log_debug', 'log_debug', (['logger', 'args'], {}), '(logger, args)\n', (942, 956), False, 'from legacypipe.ut... |
import numpy as np
import pandas as pd
import torch
import torchvision
import torch.nn.functional as F
from torchvision import datasets,transforms,models
import matplotlib.pyplot as plt
#from train import get_pretrained_model
from torch import nn,optim
from PIL import Image
#%matplotlib inline
def load_dataset(data_di... | [
"numpy.clip",
"torch.from_numpy",
"torch.exp",
"numpy.array",
"torch.cuda.is_available",
"torch.unsqueeze",
"torchvision.datasets.ImageFolder",
"torchvision.transforms.ToTensor",
"torchvision.transforms.RandomResizedCrop",
"torch.topk",
"torchvision.transforms.RandomHorizontalFlip",
"torchvisi... | [((1643, 1702), 'torchvision.datasets.ImageFolder', 'datasets.ImageFolder', (['train_dir'], {'transform': 'train_transforms'}), '(train_dir, transform=train_transforms)\n', (1663, 1702), False, 'from torchvision import datasets, transforms, models\n'), ((1717, 1776), 'torchvision.datasets.ImageFolder', 'datasets.ImageF... |
# -*- coding: utf-8 -*-
# MLToolkit (mltoolkit)
__name__="mltk"
"""
MLToolkit - a verstile helping library for machine learning
===========================================================
'MLToolkit' is a Python package providing a set of user-friendly functions to
help building machine learning models in d... | [
"traceback.format_exc",
"shap.DeepExplainer",
"pickle.dump",
"pickle.load",
"shap.force_plot",
"shap.LinearExplainer",
"shap.TreeExplainer",
"pandas.DataFrame",
"pandas.concat",
"matplotlib.pyplot.subplots",
"numpy.arange"
] | [((11996, 12363), 'shap.force_plot', 'shap.force_plot', ([], {'base_value': 'base_value', 'shap_values': 'ShapValues[model_variables].values', 'features': 'VariableValues[model_variables].values', 'feature_names': 'model_variables', 'out_names': 'None', 'link': '"""identity"""', 'plot_cmap': '"""RdBu"""', 'matplotlib':... |
import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.autograd import Variable
import numpy as np
from skimage import transform
import sys
sys.path.insert(0, '/root/LKVOLearner/DEN')
import modeling
import fdc
import den
sys.path.insert(0,"~/LKVOLearner/src/util")
import util
DISP... | [
"torch.nn.Sigmoid",
"torch.nn.ReLU",
"sys.path.insert",
"fdc.FDC.__call__",
"torch.nn.Sequential",
"numpy.floor",
"torch.nn.Conv2d",
"den.DEN",
"torch.nn.AvgPool2d",
"torch.tensor",
"torch.cuda.is_available",
"torch.nn.ReplicationPad2d",
"torch.nn.Upsample",
"torch.nn.ELU",
"torch.nn.Con... | [((175, 218), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/root/LKVOLearner/DEN"""'], {}), "(0, '/root/LKVOLearner/DEN')\n", (190, 218), False, 'import sys\n'), ((259, 303), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""~/LKVOLearner/src/util"""'], {}), "(0, '~/LKVOLearner/src/util')\n", (274, 303), False, ... |
#!/usr/bin/env python3
import sys, os
import matplotlib as mat
mat.use('GTK3Agg')
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import cv2
from sklearn.cluster import KMeans
import numpy as np
import sqlite3
from joblib import Parallel, delayed
import logging
from typing import *
CLUSTERS = ... | [
"logging.basicConfig",
"numpy.histogram",
"matplotlib.use",
"os.walk",
"os.path.join",
"joblib.Parallel",
"os.path.basename",
"joblib.delayed",
"cv2.imread",
"numpy.float32",
"numpy.arange"
] | [((64, 82), 'matplotlib.use', 'mat.use', (['"""GTK3Agg"""'], {}), "('GTK3Agg')\n", (71, 82), True, 'import matplotlib as mat\n'), ((378, 495), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(funcName)s - %(message)s"""', 'level': 'logging.DEBUG'}), "(format=\n '%(asc... |
import matplotlib.pyplot as plt
import numpy as np
def inverse_normalization(X):
return X * 255.0
def plot_generated_batch(X_full, X_sketch, generator_model, epoch_num, dataset_name, batch_num):
# Generate images
X_gen = generator_model.predict(X_sketch)
X_sketch = inverse_normalization(X_sketch)
... | [
"numpy.concatenate"
] | [((574, 610), 'numpy.concatenate', 'np.concatenate', (['(Xs, Xg, Xr)'], {'axis': '(3)'}), '((Xs, Xg, Xr), axis=3)\n', (588, 610), True, 'import numpy as np\n'), ((657, 682), 'numpy.concatenate', 'np.concatenate', (['X'], {'axis': '(1)'}), '(X, axis=1)\n', (671, 682), True, 'import numpy as np\n')] |
import numpy as np
import matplotlib.pyplot as plt
import scipy.special as sp
import astropy.units as au
import astropy.constants as ac
def Sigma_E(SFE, Psi):
"""Eddington surface density"""
return SFE/(1.0 + SFE)*Psi/(2.0*np.pi*ac.c.cgs.value*ac.G.cgs.value)
def mu_M(Sigma_cl, SFE, x, sigma):
return np.l... | [
"numpy.sqrt",
"numpy.log",
"numpy.asarray",
"numpy.argmax",
"numpy.linspace",
"scipy.special.erf",
"numpy.zeros_like"
] | [((829, 866), 'numpy.linspace', 'np.linspace', (['(0.0001)', '(0.9999)'], {'num': '(1000)'}), '(0.0001, 0.9999, num=1000)\n', (840, 866), True, 'import numpy as np\n'), ((1366, 1388), 'numpy.zeros_like', 'np.zeros_like', (['Sigmacl'], {}), '(Sigmacl)\n', (1379, 1388), True, 'import numpy as np\n'), ((1403, 1425), 'nump... |
import numpy as np
from scipy.sparse import csr_matrix
def read( file_path, min_feature_count=0 ) :
file = open(file_path, "r")
data = []
column = []
row = [0]
y = []
rowCount = 0;
columnCount = 0
elementCount = 0
for line in file:
cur = line.split(" ")
y.append( int(cur[0]) )
for i in range(1, len(... | [
"numpy.array"
] | [((582, 608), 'numpy.array', 'np.array', (['data', 'np.float32'], {}), '(data, np.float32)\n', (590, 608), True, 'import numpy as np\n'), ((612, 638), 'numpy.array', 'np.array', (['column', 'np.int32'], {}), '(column, np.int32)\n', (620, 638), True, 'import numpy as np\n'), ((1379, 1405), 'numpy.array', 'np.array', (['... |
"""
Example using sksym with a two-dimensional landmap.
"""
import functools
import glob
import os
import numpy
import lightgbm
import matplotlib
from matplotlib import pyplot
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from PIL import Image
import sksym
RNG = numpy.random.Generator(numpy.random.Ph... | [
"PIL.Image.open",
"numpy.roll",
"numpy.ones",
"numpy.sin",
"numpy.log",
"os.path.join",
"numpy.random.Philox",
"matplotlib.pyplot.close",
"sksym.WhichIsReal",
"numpy.linspace",
"numpy.empty",
"os.path.basename",
"numpy.empty_like",
"sksym.score",
"sksym.predict_log_proba",
"numpy.meshg... | [((305, 332), 'numpy.random.Philox', 'numpy.random.Philox', (['(983249)'], {}), '(983249)\n', (324, 332), False, 'import numpy\n'), ((345, 371), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (361, 371), False, 'import os\n'), ((1769, 1799), 'numpy.empty', 'numpy.empty', (['shape', 'numpy.i... |
# -*- coding: utf-8 -*-
# Copyright © 2019 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from __future__ import print_function as _
from __future__ import division as _
from... | [
"turicreate._deps.minimal_package._minimal_package_import_check",
"numpy.flip",
"PIL.Image.fromarray",
"numpy.sqrt",
"turicreate.image_analysis.resize",
"numpy.ones",
"turicreate.toolkits._tf_utils.convert_shared_float_array_to_numpy",
"numpy.any",
"numpy.ascontiguousarray",
"numpy.array",
"nump... | [((710, 763), 'turicreate._deps.minimal_package._minimal_package_import_check', '_minimal_package_import_check', (['"""tensorflow.compat.v1"""'], {}), "('tensorflow.compat.v1')\n", (739, 763), False, 'from turicreate._deps.minimal_package import _minimal_package_import_check\n'), ((5604, 5621), 'numpy.flip', 'np.flip',... |
# Copyright 2021 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software... | [
"pydrobert.kaldi.io.open",
"numpy.allclose",
"pydrobert.kaldi.io.command_line.write_pickle_to_table",
"os.makedirs",
"pydrobert.kaldi.io.util.infer_kaldi_data_type",
"numpy.random.random",
"pydrobert.kaldi.io.command_line.write_torch_dir_to_table",
"os.path.join",
"pydrobert.kaldi.io.command_line.wr... | [((1544, 1648), 'pydrobert.kaldi.io.command_line.write_pickle_to_table', 'command_line.write_pickle_to_table', (["[temp_file_1_name, 'ark:' + temp_file_2_name, '-o', kaldi_dtype]"], {}), "([temp_file_1_name, 'ark:' +\n temp_file_2_name, '-o', kaldi_dtype])\n", (1578, 1648), True, 'import pydrobert.kaldi.io.command_l... |
# -*- coding: utf-8 -*-
##########################################################################
# pySAP - Copyright (C) CEA, 2017 - 2018
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-e... | [
"numpy.ones_like",
"pysap.Image",
"numpy.sqrt",
"pysap.TempDir",
"pysap.plotting.plot_transform",
"os.path.join",
"numpy.iscomplexobj",
"numpy.zeros",
"numpy.sum",
"pysap.extensions.mr_recons",
"pysap.io.load",
"pysap.extensions.mr_transform",
"warnings.warn",
"pysap.io.save",
"pysparse.... | [((747, 813), 'warnings.warn', 'warnings.warn', (['"""Sparse2d python bindings not found, use binaries."""'], {}), "('Sparse2d python bindings not found, use binaries.')\n", (760, 813), False, 'import warnings\n'), ((11776, 11796), 'pysap.plotting.plot_transform', 'plot_transform', (['self'], {}), '(self)\n', (11790, 1... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 9 14:13:23 2021
@author: willrichardson
"""
# This script calculates other relevant stats and quantities of interest for each half-hour period
# includes 30-minute quantites and spectral quantites in each period
# leaving RMSDs as local variables;... | [
"sys.path.insert",
"numpy.sqrt",
"pandas.read_csv",
"numpy.array",
"funcs.read_conc",
"numpy.arange",
"numpy.mean",
"numpy.float64",
"funcs.sort_ByDate_DMY",
"pandas.DataFrame",
"glob.glob",
"numpy.corrcoef",
"numpy.log2",
"numpy.unique",
"numpy.absolute",
"os.getcwd",
"numpy.sum",
... | [((381, 470), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/Users/willrichardson/opt/anaconda3/lib/python3.8/site-packages"""'], {}), "(0,\n '/Users/willrichardson/opt/anaconda3/lib/python3.8/site-packages')\n", (396, 470), False, 'import sys\n'), ((723, 742), 'numpy.float64', 'np.float64', (['args[1]'], {}), ... |
# Image augmentation with ImageDataGenerator
# Steps
# 1. Prepare images dataset
# 2. create ImageDataGenerator
# 3. Create iterators flow() or flow_from_directory(...)
# 4. Fit
# Horizontal shift image augmentation
from PIL import Image
from numpy import expand_dims
from keras.preprocessing.image import load_img, ... | [
"matplotlib.pyplot.imshow",
"keras.preprocessing.image.img_to_array",
"keras.preprocessing.image.ImageDataGenerator",
"keras.preprocessing.image.load_img",
"numpy.expand_dims",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((389, 409), 'keras.preprocessing.image.load_img', 'load_img', (['"""bird.jpg"""'], {}), "('bird.jpg')\n", (397, 409), False, 'from keras.preprocessing.image import load_img, img_to_array, ImageDataGenerator\n'), ((418, 435), 'keras.preprocessing.image.img_to_array', 'img_to_array', (['img'], {}), '(img)\n', (430, 435... |
"""
An interface to PISM NetCDF files
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
from netCDF4 import Dataset
from .colors import default_cmaps
sec_year = 365*24*3600.
class PISMDataset():
"""An interface to PISM NetCDF files
Provide simple plot methods for quick visualization of PISM ... | [
"numpy.where",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.gcf",
"netCDF4.Dataset",
"matplotlib.pyplot.colorbar",
"numpy.isnan",
"numpy.ma.set_fill_value",
"sys.exit",
"numpy.meshgrid"
] | [((410, 445), 'netCDF4.Dataset', 'Dataset', (['file_name', '*args'], {}), '(file_name, *args, **kwargs)\n', (417, 445), False, 'from netCDF4 import Dataset\n'), ((4840, 4867), 'numpy.meshgrid', 'np.meshgrid', (['self.x', 'self.y'], {}), '(self.x, self.y)\n', (4851, 4867), True, 'import numpy as np\n'), ((6799, 6826), '... |
# Copyright 2016, FBPIC contributors
# Authors: <NAME>, <NAME>
# License: 3-Clause-BSD-LBNL
"""
This file is part of the Fourier-Bessel Particle-In-Cell code (FB-PIC)
It defines a set of common longitudinal laser profiles.
"""
import numpy as np
from scipy.constants import c
from scipy.interpolate import interp1d
from ... | [
"numpy.trapz",
"numpy.polyfit",
"numpy.arange",
"scipy.special.factorial",
"numpy.fft.fftfreq",
"numpy.fft.fft",
"scipy.interpolate.interp1d",
"numpy.exp",
"numpy.loadtxt",
"numpy.zeros_like",
"numpy.round"
] | [((2684, 2717), 'numpy.zeros_like', 'np.zeros_like', (['z'], {'dtype': '"""complex"""'}), "(z, dtype='complex')\n", (2697, 2717), True, 'import numpy as np\n'), ((11578, 11619), 'numpy.loadtxt', 'np.loadtxt', (['spectrum_file'], {'delimiter': '"""\t"""'}), "(spectrum_file, delimiter='\\t')\n", (11588, 11619), True, 'im... |
import unittest
from testinfrastructure.InDirTest import InDirTest
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
from sympy import Symbol, Piecewise
from scipy.interpolate import interp1d
from CompartmentalSystems.myOdeResult import get_sub_t_spans, solve_ivp_pwc
cl... | [
"sympy.Symbol",
"numpy.allclose",
"matplotlib.use",
"CompartmentalSystems.myOdeResult.get_sub_t_spans",
"numpy.asarray",
"numpy.array",
"sympy.Piecewise",
"matplotlib.pyplot.subplots",
"unittest.main",
"CompartmentalSystems.myOdeResult.solve_ivp_pwc",
"numpy.arange",
"unittest.defaultTestLoade... | [((105, 126), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (119, 126), False, 'import matplotlib\n'), ((4546, 4604), 'unittest.defaultTestLoader.discover', 'unittest.defaultTestLoader.discover', (['"""."""'], {'pattern': '__file__'}), "('.', pattern=__file__)\n", (4581, 4604), False, 'import un... |
from ..feature_types import secondary_feature, log
from ..primary.survey_scores import survey_scores
import numpy as np
@secondary_feature(
name="cortex.survey_results",
dependencies=[survey_scores]
)
def survey_results(**kwargs):
"""
:param id (str): participant id.
:param start (int): start t... | [
"numpy.nanmean"
] | [((580, 632), 'numpy.nanmean', 'np.nanmean', (["[s['score'] for s in all_scores[survey]]"], {}), "([s['score'] for s in all_scores[survey]])\n", (590, 632), True, 'import numpy as np\n')] |
import numpy as np
import libs.pd_lib as lib #library for simulation routines
import libs.data as data
import libs.plot as vplt #plotting library
from structure.global_constants import *
import structure.initialisation as init
from structure.cell import Tissue, BasicSpringForceNoGrowth
"""run a single voronoi tessella... | [
"libs.pd_lib.run_simulation",
"numpy.random.RandomState"
] | [((481, 504), 'numpy.random.RandomState', 'np.random.RandomState', ([], {}), '()\n', (502, 504), True, 'import numpy as np\n'), ((747, 838), 'libs.pd_lib.run_simulation', 'lib.run_simulation', (['simulation', 'l', 'timestep', 'timend', 'rand', 'DELTA', 'game', 'game_parameters'], {}), '(simulation, l, timestep, timend,... |
import os
from multiprocessing import Queue, Process, Lock
import numpy as np
from twitter_bot_type_classification.features.user import UserFeatures
class CalcWorker(Process):
def __init__(self, task_q, results_q):
self.task_q = task_q
self.results_q = results_q
super(CalcWorker, self)._... | [
"twitter_bot_type_classification.features.user.UserFeatures",
"numpy.asarray",
"os.cpu_count",
"multiprocessing.Lock",
"multiprocessing.Queue"
] | [((1917, 1923), 'multiprocessing.Lock', 'Lock', ([], {}), '()\n', (1921, 1923), False, 'from multiprocessing import Queue, Process, Lock\n'), ((2002, 2016), 'os.cpu_count', 'os.cpu_count', ([], {}), '()\n', (2014, 2016), False, 'import os\n'), ((2213, 2237), 'multiprocessing.Queue', 'Queue', (['self.tasks_q_size'], {})... |
# Princeton University licenses this file to You under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy of the License at:
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writin... | [
"itertools.chain",
"typecheck.optional",
"numpy.full_like",
"numpy.zeros"
] | [((4669, 4686), 'typecheck.optional', 'tc.optional', (['list'], {}), '(list)\n', (4680, 4686), True, 'import typecheck as tc\n'), ((5481, 5492), 'numpy.zeros', 'np.zeros', (['(1)'], {}), '(1)\n', (5489, 5492), True, 'import numpy as np\n'), ((7010, 7051), 'numpy.full_like', 'np.full_like', (['prediction_vector.vector',... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"numpy.prod",
"tensorflow.split",
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits",
"tensorflow.get_variable_scope",
"tensorflow.train.MonitoredTrainingSession",
"tensorflow.reduce_mean",
"tensorflow.app.run",
"tensorflow.random_normal_initializer",
"tensorflow.ConfigProto",
"tensorflow.su... | [((2909, 2935), 'tensorflow.nn.relu', 'tf.nn.relu', (['preactivations'], {}), '(preactivations)\n', (2919, 2935), True, 'import tensorflow as tf\n'), ((4641, 4684), 'tensorflow.contrib.kfac.examples.mlp.fc_layer', 'mlp.fc_layer', (['layer_id', 'inputs', 'output_size'], {}), '(layer_id, inputs, output_size)\n', (4653, 4... |
"""
eureka_train.py
<NAME>, Dec 25 2019
train mask rcnn with eureka data
"""
import transforms as T
from engine import train_one_epoch, evaluate
import utils
import torch
from rock import Dataset
from model import get_rock_model_instance_segmentation
import numpy as np
torch.manual_seed(0)
class ToTensor(object):
... | [
"torch.manual_seed",
"torch.optim.SGD",
"numpy.mean",
"torch.load",
"torch.optim.lr_scheduler.StepLR",
"transforms.Compose",
"torch.from_numpy",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"engine.evaluate",
"engine.train_one_epoch",
"model.get_rock_model_instance_segmentation",
... | [((272, 292), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (289, 292), False, 'import torch\n'), ((681, 702), 'transforms.Compose', 'T.Compose', (['transforms'], {}), '(transforms)\n', (690, 702), True, 'import transforms as T\n'), ((1501, 1523), 'torch.device', 'torch.device', (['"""cuda:1"""'], {... |
import numpy as np
from typing import Any, Dict, List
nptype = np.float64
class Type:
def __init__(self):
pass
supertypes: Dict[Type, Type] = {}
subtypes: Dict[Type, List[Type]] = {}
def register_supertype(supertype: Any):
def _register_supertype(program_type: Type):
assert (
... | [
"numpy.isinf",
"numpy.isnan"
] | [((1313, 1328), 'numpy.isnan', 'np.isnan', (['value'], {}), '(value)\n', (1321, 1328), True, 'import numpy as np\n'), ((1352, 1367), 'numpy.isinf', 'np.isinf', (['value'], {}), '(value)\n', (1360, 1367), True, 'import numpy as np\n'), ((1589, 1604), 'numpy.isnan', 'np.isnan', (['value'], {}), '(value)\n', (1597, 1604),... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.