code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import os
import glob
import torch
import random
import logging
import numpy as np
from tqdm import tqdm
import torch.nn as nn
import torch.utils.data
import torch.optim as optim
from common.opt import opts
from common.utils import *
from common.camera import get_uvd2xyz
from common.load_data_hm36_tds_in_the_wild impor... | [
"numpy.random.seed",
"common.camera.get_uvd2xyz",
"torch.randn",
"torch.cat",
"numpy.ones",
"thop.profile.profile",
"model.stmo.Model",
"torch.no_grad",
"os.path.join",
"torch.load",
"random.seed",
"model.stmo_pretrain.Model_MAE",
"numpy.random.shuffle",
"tqdm.tqdm",
"torch.manual_seed",... | [((9349, 9376), 'random.seed', 'random.seed', (['opt.manualSeed'], {}), '(opt.manualSeed)\n', (9360, 9376), False, 'import random\n'), ((9381, 9414), 'torch.manual_seed', 'torch.manual_seed', (['opt.manualSeed'], {}), '(opt.manualSeed)\n', (9398, 9414), False, 'import torch\n'), ((9419, 9449), 'numpy.random.seed', 'np.... |
import sys
import os
base_path = os.path.dirname(os.path.abspath(__file__))
sys.path.append(base_path)
import torch
import numpy as np
from param import r2r_envdrop_args as args
import utils
import model
import torch.nn.functional as F
class Speaker():
env_actions = {
'left': (0,-1, 0), # left
'ri... | [
"torch.distributions.Categorical",
"model.SpeakerEncoder",
"model.load_state_dict",
"utils.length2mask",
"sys.path.append",
"os.path.abspath",
"torch.load",
"utils.angle_feature",
"torch.zeros",
"numpy.stack",
"model.state_dict",
"torch.from_numpy",
"os.makedirs",
"torch.stack",
"torch.n... | [((76, 102), 'sys.path.append', 'sys.path.append', (['base_path'], {}), '(base_path)\n', (91, 102), False, 'import sys\n'), ((49, 74), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (64, 74), False, 'import os\n'), ((1402, 1473), 'torch.nn.CrossEntropyLoss', 'torch.nn.CrossEntropyLoss', ([], ... |
import csv
import cv2
import numpy as np
import matplotlib.pyplot as plt
import random
from keras.models import Sequential
from keras.layers import *
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
DATA_SET = 'data'
steering_corrections = {
'center': 0,
'left': 0.35,
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"csv.reader",
"matplotlib.pyplot.plot",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.legend",
"keras.models.Sequential",
"cv2.flip",
"numpy.array",
"matplotlib.pyplot.ylabel",
"sklearn.utils.shuffle",
"matplotlib.pyplot.xla... | [((656, 700), 'sklearn.model_selection.train_test_split', 'train_test_split', (['all_samples'], {'test_size': '(0.2)'}), '(all_samples, test_size=0.2)\n', (672, 700), False, 'from sklearn.model_selection import train_test_split\n'), ((2410, 2440), 'matplotlib.pyplot.plot', 'plt.plot', (["hist.history['loss']"], {}), "(... |
'''
Copyright (c) 2019. IIP Lab, Wuhan University
'''
import os
import glob
import numpy as np
import pandas as pd
from tensorflow import keras
class VariationalEncoderDecoderGen(keras.utils.Sequence):
'''
Generate training data, validation, test data
'''
def __init__(self,
... | [
"numpy.load",
"numpy.empty",
"numpy.arange",
"pandas.read_table",
"os.path.join",
"numpy.random.shuffle"
] | [((1206, 1246), 'os.path.join', 'os.path.join', (['feature_root', '"""target.npz"""'], {}), "(feature_root, 'target.npz')\n", (1218, 1246), False, 'import os\n'), ((1514, 1540), 'numpy.arange', 'np.arange', (['self.num_videos'], {}), '(self.num_videos)\n', (1523, 1540), True, 'import numpy as np\n'), ((2509, 2552), 'nu... |
import argparse
import gym
import numpy as np
import random
import torch
import torch.optim
import torch.functional as Fnn
import torch.nn as nn
from baselines.common.atari_wrappers import WarpFrame, MaxAndSkipEnv
import model
num_atoms = 51
parser = argparse.ArgumentParser(description='C51-DQN Implementation Using P... | [
"gym.make",
"argparse.ArgumentParser",
"model.C51",
"baselines.common.atari_wrappers.MaxAndSkipEnv",
"baselines.common.atari_wrappers.WarpFrame",
"numpy.zeros",
"numpy.rollaxis"
] | [((253, 328), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""C51-DQN Implementation Using Pytorch"""'}), "(description='C51-DQN Implementation Using Pytorch')\n", (276, 328), False, 'import argparse\n'), ((1317, 1340), 'gym.make', 'gym.make', (['args.env_name'], {}), '(args.env_name)\n',... |
import numpy as np
from sklearn.gaussian_process.kernels import (Kernel,
StationaryKernelMixin,
Hyperparameter)
class WeightedWhiteKernel(StationaryKernelMixin, Kernel):
"""Weighted white kernel.
The main use-case of ... | [
"numpy.full",
"numpy.empty",
"numpy.zeros",
"sklearn.gaussian_process.kernels.Hyperparameter",
"numpy.diag",
"numpy.atleast_2d"
] | [((1273, 1338), 'sklearn.gaussian_process.kernels.Hyperparameter', 'Hyperparameter', (['"""noise_level"""', '"""numeric"""', 'self.noise_level_bounds'], {}), "('noise_level', 'numeric', self.noise_level_bounds)\n", (1287, 1338), False, 'from sklearn.gaussian_process.kernels import Kernel, StationaryKernelMixin, Hyperpa... |
import numpy as np
import json
from skimage import io, data
from PIL import Image
from see import GeneticSearch
import dash_canvas
import dash
from dash.dependencies import Input, Output, State
import dash_html_components as html
import dash_core_components as dcc
import plotly.graph_objs as go
from dash.exceptions ... | [
"dash_html_components.H2",
"utils.image_string_to_PILImage",
"utils.parse_jsonstring",
"dash.Dash",
"utils.image_with_contour",
"dash_html_components.Label",
"dash.dependencies.State",
"utils.segmentation_generic",
"shutil.copyfile",
"dash_canvas.components.image_upload_zone",
"skimage.io.imsave... | [((963, 982), 'dash.Dash', 'dash.Dash', (['__name__'], {}), '(__name__)\n', (972, 982), False, 'import dash\n'), ((763, 796), 'skimage.io.imread', 'io.imread', (['filename'], {'as_gray': '(True)'}), '(filename, as_gray=True)\n', (772, 796), False, 'from skimage import io, data\n'), ((4274, 4306), 'dash.dependencies.Out... |
import torch
import torch.nn as nn
import numpy as np
from sklearn.metrics.cluster import normalized_mutual_info_score as nmi_score
from sklearn.metrics import adjusted_rand_score as ari_score
from sklearn.metrics import silhouette_score
from sklearn.cluster import KMeans
from utils.faster_mix_k_means_pytorch import K_... | [
"argparse.ArgumentParser",
"data.imagenetloader.ImageNetLoader82from882",
"numpy.empty",
"random.sample",
"utils.util.cluster_acc",
"numpy.arange",
"torch.device",
"sklearn.metrics.adjusted_rand_score",
"sklearn.cluster.KMeans",
"torch.load",
"numpy.append",
"numpy.max",
"data.imagenetloader... | [((614, 669), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (637, 669), False, 'import warnings\n'), ((670, 727), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarning'}), "('ign... |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import division
import os
import time
import threading
import numpy as np
import h5py
import rospy
import atexit
import errno
from multi_tracker.msg import Trackedobject, Trackedobjectlist
# TODO maybe save roi information here to not req... | [
"atexit.register",
"h5py.File",
"rospy.Subscriber",
"rospy.Time.now",
"os.makedirs",
"os.getcwd",
"rospy.sleep",
"rospy.get_param",
"rospy.loginfo",
"threading.Lock",
"rospy.is_shutdown",
"numpy.array",
"rospy.init_node",
"rospy.get_name"
] | [((475, 530), 'rospy.init_node', 'rospy.init_node', (['"""save_hdf5_data"""'], {'log_level': 'rospy.INFO'}), "('save_hdf5_data', log_level=rospy.INFO)\n", (490, 530), False, 'import rospy\n'), ((552, 568), 'rospy.get_name', 'rospy.get_name', ([], {}), '()\n', (566, 568), False, 'import rospy\n'), ((1154, 1262), 'rospy.... |
from typing import Any, List, TypeVar
import numpy as np
import numpy.typing as npt
_SCT = TypeVar("_SCT", bound=np.generic)
def func1(ar: npt.NDArray[_SCT], a: int) -> npt.NDArray[_SCT]:
pass
def func2(ar: npt.NDArray[np.number[Any]], a: str) -> npt.NDArray[np.float64]:
pass
AR_b: npt.NDArray[np.bool_]... | [
"numpy.vander",
"numpy.tril_indices",
"numpy.triu",
"numpy.eye",
"numpy.diagflat",
"numpy.tril",
"numpy.histogram2d",
"numpy.flipud",
"numpy.tri",
"numpy.triu_indices",
"numpy.tril_indices_from",
"numpy.fliplr",
"numpy.triu_indices_from",
"typing.TypeVar",
"numpy.mask_indices",
"numpy.... | [((93, 126), 'typing.TypeVar', 'TypeVar', (['"""_SCT"""'], {'bound': 'np.generic'}), "('_SCT', bound=np.generic)\n", (100, 126), False, 'from typing import Any, List, TypeVar\n'), ((507, 522), 'numpy.fliplr', 'np.fliplr', (['AR_b'], {}), '(AR_b)\n', (516, 522), True, 'import numpy as np\n'), ((587, 607), 'numpy.fliplr'... |
from PIL import ImageGrab
from keyboard import is_pressed
from cv2 import VideoWriter, VideoWriter_fourcc, imshow, waitKey, destroyAllWindows, cvtColor, COLOR_BGR2RGB
from win32api import GetSystemMetrics
from numpy import array
from pyautogui import screenshot
width, height = GetSystemMetrics(0), GetSystemMetr... | [
"cv2.VideoWriter_fourcc",
"PIL.ImageGrab.grab",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"pyautogui.screenshot",
"keyboard.is_pressed",
"numpy.array",
"cv2.VideoWriter",
"cv2.destroyAllWindows",
"win32api.GetSystemMetrics"
] | [((337, 364), 'cv2.VideoWriter_fourcc', 'VideoWriter_fourcc', (["*'XVID'"], {}), "(*'XVID')\n", (355, 364), False, 'from cv2 import VideoWriter, VideoWriter_fourcc, imshow, waitKey, destroyAllWindows, cvtColor, COLOR_BGR2RGB\n'), ((380, 431), 'cv2.VideoWriter', 'VideoWriter', (['"""out.avi"""', 'fourcc', '(10)', '(widt... |
import numpy as np
from arch import arch_model
import pandas as pd
def GARCH_HS(s, winsize, day=4, miu=False):
s = s.reset_index(drop=True) # 对Series s 重设索引
garch = arch_model(y=s, mean='Constant', lags=0, vol='GARCH', p=1, o=0, q=1, dist='normal')
garchmodel = garch.fit(disp=0)
... | [
"numpy.percentile",
"arch.arch_model",
"numpy.zeros",
"numpy.sqrt"
] | [((189, 277), 'arch.arch_model', 'arch_model', ([], {'y': 's', 'mean': '"""Constant"""', 'lags': '(0)', 'vol': '"""GARCH"""', 'p': '(1)', 'o': '(0)', 'q': '(1)', 'dist': '"""normal"""'}), "(y=s, mean='Constant', lags=0, vol='GARCH', p=1, o=0, q=1, dist=\n 'normal')\n", (199, 277), False, 'from arch import arch_model... |
# -*- coding: utf-8 -*-
"""
@file:test_feature1.py
@time:2019/6/1 20:06
@author:Tangj
@software:Pycharm
@Desc
"""
import pandas as pd
import numpy as np
import time
tt = time.time()
fea = pd.DataFrame()
test_bid = pd.read_csv('../usingData/test/test_bid.csv')
request = pd.read_csv('../usingData/test/Request_list.csv')
... | [
"pandas.DataFrame",
"pandas.read_csv",
"pandas.merge",
"time.time",
"numpy.array",
"time.localtime"
] | [((170, 181), 'time.time', 'time.time', ([], {}), '()\n', (179, 181), False, 'import time\n'), ((188, 202), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (200, 202), True, 'import pandas as pd\n'), ((214, 259), 'pandas.read_csv', 'pd.read_csv', (['"""../usingData/test/test_bid.csv"""'], {}), "('../usingData/tes... |
#! /usr/bin/env python
#
# create_postprocessing_event_dag.py
#
# DAG for postprocessing jobs
# Uses
# - single-node job, to postprocess existing .composite file -> fit
# - multi-node job, to perform many posterior generation calculations from a fit
# - EOS ranking calculations
# - EOS likelihood on... | [
"os.mkdir",
"os.chmod",
"argparse.ArgumentParser",
"os.stat",
"os.getcwd",
"glue.pipeline.CondorDAGNode",
"glue.pipeline.CondorDAGJob",
"os.path.exists",
"numpy.genfromtxt",
"numpy.arange",
"numpy.loadtxt",
"os.path.split",
"os.path.join",
"os.access",
"sys.exit"
] | [((5559, 5584), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5582, 5584), False, 'import argparse\n'), ((7527, 7543), 'os.stat', 'os.stat', (['cmdname'], {}), '(cmdname)\n', (7534, 7543), False, 'import os\n'), ((7556, 7600), 'os.chmod', 'os.chmod', (['cmdname', '(st.st_mode | stat.S_IEXEC)'... |
import time
import numpy as np
from pyscf import fci
from benchmarking_utils import setup_logger, get_cpu_timings
log = setup_logger()
for norb in (12, 14, 16, 18):
nelec = (norb//2, norb//2)
npair = norb*(norb+1)//2
h1 = np.random.random((norb, norb))
h1 = h1 + h1.T
h2 = np.random.random(npair*(... | [
"pyscf.fci.direct_spin0.contract_2e",
"benchmarking_utils.get_cpu_timings",
"pyscf.fci.direct_spin1.contract_2e",
"numpy.random.random",
"numpy.linalg.norm",
"pyscf.fci.cistring.num_strings",
"benchmarking_utils.setup_logger"
] | [((121, 135), 'benchmarking_utils.setup_logger', 'setup_logger', ([], {}), '()\n', (133, 135), False, 'from benchmarking_utils import setup_logger, get_cpu_timings\n'), ((237, 267), 'numpy.random.random', 'np.random.random', (['(norb, norb)'], {}), '((norb, norb))\n', (253, 267), True, 'import numpy as np\n'), ((296, 3... |
import os, sys
sys.path.append(os.getcwd())
import time
import numpy as np
import tensorflow as tf
import tflib as lib
import tflib.ops.linear
import tflib.ops.conv2d
import tflib.ops.deconv2d
import tflib.save_images
import tflib.mnist
import tflib.plot
MODE = 'wgan-gp' # dcgan, wgan, or wgan-gp
DIM = 64 # Model... | [
"tensorflow.maximum",
"tensorflow.reshape",
"tensorflow.train.AdamOptimizer",
"tflib.plot.flush",
"numpy.mean",
"numpy.random.normal",
"tensorflow.nn.relu",
"tflib.plot.tick",
"tensorflow.placeholder",
"tflib.ops.linear.Linear",
"tflib.mnist.load",
"tensorflow.initialize_all_variables",
"ten... | [((2493, 2551), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[BATCH_SIZE, OUTPUT_DIM]'}), '(tf.float32, shape=[BATCH_SIZE, OUTPUT_DIM])\n', (2507, 2551), True, 'import tensorflow as tf\n'), ((2675, 2708), 'tflib.params_with_name', 'lib.params_with_name', (['"""Generator"""'], {}), "('Generato... |
""" Generate parameteric colormaps.
Diverging colormaps can be generated via Kenneth Moreland's procedure using
``generate_diverging_palette()``.
Moreland, Kenneth. Diverging Color Maps for Scientific Visualization
(Expanded).
http://www.sandia.gov/~kmorel/documents/ColorMaps/ColorMapsExpanded.pdf
<NAME>... | [
"numpy.hstack",
"numpy.sin",
"numpy.linspace",
"numpy.column_stack",
"numpy.cos",
"numpy.sqrt"
] | [((2150, 2181), 'numpy.linspace', 'np.linspace', (['(0.0)', '(1.0)', 'n_colors'], {}), '(0.0, 1.0, n_colors)\n', (2161, 2181), True, 'import numpy as np\n'), ((2432, 2509), 'numpy.hstack', 'np.hstack', (['[half1 * mmid + (1 - half1) * m1, half2 * m2 + (1 - half2) * mmid]'], {}), '([half1 * mmid + (1 - half1) * m1, half... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import numpy as np
from extensions.middle.FuseReshapesSequence import FuseReshapesSequence
from mo.graph.graph import Graph
from mo.middle.replacement import MiddleReplacementPattern
class RemoveRedundantReshape... | [
"numpy.all"
] | [((1521, 1547), 'numpy.all', 'np.all', (['(shape_1 == shape_2)'], {}), '(shape_1 == shape_2)\n', (1527, 1547), True, 'import numpy as np\n')] |
#*----------------------------------------------------------------------------*
#* Copyright (C) 2020 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... | [
"numpy.zeros"
] | [((2175, 2193), 'numpy.zeros', 'np.zeros', (['NO_tests'], {}), '(NO_tests)\n', (2183, 2193), True, 'import numpy as np\n'), ((2209, 2257), 'numpy.zeros', 'np.zeros', (['(NO_tests, NO_channels, Window_Length)'], {}), '((NO_tests, NO_channels, Window_Length))\n', (2217, 2257), True, 'import numpy as np\n')] |
import numpy as np
from psychsim.agent import Agent
from psychsim.helper_functions import get_univariate_samples, tree_from_univariate_samples
from psychsim.pwl import makeTree
from psychsim.world import World
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__description__ = 'An example of how to use the helper functions ... | [
"numpy.random.seed",
"psychsim.helper_functions.get_univariate_samples",
"psychsim.agent.Agent",
"numpy.min",
"numpy.max",
"psychsim.helper_functions.tree_from_univariate_samples",
"numpy.array",
"numpy.random.rand",
"psychsim.world.World",
"numpy.nanmean"
] | [((929, 936), 'psychsim.world.World', 'World', ([], {}), '()\n', (934, 936), False, 'from psychsim.world import World\n'), ((949, 967), 'psychsim.agent.Agent', 'Agent', (['"""The Agent"""'], {}), "('The Agent')\n", (954, 967), False, 'from psychsim.agent import Agent\n'), ((1074, 1129), 'psychsim.helper_functions.get_u... |
#!/usr/bin/env python
import argparse
import pathlib
import cv2
import h5py
import numpy as np
import pandas as pd
import scipy.io
import tqdm
def convert_pose(vector: np.ndarray) -> np.ndarray:
rot = cv2.Rodrigues(np.array(vector).astype(np.float32))[0]
vec = rot[:, 2]
pitch = np.arcsin(vec[1])
yaw... | [
"numpy.save",
"numpy.arctan2",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.arcsin",
"cv2.blur",
"pathlib.Path",
"numpy.array"
] | [((295, 312), 'numpy.arcsin', 'np.arcsin', (['vec[1]'], {}), '(vec[1])\n', (304, 312), True, 'import numpy as np\n'), ((323, 349), 'numpy.arctan2', 'np.arctan2', (['vec[0]', 'vec[2]'], {}), '(vec[0], vec[2])\n', (333, 349), True, 'import numpy as np\n'), ((490, 503), 'numpy.arcsin', 'np.arcsin', (['(-y)'], {}), '(-y)\n... |
from fastlogranktest import logrank_test
import numpy as np
def find_split(node):
"""
Find the best split for a Node.
:param node: Node to find best split for.
:return: score of best split, value of best split, variable to split, left indices, right indices.
"""
score_opt = 0
split_val_opt ... | [
"numpy.array",
"fastlogranktest.logrank_test"
] | [((2262, 2291), 'numpy.array', 'np.array', (['y.iloc[feature1, 1]'], {}), '(y.iloc[feature1, 1])\n', (2270, 2291), True, 'import numpy as np\n'), ((2319, 2348), 'numpy.array', 'np.array', (['y.iloc[feature1, 0]'], {}), '(y.iloc[feature1, 0])\n', (2327, 2348), True, 'import numpy as np\n'), ((2371, 2400), 'numpy.array',... |
"""
Generate a PDF of a given quantity also accounting for boostrap errors
"""
from __future__ import print_function, absolute_import, division, unicode_literals
#some global staff first
import glob
import pickle
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
matplotlib.rcParams.update({'font.s... | [
"h5py.File",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.rcParams.update",
"numpy.zeros",
"numpy.percentile",
"numpy.histogram",
"numpy.where",
"numpy.array",
"numpy.arange",
"numpy.min",
"glob.glob",
"numpy.max",
"xastropy.xutils.xdebug.set_trace",
"numpy.random.rand... | [((285, 330), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 16}"], {}), "({'font.size': 16})\n", (311, 330), False, 'import matplotlib\n'), ((3381, 3417), 'astropy.table.Table.read', 'Table.read', (['data_fil'], {'format': '"""ascii"""'}), "(data_fil, format='ascii')\n", (3391, 3417), Fal... |
#!/usr/bin/env python3
###############################################################################
# #
# RMG - Reaction Mechanism Generator #
# ... | [
"os.mkdir",
"scipy.interpolate.CubicSpline",
"numpy.argsort",
"os.path.isfile",
"numpy.isclose",
"numpy.linalg.norm",
"numpy.exp",
"os.path.join",
"numpy.prod",
"subprocess.check_call",
"numdifftools.Hessian",
"os.path.dirname",
"numpy.linspace",
"scipy.integrate.simps",
"arkane.ess.fact... | [((3922, 3986), 'os.path.join', 'os.path.join', (['rmg_path', '"""external"""', '"""Q2DTor"""', '"""src"""', '"""Q2DTor.py"""'], {}), "(rmg_path, 'external', 'Q2DTor', 'src', 'Q2DTor.py')\n", (3934, 3986), False, 'import os\n'), ((4692, 4717), 'rmgpy.statmech.mode.Mode.__init__', 'Mode.__init__', (['self', '(True)'], {... |
import unittest
import numpy as np
import torch
from utils.dataset import collate_tts
class TestDataset(unittest.TestCase):
def test_collate_tts(self) -> None:
items = [
{
'item_id': 0,
'mel': np.full((2, 5), fill_value=1.),
'x': np.full(2, fil... | [
"numpy.full",
"utils.dataset.collate_tts",
"torch.sum"
] | [((960, 983), 'utils.dataset.collate_tts', 'collate_tts', (['items'], {'r': '(1)'}), '(items, r=1)\n', (971, 983), False, 'from utils.dataset import collate_tts\n'), ((253, 284), 'numpy.full', 'np.full', (['(2, 5)'], {'fill_value': '(1.0)'}), '((2, 5), fill_value=1.0)\n', (260, 284), True, 'import numpy as np\n'), ((30... |
import xarray as _xr
import pathlib as _pl
import numpy as _np
# import cartopy.crs as ccrs
# import metpy
# from scipy import interpolate
# from datetime import datetime, timedelta
from mpl_toolkits.basemap import Basemap as _Basemap
from pyproj import Proj as _Proj
import urllib as _urllib
from pyquery import PyQuer... | [
"numpy.clip",
"numpy.isnan",
"pathlib.Path",
"matplotlib.pyplot.gca",
"pandas.DataFrame",
"numpy.meshgrid",
"numpy.insert",
"numpy.dstack",
"functools.partial",
"os.system",
"numpy.isinf",
"xarray.concat",
"pandas.to_datetime",
"numpy.cos",
"multiprocessing.Pool",
"xarray.open_mfdatase... | [((32743, 32783), 'numba.jit', '_numba.jit', ([], {'nopython': '(True)', 'fastmath': '(True)'}), '(nopython=True, fastmath=True)\n', (32753, 32783), True, 'import numba as _numba\n'), ((572, 593), 'xarray.open_dataset', '_xr.open_dataset', (['p2f'], {}), '(p2f)\n', (588, 593), True, 'import xarray as _xr\n'), ((32895, ... |
import dgl
import backend as F
import numpy as np
import unittest
from collections import defaultdict
def check_random_walk(g, metapath, traces, ntypes, prob=None, trace_eids=None):
traces = F.asnumpy(traces)
ntypes = F.asnumpy(ntypes)
for j in range(traces.shape[1] - 1):
assert ntypes[j] == g.get_... | [
"backend.asnumpy",
"dgl.graph",
"dgl.sampling.select_topk",
"backend.ctx",
"unittest.skipIf",
"dgl.sort_csr_by_tag",
"numpy.random.choice",
"backend.ones",
"dgl.sampling.sample_neighbors",
"dgl.sampling.node2vec_random_walk",
"backend.zerocopy_from_numpy",
"dgl.heterograph",
"backend.tensor"... | [((1076, 1171), 'unittest.skipIf', 'unittest.skipIf', (["(F._default_context_str == 'gpu')"], {'reason': '"""GPU random walk not implemented"""'}), "(F._default_context_str == 'gpu', reason=\n 'GPU random walk not implemented')\n", (1091, 1171), False, 'import unittest\n'), ((5458, 5553), 'unittest.skipIf', 'unittes... |
import numpy as np
import pandas as pd
from numpy.random import randn
np.random.seed(101)
df = pd.DataFrame(randn(5, 4), ['A', 'B', 'C', 'D', 'E'], ['W', 'X', 'Y', 'Z'])
print(df)
print(df['W'])
print(type(df['W']))
print(type(df))
print(df.W) # Don't use this
print(df[['W', 'Z']])
# ----- Create a new column (new ... | [
"numpy.random.seed",
"numpy.random.randn"
] | [((72, 91), 'numpy.random.seed', 'np.random.seed', (['(101)'], {}), '(101)\n', (86, 91), True, 'import numpy as np\n'), ((111, 122), 'numpy.random.randn', 'randn', (['(5)', '(4)'], {}), '(5, 4)\n', (116, 122), False, 'from numpy.random import randn\n')] |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
from sklearn.linear_model import LinearRegression,Ridge
subscriptions = pd.read_csv("subscription.csv",index_col='user_id')
del subscriptions['subscription_signup_date']
subscriptions.rename(columns={'subscription_monthly_c... | [
"numpy.log",
"pandas.read_csv",
"pandas.merge",
"matplotlib.pyplot.style.use",
"numpy.arange",
"sklearn.linear_model.Ridge"
] | [((72, 95), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (85, 95), True, 'import matplotlib.pyplot as plt\n'), ((169, 221), 'pandas.read_csv', 'pd.read_csv', (['"""subscription.csv"""'], {'index_col': '"""user_id"""'}), "('subscription.csv', index_col='user_id')\n", (180, 221)... |
import os
from skimage import data, img_as_float, io, img_as_uint
from skimage.viewer import ImageViewer
from skimage.viewer.qt import QtGui, QtCore, has_qt
from skimage.viewer.widgets import (
Slider, OKCancelButtons, SaveButtons, ComboBox, CheckBox, Text)
from skimage.viewer.plugins.base import Plugin
from num... | [
"os.remove",
"skimage.viewer.qt.QtCore.QTimer",
"os.close",
"skimage.img_as_float",
"skimage.viewer.widgets.OKCancelButtons",
"skimage.data.imread",
"skimage.viewer.plugins.base.Plugin",
"numpy.testing.assert_almost_equal",
"numpy.testing.decorators.skipif",
"numpy.testing.assert_equal",
"skimag... | [((613, 631), 'numpy.testing.decorators.skipif', 'skipif', (['(not has_qt)'], {}), '(not has_qt)\n', (619, 631), False, 'from numpy.testing.decorators import skipif\n'), ((950, 968), 'numpy.testing.decorators.skipif', 'skipif', (['(not has_qt)'], {}), '(not has_qt)\n', (956, 968), False, 'from numpy.testing.decorators ... |
# BSD 2-Clause License
#
# Copyright (c) 2021-2022, Hewlett Packard Enterprise
# 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 must retain the above copyright... | [
"os.path.abspath",
"smartredis.Client",
"numpy.testing.assert_array_equal",
"torch.cat",
"numpy.array",
"inspect.getsource",
"os.path.join"
] | [((1512, 1533), 'os.path.abspath', 'osp.abspath', (['__file__'], {}), '(__file__)\n', (1523, 1533), True, 'import os.path as osp\n'), ((1585, 1610), 'smartredis.Client', 'Client', (['None', 'use_cluster'], {}), '(None, use_cluster)\n', (1591, 1610), False, 'from smartredis import Client\n'), ((1728, 1757), 'inspect.get... |
import os
import sys
sys.path.append(os.environ['d'])
import tensorflow_addons as ta
from tensorflow_addons.shared import *
import build_access_model_flatten
import build_access_model_lstm
import build_access_model_sep
from tensorflow.keras.callbacks import ReduceLROnPlateau, EarlyStopping
import numpy as np
from sklea... | [
"sys.path.append",
"os.makedirs",
"build_access_model_flatten.build_model",
"build_access_model_lstm.build_model",
"tensorflow.keras.callbacks.ReduceLROnPlateau",
"numpy.savetxt",
"os.path.exists",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.f1_score",
"build_access_model_sep.build_model",
... | [((21, 53), 'sys.path.append', 'sys.path.append', (["os.environ['d']"], {}), "(os.environ['d'])\n", (36, 53), False, 'import sys\n'), ((3635, 3711), 'tensorflow.keras.callbacks.ReduceLROnPlateau', 'ReduceLROnPlateau', ([], {'monitor': '"""val_loss"""', 'factor': '(0.2)', 'patience': 'reduceLRpatience'}), "(monitor='val... |
import numpy as np
class Metric:
def __init__(self):
pass
def __call__(self, loss):
raise NotImplementedError
def reset(self):
raise NotImplementedError
def value(self):
raise NotImplementedError
def name(self):
raise NotImplementedError... | [
"numpy.mean"
] | [((1436, 1456), 'numpy.mean', 'np.mean', (['self.values'], {}), '(self.values)\n', (1443, 1456), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 13 21:35:40 2020
@author: ning
"""
import os
import mne
import utils
from glob import glob
from tqdm import tqdm
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
sns.set_style('white')
if __name__ == "__main__":
... | [
"utils.Filter_based_and_thresholding",
"seaborn.set_style",
"os.mkdir",
"numpy.concatenate",
"os.path.exists",
"numpy.array",
"os.path.join",
"utils.download_EEG_annotation"
] | [((267, 289), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (280, 289), True, 'import seaborn as sns\n'), ((821, 886), 'os.path.join', 'os.path.join', (['info_for_all_subjects_dir', '"""available_subjects.csv"""'], {}), "(info_for_all_subjects_dir, 'available_subjects.csv')\n", (833, 886),... |
import numpy as np
import re
def state_space_regression(xt, ut):
"""
The equation we want to solve is:
| x1' u1' | | x2' |
| x2' u2' | | A' | | x3' |
| x3' u3' | | | = | x4' |
| ......... | | B' | | ... |
| xn-1' un-1' | | xn... | [
"re.finditer",
"numpy.linalg.lstsq",
"numpy.hstack"
] | [((2401, 2440), 'numpy.hstack', 'np.hstack', (['(position[:-1, :], velocity)'], {}), '((position[:-1, :], velocity))\n', (2410, 2440), True, 'import numpy as np\n'), ((523, 542), 'numpy.hstack', 'np.hstack', (['(xt, ut)'], {}), '((xt, ut))\n', (532, 542), True, 'import numpy as np\n'), ((625, 660), 'numpy.linalg.lstsq'... |
"""Define general test helper attributes and utilities."""
import ast
import contextlib
import functools
import http.server
import importlib
import inspect
import io
import pkgutil
import socketserver
import sys
import tempfile
import threading
import numpy as np
import pytest
from moviepy.video.io.VideoFileClip im... | [
"threading.Thread",
"io.StringIO",
"pkgutil.walk_packages",
"importlib.import_module",
"tempfile.gettempdir",
"socketserver.TCPServer",
"moviepy.video.io.VideoFileClip.VideoFileClip",
"ast.NodeVisitor.generic_visit",
"numpy.sin",
"inspect.getsource",
"functools.lru_cache"
] | [((351, 372), 'tempfile.gettempdir', 'tempfile.gettempdir', ([], {}), '()\n', (370, 372), False, 'import tempfile\n'), ((761, 794), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (780, 794), False, 'import functools\n'), ((945, 978), 'functools.lru_cache', 'functools.lru_ca... |
import numpy as np
import os
import sys
import torch
sys.path.append('.')
from lib.data.datasets.veri import VeRi
from lib.data.datasets.aicity20_trainval import AICity20Trainval
from lib.utils.post_process import build_track_lookup, re_ranking
def generate_track_results(distmat, tracks, topk=100):
indice = np.a... | [
"sys.path.append",
"lib.data.datasets.veri.VeRi",
"numpy.load",
"os.path.basename",
"numpy.asarray",
"numpy.argsort",
"numpy.any",
"numpy.mean",
"numpy.array"
] | [((54, 74), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (69, 74), False, 'import sys\n'), ((316, 343), 'numpy.argsort', 'np.argsort', (['distmat'], {'axis': '(1)'}), '(distmat, axis=1)\n', (326, 343), True, 'import numpy as np\n'), ((912, 932), 'numpy.array', 'np.array', (['query_pids'], {}), '(... |
'''----------------------------------------------
-------------------------------------------------
IMPORTS
-------------------------------------------------
----------------------------------------------'''
#import threading
import numpy as np
import cv2
'''----------------------------------------------
-----------... | [
"cv2.line",
"cv2.boundingRect",
"cv2.findContours",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.threshold",
"cv2.imshow",
"cv2.blur",
"cv2.VideoCapture",
"numpy.array",
"cv2.convexHull",
"cv2.rectangle",
"cv2.drawContours",
"cv2.destroyAllWindows",
"cv2.inRange",
"cv2.namedWindow"
] | [((3631, 3650), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (3647, 3650), False, 'import cv2\n'), ((3791, 3820), 'cv2.namedWindow', 'cv2.namedWindow', (['"""GroupSynth"""'], {}), "('GroupSynth')\n", (3806, 3820), False, 'import cv2\n'), ((9246, 9269), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows'... |
__author__ = 'marble_xu'
import pygame as pg
import numpy as np
from source import constants as c
from source import tools
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
# Fix random seed for reproducibility
seed = np.random.randint(0, 10_000)
np.random.seed(seed)
print("random seed:", seed)
pg.in... | [
"numpy.random.seed",
"pygame.display.set_mode",
"os.path.realpath",
"pygame.init",
"pygame.event.set_allowed",
"numpy.random.randint",
"pygame.display.set_caption",
"os.path.join"
] | [((236, 263), 'numpy.random.randint', 'np.random.randint', (['(0)', '(10000)'], {}), '(0, 10000)\n', (253, 263), True, 'import numpy as np\n'), ((265, 285), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (279, 285), True, 'import numpy as np\n'), ((315, 324), 'pygame.init', 'pg.init', ([], {}), '()\... |
# To make forward fast
import os
os.environ["CHAINER_TYPE_CHECK"] = "0"
import six
import itertools
import numpy as np
import chainer
from chainer import serializers
from chainer import cuda
import nutszebra_log2
import nutszebra_utility
import nutszebra_sampling
import nutszebra_load_ilsvrc_object_localization
import ... | [
"numpy.empty",
"nutszebra_log2.Log2",
"six.moves.zip",
"nutszebra_utility.Utility",
"cupy.cuda.nccl.NcclCommunicator",
"chainer.cuda.cupy.ElementwiseKernel",
"chainer.serializers.load_npz",
"six.moves.range",
"cupy.cuda.nccl.get_unique_id",
"multiprocessing.Pipe",
"itertools.product",
"chainer... | [((634, 695), 'nutszebra_data_augmentation_picture.DataAugmentationPicture', 'nutszebra_data_augmentation_picture.DataAugmentationPicture', ([], {}), '()\n', (693, 695), False, 'import nutszebra_data_augmentation_picture\n'), ((745, 772), 'nutszebra_utility.Utility', 'nutszebra_utility.Utility', ([], {}), '()\n', (770,... |
# coding=utf-8
# Copyright (C) 2020 NumS Development Team.
#
# 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... | [
"nums.core.array.blockarray.BlockArray.to_block_array",
"nums.core.array.blockarray.BlockArray.from_oid",
"numpy.sum",
"nums.core.storage.storage.StoredArrayS3",
"nums.core.array.utils.is_array_like",
"nums.core.array.random.NumsRandomState",
"nums.core.array.utils.broadcast_shape",
"numpy.__getattrib... | [((2908, 2923), 'numpy.any', 'np.any', (['results'], {}), '(results)\n', (2914, 2923), True, 'import numpy as np\n'), ((3649, 3681), 'nums.core.array.blockarray.BlockArray', 'BlockArray', (['result_grid', 'self.cm'], {}), '(result_grid, self.cm)\n', (3659, 3681), False, 'from nums.core.array.blockarray import BlockArra... |
#!/usr/bin/env python
# coding: utf-8
# [1]
# %qtconsole
# [2]
from IPython.core.display import HTML
# def css_styling():
# styles = open("styles/custom.css", "r").read()
# return HTML(styles)
#
#
# css_styling()
# [3]
import numpy as np
import matplotlib.pyplot as plt
import json
#s = json.load(open... | [
"matplotlib.patches.Rectangle",
"numpy.mean",
"numpy.array",
"numpy.sin",
"numpy.cos",
"numpy.random.rand",
"matplotlib.pyplot.subplots"
] | [((4721, 4739), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(2)'], {}), '(1, 2)\n', (4733, 4739), True, 'import matplotlib.pyplot as plt\n'), ((8508, 8522), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (8520, 8522), True, 'import matplotlib.pyplot as plt\n'), ((12088, 12102), 'matplotlib.... |
#!/usr/bin/env python
# Copyright 2014-2018 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... | [
"numpy.random.seed",
"ctypes.c_double",
"ctypes.c_int",
"numpy.empty",
"numpy.allclose",
"numpy.einsum",
"pyscf.lib.c_null_ptr",
"pyscf.gto.ecp.so_by_shell",
"numpy.linalg.norm",
"numpy.arange",
"numpy.exp",
"unittest.main",
"numpy.zeros_like",
"numpy.empty_like",
"pyscf.gto.ecp.type1_by... | [((2530, 2549), 'numpy.dot', 'numpy.dot', (['rca', 'rca'], {}), '(rca, rca)\n', (2539, 2549), False, 'import numpy\n'), ((2595, 2614), 'numpy.dot', 'numpy.dot', (['rcb', 'rcb'], {}), '(rcb, rcb)\n', (2604, 2614), False, 'import numpy\n'), ((2849, 2873), 'pyscf.dft.radi.gauss_chebyshev', 'radi.gauss_chebyshev', (['(99)'... |
# coding=utf-8
from joblib import Parallel, delayed
import shutil
import scipy.io
import librosa
import os
import time
import numpy as np
import numpy.matlib
import random
import subprocess
import glob
import torch
import torch.nn as nn
from audio_util import *
from pystoi.stoi import stoi
from model import Generat... | [
"torch.nn.MSELoss",
"random.shuffle",
"numpy.asarray",
"torch.load",
"model.Generator_Conv1D_cLN",
"numpy.mean",
"random.seed",
"librosa.load",
"torch.pow",
"soundfile.write",
"model.Discriminator",
"torch.no_grad",
"torch.sum",
"torch.from_numpy"
] | [((431, 447), 'random.seed', 'random.seed', (['(666)'], {}), '(666)\n', (442, 447), False, 'import random\n'), ((636, 658), 'numpy.asarray', 'np.asarray', (['[1.0, 1.0]'], {}), '([1.0, 1.0])\n', (646, 658), True, 'import numpy as np\n'), ((1552, 1588), 'random.shuffle', 'random.shuffle', (['Generator_Test_paths'], {}),... |
from scipy.stats import spearmanr
import sys
import numpy as np
# Similarity benchmark evaluation
def eval_queryset(vsm, queryset, pos_filter=None, verbose=False):
gold_scores = []
predicted_scores = []
for w1, w2, pos in queryset.queries:
if pos_filter is None or pos_filter == pos:
go... | [
"scipy.stats.spearmanr",
"numpy.zeros"
] | [((676, 716), 'scipy.stats.spearmanr', 'spearmanr', (['gold_scores', 'predicted_scores'], {}), '(gold_scores, predicted_scores)\n', (685, 716), False, 'from scipy.stats import spearmanr\n'), ((2921, 2936), 'numpy.zeros', 'np.zeros', (['max_k'], {}), '(max_k)\n', (2929, 2936), True, 'import numpy as np\n')] |
'''
Utilities for QFTPy.
by z0gSh1u @ github.com/z0gSh1u/qftpy
'''
__all__ = ['unit', 'isPure', 'isScalarQ', 'dotProduct', 'crossProduct', 'isParallel', 'qzeros', 'qones', 'ALL_ONE_AXIS']
import numpy as np
import quaternion
EPS = np.finfo(np.float32).eps # quaternion library internal uses float64. We ... | [
"numpy.abs",
"numpy.zeros",
"numpy.ones",
"numpy.finfo",
"numpy.min",
"numpy.array",
"numpy.quaternion"
] | [((360, 385), 'numpy.quaternion', 'np.quaternion', (['(0)', '(1)', '(0)', '(0)'], {}), '(0, 1, 0, 0)\n', (373, 385), True, 'import numpy as np\n'), ((395, 420), 'numpy.quaternion', 'np.quaternion', (['(0)', '(0)', '(1)', '(0)'], {}), '(0, 0, 1, 0)\n', (408, 420), True, 'import numpy as np\n'), ((430, 455), 'numpy.quate... |
#MIT License
#Created by <NAME> on 22/09/20.
#Copyright (c) 2020 <NAME>
#https://github.com/dachii-azm/
#
import cv2
import numpy as np
from pylsd.lsd import lsd
class Book_Extractor():
AREA_THRESHOLD = 1000
IMAGE_SIZE_W = 200
LINE_THRESHOLD = 5000
def __init__(self, img_name):
self.img_name... | [
"cv2.GaussianBlur",
"cv2.getPerspectiveTransform",
"cv2.imshow",
"numpy.unique",
"cv2.line",
"cv2.warpPerspective",
"cv2.cvtColor",
"cv2.imwrite",
"cv2.destroyAllWindows",
"pylsd.lsd.lsd",
"cv2.circle",
"cv2.waitKey",
"numpy.dot",
"numpy.vstack",
"numpy.float32",
"cv2.imread",
"numpy... | [((376, 401), 'cv2.imread', 'cv2.imread', (['self.img_name'], {}), '(self.img_name)\n', (386, 401), False, 'import cv2\n'), ((652, 689), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (664, 689), False, 'import cv2\n'), ((705, 738), 'cv2.GaussianBlur', 'cv2.GaussianB... |
import os
import tempfile
import glob
import time
import random
import copy
from datetime import datetime
import tempfile
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd as A
from torch.utils.data import DataLoader, Subset,... | [
"wandb.log",
"numpy.random.seed",
"numpy.sum",
"torch.autograd.grad",
"collections.defaultdict",
"numpy.mean",
"vision.utils.sailPreprocess",
"torch.no_grad",
"os.path.join",
"torch.utils.data.DataLoader",
"vision.data_process.loadImageNet",
"torch.load",
"os.path.exists",
"torch.optim.lr_... | [((21947, 22001), 'hydra.main', 'hydra.main', ([], {'config_path': '"""config"""', 'config_name': '"""config"""'}), "(config_path='config', config_name='config')\n", (21957, 22001), False, 'import hydra\n'), ((22080, 22102), 'vision.utils.sailPreprocess', 'utils.sailPreprocess', ([], {}), '()\n', (22100, 22102), True, ... |
import sys
import math
import numpy
import typing
import ctypes
import os
cwd = os.path.abspath( os.path.dirname( __file__ ) ) + os.sep
def fake_cs( self: object, step: int ):
pass
def steepest_descent( mol: object,
step_number: typing.Optional[int] = 100,
step_size: typing.Optional[floa... | [
"numpy.sum",
"ctypes.c_double",
"ctypes.c_int",
"math.sqrt",
"math.fabs",
"os.path.dirname",
"numpy.zeros",
"numpy.ones",
"numpy.argsort",
"numpy.linalg.eigh",
"numpy.fabs",
"numpy.linalg.norm",
"numpy.sign",
"numpy.dot",
"numpy.sqrt",
"ctypes.CDLL",
"ctypes.POINTER"
] | [((1040, 1054), 'math.sqrt', 'math.sqrt', (['ndf'], {}), '(ndf)\n', (1049, 1054), False, 'import math\n'), ((1087, 1114), 'numpy.linalg.norm', 'numpy.linalg.norm', (['mol.grad'], {}), '(mol.grad)\n', (1104, 1114), False, 'import numpy\n'), ((3763, 3778), 'math.sqrt', 'math.sqrt', (['ndeg'], {}), '(ndeg)\n', (3772, 3778... |
import numpy as np
import nose.tools as nt
from ...tests.instance import gaussian_instance as instance
from ..lasso import lasso
from ..debiased_lasso import (debiased_lasso_inference,
_find_row_approx_inverse_X,
debiasing_matrix)
# for regreg implementatio... | [
"regreg.api.quadratic_loss",
"numpy.log",
"rpy2.robjects.numpy2ri.activate",
"regreg.api.identity_quadratic",
"regreg.api.simple_problem",
"numpy.zeros",
"rpy2.robjects.r",
"numpy.ones",
"numpy.sign",
"numpy.random.standard_normal",
"rpy2.robjects.r.assign",
"numpy.array",
"numpy.arange",
... | [((2592, 2679), 'numpy.testing.dec.skipif', 'np.testing.dec.skipif', (['(not rpy2_available)'], {'msg': '"""rpy2 not available, skipping test"""'}), "(not rpy2_available, msg=\n 'rpy2 not available, skipping test')\n", (2613, 2679), True, 'import numpy as np\n'), ((604, 640), 'rpy2.robjects.r', 'rpy.r', (['"""librar... |
import numpy as np
def running_mean(x, N, mode='same'):
"""Efficient computation of running mean, that doesn't use convolve, which is slow
Parameters
----------
x: input signal
N: length of window
mode: {'same'}, 'valid'
same: Pad that output signal so that it matches the shape of the... | [
"numpy.ceil",
"numpy.floor",
"numpy.zeros",
"numpy.searchsorted",
"numpy.ones",
"numpy.insert",
"numpy.hstack",
"numpy.where",
"numpy.array",
"numpy.convolve",
"numpy.vstack"
] | [((2094, 2111), 'numpy.array', 'np.array', (['tbounds'], {}), '(tbounds)\n', (2102, 2111), True, 'import numpy as np\n'), ((2121, 2133), 'numpy.array', 'np.array', (['tt'], {}), '(tt)\n', (2129, 2133), True, 'import numpy as np\n'), ((2144, 2176), 'numpy.zeros', 'np.zeros', (['tt.shape'], {'dtype': '"""bool"""'}), "(tt... |
# The network design is based on <NAME> & <NAME>'s works:
# https://github.com/tinghuiz/SfMLearner/blob/master/nets.py
# https://github.com/mrharicot/monodepth/blob/master/monodepth_model.py
from __future__ import division
import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np
# Range of dis... | [
"tensorflow.contrib.slim.conv2d",
"tensorflow.nn.relu",
"tensorflow.image.resize_nearest_neighbor",
"numpy.floor",
"tensorflow.pad",
"tensorflow.reduce_mean",
"tensorflow.variable_scope",
"tensorflow.concat",
"tensorflow.reshape",
"tensorflow.shape",
"numpy.int",
"tensorflow.contrib.slim.max_p... | [((11144, 11187), 'tensorflow.pad', 'tf.pad', (['x', '[[0, 0], [p, p], [p, p], [0, 0]]'], {}), '(x, [[0, 0], [p, p], [p, p], [0, 0]])\n', (11150, 11187), True, 'import tensorflow as tf\n'), ((11269, 11393), 'tensorflow.contrib.slim.conv2d', 'slim.conv2d', (['p_x', 'num_out_layers', 'kernel_size', 'stride', '"""VALID"""... |
import chaospy as cp
import numpy as np
import easyvvuq as uq
import matplotlib.pyplot as plt
import os
import fabsim3_cmd_api as fab
import pandas as pd
from sklearn.neighbors.kde import KernelDensity
from scipy import stats
# author: <NAME>
__license__ = "LGPL"
#home directory of user
home = os.path.expanduser('~')... | [
"fabsim3_cmd_api.get_uq_samples",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"numpy.exp",
"matplotlib.pyplot.tight_layout",
"sklearn.neighbors.kde.KernelDensity",
"os.path.dirname",
"numpy.max",
"numpy.linspace",
"matplotlib.pyplot.show",
"pandas.DataFrame.from_dict",
"matplotlib.pyplot.le... | [((297, 320), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (315, 320), False, 'import os\n'), ((6651, 6661), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (6659, 6661), True, 'import matplotlib.pyplot as plt\n'), ((723, 809), 'pandas.read_csv', 'pd.read_csv', (["(run_dir + '/outpu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import chainer
from chainer import cuda
from chainer import computational_graph
import six
import time
import numpy as np
from chainer import serializers
from cnn_model import CGP2CNN
# __init__: load dataset
# __call__: training the CNN defined by CGP list
class CNN_tr... | [
"numpy.random.seed",
"numpy.random.randint",
"chainer.serializers.save_npz",
"chainer.computational_graph.build_computational_graph",
"numpy.zeros_like",
"traceback.print_exc",
"six.moves.range",
"chainer.serializers.load_npz",
"chainer.datasets.get_cifar100",
"numpy.max",
"chainer.datasets.get_... | [((4088, 4114), 'cnn_model.CGP2CNN', 'CGP2CNN', (['cgp', 'self.n_class'], {}), '(cgp, self.n_class)\n', (4095, 4114), False, 'from cnn_model import CGP2CNN\n'), ((4554, 4589), 'numpy.min', 'np.min', (['(eval_epoch_num, epoch_num)'], {}), '((eval_epoch_num, epoch_num))\n', (4560, 4589), True, 'import numpy as np\n'), ((... |
#!/usr/bin/env python
# coding: utf-8
import hashlib
import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import math, copy
from torch.autograd import Variable
import pandas as pd
import re
from tqdm import trange
from time import time
from keras.preprocessing.sequence impor... | [
"torch.nn.Dropout",
"torch.utils.data.RandomSampler",
"keras.preprocessing.sequence.pad_sequences",
"torch.nn.Embedding",
"numpy.ones",
"collections.defaultdict",
"torch.cos",
"numpy.mean",
"numpy.arange",
"torch.arange",
"torch.no_grad",
"os.path.join",
"pandas.DataFrame",
"torch.ones",
... | [((5813, 5838), 'torch.nn.functional.softmax', 'F.softmax', (['scores'], {'dim': '(-1)'}), '(scores, dim=-1)\n', (5822, 5838), True, 'import torch.nn.functional as F\n'), ((1768, 1798), 'torch.nn.Linear', 'nn.Linear', (['self.d_model', 'vocab'], {}), '(self.d_model, vocab)\n', (1777, 1798), True, 'import torch.nn as nn... |
#! /usr/bin/env python
import sys
import copy
import rospy
import moveit_commander
import moveit_msgs.msg
import geometry_msgs.msg
import numpy
from math import pi
from std_msgs.msg import String, Int8, Bool
from moveit_commander.conversions import pose_to_list
from geometry_msgs.msg import Pose
from sensor_msgs.msg im... | [
"std_msgs.msg.MultiArrayDimension",
"moveit_commander.RobotCommander",
"rospy.Subscriber",
"moveit_commander.PlanningSceneInterface",
"moveit_commander.MoveGroupCommander",
"rospy.Publisher",
"rospy.sleep",
"numpy.nonzero",
"rospy.is_shutdown",
"rospy.init_node",
"numpy.reshape",
"moveit_comma... | [((3058, 3102), 'moveit_commander.roscpp_initialize', 'moveit_commander.roscpp_initialize', (['sys.argv'], {}), '(sys.argv)\n', (3092, 3102), False, 'import moveit_commander\n'), ((3112, 3141), 'rospy.init_node', 'rospy.init_node', (['"""validation"""'], {}), "('validation')\n", (3127, 3141), False, 'import rospy\n'), ... |
# 计算线性代数
import tensorflow as tf
import numpy as np #科学计算模块
# create data, X数据是100
x_data = np.random.rand(100).astype(np.float32) # 生成100个随机数列
y_data = x_data*0.5 + 0.8 #线性函数(二元一次方程) 其中0.1为weight, 0.3为biases
# 创建结构
Weights = tf.Variable(tf.random_uniform([1], -1.0, 1.0)) # tf.Variable定义变量, 生成一个从-1到1的随机数
biases ... | [
"tensorflow.random_uniform",
"tensorflow.global_variables_initializer",
"tensorflow.Session",
"tensorflow.zeros",
"tensorflow.square",
"numpy.random.rand",
"tensorflow.train.GradientDescentOptimizer"
] | [((464, 502), 'tensorflow.train.GradientDescentOptimizer', 'tf.train.GradientDescentOptimizer', (['(0.1)'], {}), '(0.1)\n', (497, 502), True, 'import tensorflow as tf\n'), ((564, 597), 'tensorflow.global_variables_initializer', 'tf.global_variables_initializer', ([], {}), '()\n', (595, 597), True, 'import tensorflow as... |
import pickle
import matplotlib.pyplot as plt
import numpy as np
from keras.layers import (Dense, Conv2D, MaxPool2D,
Flatten)
from keras.models import Sequential
from keras.optimizers import Adam
from keras.preprocessing.image import ImageDataGenerator
from sklearn.metrics import classificat... | [
"keras.preprocessing.image.ImageDataGenerator",
"sklearn.metrics.confusion_matrix",
"matplotlib.pyplot.show",
"numpy.argmax",
"keras.layers.MaxPool2D",
"keras.layers.Flatten",
"keras.optimizers.Adam",
"sklearn.metrics.classification_report",
"keras.layers.Dense",
"keras.layers.Conv2D",
"matplotl... | [((1633, 1685), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'validation_split': 'split'}), '(validation_split=split, **kwargs)\n', (1651, 1685), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((3507, 3535), 'keras.preprocessing.image.ImageDataGenerator', 'ImageData... |
# %%
import numpy as np
import pandas as pd
from scipy import sparse
import re
sys.path.insert(0, "..")
import ent2id
entity_table_name = "sample-grid.csv"
model = ent2id.Ent2Id(aggregate_duplicates = False)
for df in pd.read_csv("sample-grid.csv", chunksize=5000):
model.partial_fit(df["Name"].values, df["ID"].va... | [
"pandas.read_csv",
"ent2id.Ent2Id",
"numpy.sum"
] | [((166, 207), 'ent2id.Ent2Id', 'ent2id.Ent2Id', ([], {'aggregate_duplicates': '(False)'}), '(aggregate_duplicates=False)\n', (179, 207), False, 'import ent2id\n'), ((220, 266), 'pandas.read_csv', 'pd.read_csv', (['"""sample-grid.csv"""'], {'chunksize': '(5000)'}), "('sample-grid.csv', chunksize=5000)\n", (231, 266), Tr... |
# MIT License
#
# Copyright (C) IBM Corporation 2019
#
# 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
# rights to use, copy, modify, merge... | [
"diffprivlib.utils.copy_docstring",
"numpy.log",
"numpy.random.gamma",
"numpy.linalg.norm",
"numpy.exp",
"numpy.random.normal",
"numpy.dot"
] | [((6529, 6565), 'diffprivlib.utils.copy_docstring', 'copy_docstring', (['DPMechanism.get_bias'], {}), '(DPMechanism.get_bias)\n', (6543, 6565), False, 'from diffprivlib.utils import copy_docstring\n'), ((6637, 6677), 'diffprivlib.utils.copy_docstring', 'copy_docstring', (['DPMechanism.get_variance'], {}), '(DPMechanism... |
# Copyright 2020 The PyMC Developers
#
# 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 ag... | [
"numpy.empty",
"pymc.model.modelcontext",
"pymc.aesaraf.join_nonshared_inputs",
"numpy.ones",
"numpy.isnan",
"numpy.random.default_rng",
"numpy.mean",
"aesara.graph.basic.clone_replace",
"numpy.exp",
"scipy.special.logsumexp",
"numpy.arange",
"aesara.tensor.round",
"numpy.round",
"numpy.at... | [((23070, 23122), 'pymc.aesaraf.join_nonshared_inputs', 'join_nonshared_inputs', (['point', 'out_vars', 'vars', 'shared'], {}), '(point, out_vars, vars, shared)\n', (23091, 23122), False, 'from pymc.aesaraf import compile_rv_inplace, floatX, inputvars, join_nonshared_inputs, make_shared_replacements\n'), ((23131, 23174... |
import os
from glob import glob
from spellpy import spell
import pandas as pd
import numpy as np
from datetime import datetime
from datetime import timedelta
if __name__ == '__main__':
input_dir = './data'
output_dir = './result'
log_format = '<Date> <Time>,<Content>'
tau = 0.5
parser = spell.LogP... | [
"os.makedirs",
"os.path.basename",
"pandas.read_csv",
"os.path.exists",
"datetime.datetime.strptime",
"numpy.array",
"datetime.timedelta",
"glob.glob",
"spellpy.spell.LogParser"
] | [((310, 397), 'spellpy.spell.LogParser', 'spell.LogParser', ([], {'indir': 'input_dir', 'outdir': 'output_dir', 'log_format': 'log_format', 'tau': 'tau'}), '(indir=input_dir, outdir=output_dir, log_format=log_format,\n tau=tau)\n', (325, 397), False, 'from spellpy import spell\n'), ((511, 544), 'glob.glob', 'glob', ... |
from networks import *
from PIL import Image
import numpy as np
import scipy.misc as misc
import os
class DCGAN:
def __init__(self):
self.img = tf.placeholder(tf.float32, [None, IMG_H, IMG_W, IMG_C])
self.z = tf.placeholder(tf.float32, [None, Z_DIM])
G = Generator("generator")
... | [
"numpy.uint8",
"numpy.zeros",
"PIL.Image.open",
"numpy.random.standard_normal",
"scipy.misc.imresize",
"os.listdir"
] | [((1098, 1119), 'os.listdir', 'os.listdir', (['file_path'], {}), '(file_path)\n', (1108, 1119), False, 'import os\n'), ((1171, 1213), 'numpy.zeros', 'np.zeros', (['[BATCHSIZE, IMG_H, IMG_W, IMG_C]'], {}), '([BATCHSIZE, IMG_H, IMG_W, IMG_C])\n', (1179, 1213), True, 'import numpy as np\n'), ((1910, 1955), 'numpy.random.s... |
import glob
import os
import tkinter as tk
from tkinter import messagebox
from xml.etree import ElementTree
import cv2
import numpy as np
import pandas as pd
import tensorflow.compat.v1 as tf
from PIL import Image, ImageTk
from config import config
from logger import Logger
from reporter import load_model
from utils ... | [
"pandas.read_csv",
"utils.annotator",
"pandas.read_pickle",
"numpy.clip",
"tkinter.Frame",
"glob.glob",
"tkinter.Label",
"utils.gray_normalizer",
"tkinter.Button",
"cv2.imwrite",
"os.path.exists",
"numpy.ndim",
"tensorflow.compat.v1.Session",
"utils.change_channel",
"reporter.load_model"... | [((388, 412), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (410, 412), True, 'import tensorflow.compat.v1 as tf\n'), ((956, 988), 'PIL.Image.fromarray', 'Image.fromarray', (['np_array', '"""RGB"""'], {}), "(np_array, 'RGB')\n", (971, 988), False, 'from PIL import Image, ImageT... |
import numpy as np
import torch
from mlprogram.languages.csg import Dataset
class TestDataset(object):
def test_iterator(self):
dataset = Dataset(2, 1, 1, 1, 45)
for x in dataset:
break
def test_multiprocess_loader(self):
torch.manual_seed(0)
np.random.seed(0)
... | [
"torch.manual_seed",
"mlprogram.languages.csg.Dataset",
"numpy.random.seed",
"torch.utils.data.DataLoader"
] | [((153, 176), 'mlprogram.languages.csg.Dataset', 'Dataset', (['(2)', '(1)', '(1)', '(1)', '(45)'], {}), '(2, 1, 1, 1, 45)\n', (160, 176), False, 'from mlprogram.languages.csg import Dataset\n'), ((270, 290), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (287, 290), False, 'import torch\n'), ((299, 3... |
import unittest
import numpy as np
import torch
from torch.testing import assert_close
from lcapt.metric import (
compute_frac_active,
compute_l1_sparsity,
compute_l2_error,
compute_times_active_by_feature,
)
class TestMetrics(unittest.TestCase):
def test_compute_frac_active_all_active(self):
... | [
"unittest.main",
"torch.ones",
"lcapt.metric.compute_frac_active",
"lcapt.metric.compute_l2_error",
"torch.randn",
"lcapt.metric.compute_times_active_by_feature",
"numpy.arange",
"torch.arange",
"torch.rand",
"torch.zeros",
"lcapt.metric.compute_l1_sparsity",
"torch.tensor"
] | [((6153, 6168), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6166, 6168), False, 'import unittest\n'), ((335, 360), 'torch.ones', 'torch.ones', (['(10)', '(100)', '(8)', '(8)'], {}), '(10, 100, 8, 8)\n', (345, 360), False, 'import torch\n'), ((383, 410), 'lcapt.metric.compute_frac_active', 'compute_frac_active'... |
import re
from functools import partial
import itertools
import numpy as np
import pandas as pd
from scipy import stats
from .helpers import *
from .predict import *
class hlaPredCache(dict):
"""Load 8,9,10,11-mer binding affinities into a big dictionary
ba[(hla,peptide)]=9.1
TODO:
(1) Improve handl... | [
"functools.partial",
"numpy.random.seed",
"pandas.read_csv",
"scipy.stats.expon.rvs",
"itertools.product",
"re.sub",
"re.compile"
] | [((615, 632), 're.compile', 're.compile', (['"""\\\\*"""'], {}), "('\\\\*')\n", (625, 632), False, 'import re\n'), ((5458, 5491), 'itertools.product', 'itertools.product', (['hlas', 'peptides'], {}), '(hlas, peptides)\n', (5475, 5491), False, 'import itertools\n'), ((6898, 6960), 'pandas.read_csv', 'pd.read_csv', (['fn... |
import moderngl
import numpy as np
from PIL import Image
from PyQt5 import QtOpenGL, QtWidgets
class HeadlessDisplay:
def __init__(self, width=512, height=512):
# Create an OpenGL context
self.ctx = moderngl.create_context(standalone=True, size=(width, height))
self.ctx.enable(moderngl.DEP... | [
"PyQt5.QtWidgets.QDesktopWidget",
"numpy.array",
"moderngl.create_context",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtOpenGL.QGLFormat"
] | [((2980, 3006), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['[]'], {}), '([])\n', (3002, 3006), False, 'from PyQt5 import QtOpenGL, QtWidgets\n'), ((221, 283), 'moderngl.create_context', 'moderngl.create_context', ([], {'standalone': '(True)', 'size': '(width, height)'}), '(standalone=True, size=(width,... |
from typing import Text
import matplotlib.pyplot as plt
import numpy as np
from scipy import fftpack
import torch
def torch_float32(x):
"""Ensure array/tensor is a float32 tf.Tensor."""
if isinstance(x, torch.Tensor):
return x.float() # This is a no-op if x is float32.
elif isinstance(x, np.ndarr... | [
"scipy.fftpack.helper.next_fast_len",
"torch.arange",
"torch.fft.irfft",
"torch.multiply",
"matplotlib.pyplot.yticks",
"torch.squeeze",
"matplotlib.pyplot.xticks",
"torch.log",
"numpy.ceil",
"torch.zeros_like",
"numpy.log2",
"torch.unsqueeze",
"matplotlib.pyplot.ylabel",
"torch.reshape",
... | [((649, 666), 'torch.log', 'torch.log', (['safe_x'], {}), '(safe_x)\n', (658, 666), False, 'import torch\n'), ((2084, 2107), 'torch.flip', 'torch.flip', (['logmag', '[0]'], {}), '(logmag, [0])\n', (2094, 2107), False, 'import torch\n'), ((2305, 2319), 'matplotlib.pyplot.xticks', 'plt.xticks', (['[]'], {}), '([])\n', (2... |
import argparse, sys, torch
sys.path.append('/home/liuxg/workspace/SAparaphrase/')
sys.path.append('/home/liuxg/workspace/SAparaphrase/bert')
from utils import get_corpus_bleu_scores, savetexts
from nltk.translate.bleu_score import corpus_bleu
import nltk
from utils import appendtext
import numpy as np
#from rouge impo... | [
"sys.path.append",
"torch.mean",
"rouge.Rouge",
"argparse.ArgumentParser",
"torch.sum",
"torch.cat",
"numpy.mean",
"rouge.calc_score",
"nltk.translate.bleu_score.SmoothingFunction",
"utils.get_corpus_bleu_scores"
] | [((28, 82), 'sys.path.append', 'sys.path.append', (['"""/home/liuxg/workspace/SAparaphrase/"""'], {}), "('/home/liuxg/workspace/SAparaphrase/')\n", (43, 82), False, 'import argparse, sys, torch\n'), ((83, 141), 'sys.path.append', 'sys.path.append', (['"""/home/liuxg/workspace/SAparaphrase/bert"""'], {}), "('/home/liuxg... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | [
"numpy.empty",
"numpy.isnan",
"qiskit.aqua.AquaError",
"qiskit.tools.events.TextProgressBar",
"qiskit.aqua.operators.WeightedPauliOperator",
"numpy.identity",
"qiskit.aqua.operators.op_converter.to_tpb_grouped_weighted_pauli_operator",
"numpy.real",
"qiskit.aqua.operators.Z2Symmetries",
"qiskit.aq... | [((1273, 1300), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1290, 1300), False, 'import logging\n'), ((3621, 3744), 'qiskit.chemistry.components.variational_forms.UCCSD.compute_excitation_lists', 'UCCSD.compute_excitation_lists', (['self._num_particles', 'self._num_orbitals', 'self._a... |
import oneflow as flow
import networks
import itertools
from image import ImagePool, ndarray2image
import numpy as np
import cv2
class CycleGANModel:
def __init__(self, opt):
self.opt = opt
self.device = "cuda"
self.netG_A = networks.ResnetGenerator(n_blocks=opt.n_blocks).to(self.device)
... | [
"oneflow.Tensor",
"cv2.imwrite",
"oneflow.nn.L1Loss",
"networks.ResnetGenerator",
"oneflow.optim.lr_scheduler.CosineAnnealingLR",
"networks.NLayerDiscriminator",
"networks.GANLoss",
"numpy.concatenate",
"image.ImagePool"
] | [((572, 596), 'image.ImagePool', 'ImagePool', (['opt.pool_size'], {}), '(opt.pool_size)\n', (581, 596), False, 'from image import ImagePool, ndarray2image\n'), ((624, 648), 'image.ImagePool', 'ImagePool', (['opt.pool_size'], {}), '(opt.pool_size)\n', (633, 648), False, 'from image import ImagePool, ndarray2image\n'), (... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 5 17:32:01 2021
@author: oscar
Script for plotting 3d scatter plots of results, so one can get an idea of
the interactions between BP, BDP, and FPGA power consumtion and resources.
"""
import numpy as np
import matplotlib.pyplot as plt
import copy
import re
... | [
"matplotlib.pyplot.title",
"numpy.sum",
"openpyxl.load_workbook",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.gca",
"xlcalculator.Evaluator",
"numpy.insert",
"numpy.intersect1d",
"matplotlib.pyplot.subplots",
"re.search",
"matplotlib.markers.MarkerStyle",
... | [((1427, 1461), 'openpyxl.load_workbook', 'load_workbook', ([], {'filename': 'excel_path'}), '(filename=excel_path)\n', (1440, 1461), False, 'from openpyxl import load_workbook\n'), ((1501, 1516), 'xlcalculator.ModelCompiler', 'ModelCompiler', ([], {}), '()\n', (1514, 1516), False, 'from xlcalculator import ModelCompil... |
import argparse
import math
import h5py
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import socket
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(BASE_DIR)
sys.path.append(ROOT_DIR)
sys.pa... | [
"os.mkdir",
"numpy.sum",
"argparse.ArgumentParser",
"numpy.argmax",
"tensorflow.maximum",
"provider.getDataFiles",
"tensorflow.compat.v1.get_variable_scope",
"tensorflow.compat.v1.train.exponential_decay",
"tensorflow.Variable",
"sys.stdout.flush",
"os.path.join",
"provider.loadDataFile",
"s... | [((236, 261), 'os.path.dirname', 'os.path.dirname', (['BASE_DIR'], {}), '(BASE_DIR)\n', (251, 261), False, 'import os\n'), ((262, 287), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (277, 287), False, 'import sys\n'), ((288, 313), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(R... |
from __future__ import absolute_import, division, print_function
from sys import argv
import h5py
import numpy as np
from scipy.constants import Planck, m_n
from dials.array_family import flex
from dxtbx import IncorrectFormatError
from dxtbx.format.FormatNXTOFRAW import FormatNXTOFRAW
from dxtbx.model import Detec... | [
"dials.array_family.flex.grid",
"h5py.File",
"dxtbx.model.sequence.SequenceFactory.make_tof_sequence",
"dxtbx.format.FormatNXTOFRAW.FormatNXTOFRAW.understand",
"dials_array_family_flex_ext.int6",
"numpy.ascontiguousarray",
"dials_array_family_flex_ext.reflection_table.empty_standard",
"numpy.square",
... | [((902, 928), 'h5py.File', 'h5py.File', (['image_file', '"""r"""'], {}), "(image_file, 'r')\n", (911, 928), False, 'import h5py\n'), ((4301, 4311), 'dxtbx.model.Detector', 'Detector', ([], {}), '()\n', (4309, 4311), False, 'from dxtbx.model import Detector\n'), ((8478, 8602), 'dxtbx.model.beam.PolyBeamFactory.make_beam... |
# -*- coding: utf-8 -*-
"""
This file contains routines for simples loglikelihoods and priors for test
cases.
"""
from __future__ import (print_function, division, absolute_import,
unicode_literals)
# Tell module what it's allowed to import
__all__ = ["bimodal_normal_sample","bimodal_normal_... | [
"numpy.random.uniform",
"numpy.isfinite",
"numpy.fabs",
"numpy.linalg.inv",
"numpy.array",
"numpy.dot"
] | [((3918, 3929), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (3926, 3929), True, 'import numpy as np\n'), ((1594, 1629), 'numpy.array', 'np.array', (['[[1.0, 1.0], [-2.0, 1.0]]'], {}), '([[1.0, 1.0], [-2.0, 1.0]])\n', (1602, 1629), True, 'import numpy as np\n'), ((1644, 1678), 'numpy.array', 'np.array', (['[[1.0, 0... |
#!/usr/bin/env python3
import numpy as np
import mrcnn.utils
import mrcnn.model as modellib
import pycocotools
import pycococreatortools.pycococreatortools as pycococreatortools
import datetime
def compute_per_class_precision(gt_boxes, gt_class_ids, gt_masks,
pred_boxes, pred_class_ids, pred_scores, pre... | [
"numpy.size",
"mrcnn.model.load_image_gt",
"numpy.shape",
"datetime.datetime.utcnow",
"numpy.where",
"numpy.array",
"numpy.random.choice"
] | [((2775, 2843), 'numpy.random.choice', 'np.random.choice', (['dataset.image_ids', 'number_of_images'], {'replace': '(False)'}), '(dataset.image_ids, number_of_images, replace=False)\n', (2791, 2843), True, 'import numpy as np\n'), ((595, 637), 'numpy.where', 'np.where', (["(gt_class_ids == class_info['id'])"], {}), "(g... |
# 此项目在开源项目上进行开发
# 原项目地址:https://github.com/ianzhao05/textshot
# 使用EAST深度学习模型执行文本检测
# USAGE
# python text_shot.py [-s 1] [-p 0.05]
import io
import sys
import cv2
import numpy as np
import argparse
from imutils.object_detection import non_max_suppression
import pyperclip
import pytesseract
from PIL import Image
fr... | [
"argparse.ArgumentParser",
"PyQt5.QtGui.QColor",
"numpy.sin",
"PyQt5.QtGui.QBrush",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtGui.QCursor.pos",
"PyQt5.QtGui.QPainter",
"cv2.dnn.blobFromImage",
"PyQt5.QtCore.QBuffer",
"cv2.resize",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QMainWindow",
"numpy.as... | [((470, 495), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (493, 495), False, 'import argparse\n'), ((4127, 4156), 'cv2.resize', 'cv2.resize', (['img', '(newW, newH)'], {}), '(img, (newW, newH))\n', (4137, 4156), False, 'import cv2\n'), ((4296, 4353), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['... |
import re
import numpy as np
def clean_coords(coords):
coords = [l.strip() for l in coords]
clean = []
for coord in coords:
coord_regex = r'(\d+),(\d+) -> (\d+),(\d+)'
matches = re.search(coord_regex, coord)
a, b, c, d = matches.groups()
clean.append([[int(a), int(b)],[int(... | [
"numpy.count_nonzero",
"numpy.zeros",
"re.search"
] | [((2281, 2314), 'numpy.zeros', 'np.zeros', (['(size, size)'], {'dtype': 'int'}), '((size, size), dtype=int)\n', (2289, 2314), True, 'import numpy as np\n'), ((2595, 2625), 'numpy.count_nonzero', 'np.count_nonzero', (['(vent_map > 1)'], {}), '(vent_map > 1)\n', (2611, 2625), True, 'import numpy as np\n'), ((208, 237), '... |
from typing import List
import math
from pathlib import Path
import datetime
import numpy as np
import pandas as pd
from pandas.plotting import register_matplotlib_converters
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
from matplotlib.ticker import ScalarFormatter
from matplotlib.dates impor... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.yscale",
"matplotlib.dates.MonthLocator",
"matplotlib.pyplot.suptitle",
"numpy.clip",
"matplotlib.dates.WeekdayLocator",
"pathlib.Path",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"matplotlib.dates.date2num",
"matplotlib.ticker.Scalar... | [((474, 506), 'pandas.plotting.register_matplotlib_converters', 'register_matplotlib_converters', ([], {}), '()\n', (504, 506), False, 'from pandas.plotting import register_matplotlib_converters\n'), ((507, 517), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '()\n', (515, 517), True, 'import matplotlib.pyplot as plt\... |
import numpy as np
import random
def seed(seed: int = 42):
"""Set random seed for all libraries used to make program deterministic."""
np.random.seed(seed)
random.seed(seed)
| [
"random.seed",
"numpy.random.seed"
] | [((145, 165), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (159, 165), True, 'import numpy as np\n'), ((170, 187), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (181, 187), False, 'import random\n')] |
import numpy as np
import pytest
from psyneulink.components.functions.function import LinearCombination, Reduce
from psyneulink.components.mechanisms.adaptive.gating.gatingmechanism import GatingMechanism
from psyneulink.components.mechanisms.mechanism import MechanismError
from psyneulink.components.mechanisms.proces... | [
"psyneulink.components.mechanisms.adaptive.gating.gatingmechanism.GatingMechanism",
"psyneulink.components.projections.pathway.mappingprojection.MappingProjection",
"numpy.testing.assert_array_equal",
"numpy.zeros",
"psyneulink.components.functions.function.Reduce",
"pytest.raises",
"numpy.array",
"ps... | [((32547, 32572), 'psyneulink.components.mechanisms.processing.transfermechanism.TransferMechanism', 'TransferMechanism', ([], {'size': '(3)'}), '(size=3)\n', (32564, 32572), False, 'from psyneulink.components.mechanisms.processing.transfermechanism import TransferMechanism\n'), ((1492, 1579), 'psyneulink.components.me... |
import numpy as np
import math
from sklearn.linear_model import LogisticRegression
from statsmodels.tools.tools import add_constant
from sklearn.neighbors import KNeighborsRegressor
from nadaraya_watson import KernelRegression
class Basic(object):
def __init__(self):
self.X_list = []
self.Y_list... | [
"nadaraya_watson.KernelRegression",
"numpy.mean",
"numpy.array",
"numpy.random.choice",
"numpy.sqrt"
] | [((516, 537), 'numpy.array', 'np.array', (['self.Y_list'], {}), '(self.Y_list)\n', (524, 537), True, 'import numpy as np\n'), ((550, 571), 'numpy.array', 'np.array', (['self.X_list'], {}), '(self.X_list)\n', (558, 571), True, 'import numpy as np\n'), ((584, 605), 'numpy.array', 'np.array', (['self.A_list'], {}), '(self... |
# -*- coding: utf-8 -*-
# @Time : 2019/6/27
# @Author : Godder
# @Github : https://github.com/WangGodder
from .base import CrossModalTrainBase
import numpy as np
import torch
class CrossModalSingleTrain(CrossModalTrainBase):
def __init__(self, img_dir: str, img_names: np.ndarray, txt_matrix: np.ndarray, labe... | [
"torch.Tensor",
"numpy.array"
] | [((1297, 1327), 'torch.Tensor', 'torch.Tensor', (['self.label[item]'], {}), '(self.label[item])\n', (1309, 1327), False, 'import torch\n'), ((1361, 1375), 'numpy.array', 'np.array', (['item'], {}), '(item)\n', (1369, 1375), True, 'import numpy as np\n')] |
"""timing_receive_jpg_buf.py -- receive and display images, then print FPS stats
A timing program that uses imagezmq to receive and display an image stream
from one or more Raspberry Pi computers and print timing and FPS statistics.
These jpg versions of the 2 timing programs perform jpg
compression / decompression be... | [
"imutils.video.FPS",
"traceback.print_exc",
"cv2.waitKey",
"imagezmq.ImageHub",
"cv2.imshow",
"sys.path.insert",
"collections.defaultdict",
"cv2.destroyAllWindows",
"numpy.fromstring",
"sys.exit"
] | [((1096, 1129), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../imagezmq"""'], {}), "(0, '../imagezmq')\n", (1111, 1129), False, 'import sys\n'), ((1342, 1361), 'imagezmq.ImageHub', 'imagezmq.ImageHub', ([], {}), '()\n', (1359, 1361), False, 'import imagezmq\n'), ((1401, 1417), 'collections.defaultdict', 'default... |
import glob
import os
import time
import numpy as np
import tensorflow.compat.v1 as tf
import tensorflow.contrib.slim as slim
from matplotlib import pyplot as plt
tf.disable_v2_behavior()
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
input_dir = './dataset/Sony/short/JPEG/'
gt_dir ... | [
"numpy.maximum",
"numpy.random.randint",
"matplotlib.pyplot.imsave",
"glob.glob",
"matplotlib.pyplot.imread",
"tensorflow.compat.v1.global_variables_initializer",
"tensorflow.compat.v1.train.get_checkpoint_state",
"tensorflow.contrib.slim.conv2d",
"tensorflow.compat.v1.placeholder",
"tensorflow.co... | [((164, 188), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (186, 188), True, 'import tensorflow.compat.v1 as tf\n'), ((457, 485), 'glob.glob', 'glob.glob', (["(gt_dir + '0*.png')"], {}), "(gt_dir + '0*.png')\n", (466, 485), False, 'import glob\n'), ((3601, 3613), 'tensorflow.c... |
"""
Mask R-CNN
Configurations and data loading code for MS COCO.
Copyright (c) 2017 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by <NAME>
"""
import os
import shutil
import time
import urllib.request
import zipfile
import numpy as np
import skimage
import skimage.io
import tqdm
f... | [
"pycocotools.mask.decode",
"numpy.ones",
"numpy.around",
"pycocotools.cocoeval.COCOeval",
"numpy.arange",
"os.path.join",
"pycocotools.mask.merge",
"os.path.exists",
"pycocotools.mask.frPyObjects",
"shutil.copyfileobj",
"skimage.io.imread",
"numpy.stack",
"tqdm.tqdm",
"numpy.asfortranarray... | [((21006, 21017), 'time.time', 'time.time', ([], {}), '()\n', (21015, 21017), False, 'import time\n'), ((21852, 21891), 'pycocotools.cocoeval.COCOeval', 'COCOeval', (['coco', 'coco_results', 'eval_type'], {}), '(coco, coco_results, eval_type)\n', (21860, 21891), False, 'from pycocotools.cocoeval import COCOeval\n'), ((... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
import tensorflow as tf
def forward_convert(coordinate, with_label=True):
"""
:param coordinate: format [x_c, y_c, w, h, theta]
:return: form... | [
"tensorflow.reshape",
"numpy.greater",
"cv2.boxPoints",
"numpy.sin",
"cv2.minAreaRect",
"tensorflow.reduce_max",
"numpy.logical_not",
"tensorflow.stack",
"numpy.reshape",
"numpy.less",
"tensorflow.reduce_min",
"numpy.stack",
"numpy.int0",
"numpy.cos",
"numpy.greater_equal",
"tensorflow... | [((926, 959), 'numpy.array', 'np.array', (['boxes'], {'dtype': 'np.float32'}), '(boxes, dtype=np.float32)\n', (934, 959), True, 'import numpy as np\n'), ((1829, 1862), 'numpy.array', 'np.array', (['boxes'], {'dtype': 'np.float32'}), '(boxes, dtype=np.float32)\n', (1837, 1862), True, 'import numpy as np\n'), ((5730, 576... |
import numpy as np
import tensorflow as tf
from tensorflow.keras.losses import SparseCategoricalCrossentropy
from graphadv import is_binary
from graphadv.attack.targeted.targeted_attacker import TargetedAttacker
from graphadv.utils import train_a_surrogate, largest_indices, filter_singletons
from graphgallery.nn.mode... | [
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"graphadv.utils.largest_indices",
"graphadv.utils.filter_singletons",
"tensorflow.linspace",
"tensorflow.gather_nd",
"tensorflow.device",
"numpy.zeros",
"numpy.hstack",
"graphgallery.normalize_adj_tensor",
"tensorflow.zeros",
"numpy.arange... | [((1071, 1094), 'numpy.arange', 'np.arange', (['self.n_attrs'], {}), '(self.n_attrs)\n', (1080, 1094), True, 'import numpy as np\n'), ((4901, 4924), 'graphgallery.astensor', 'astensor', (['[self.target]'], {}), '([self.target])\n', (4909, 4924), False, 'from graphgallery import tqdm, astensor, normalize_adj_tensor\n'),... |
#!/usr/bin/env python
# coding=utf-8
"""Optical flow I/O and visualization."""
import os
import sys
import numpy as np
from . import colormaps
def floread(filename):
"""
Read optical flow (.flo) files stored in Middlebury format.
Adapted from https://stackoverflow.com/a/28016469/400948
"""
if sy... | [
"numpy.arctan2",
"numpy.resize",
"numpy.fromfile",
"numpy.floor",
"numpy.square",
"numpy.zeros",
"os.path.exists",
"numpy.clip",
"numpy.max",
"numpy.arange",
"numpy.array"
] | [((1372, 1392), 'numpy.zeros', 'np.zeros', (['(h, w * 2)'], {}), '((h, w * 2))\n', (1380, 1392), True, 'import numpy as np\n'), ((2713, 2760), 'numpy.zeros', 'np.zeros', (['(u.shape[0], u.shape[1], 3)', 'np.uint8'], {}), '((u.shape[0], u.shape[1], 3), np.uint8)\n', (2721, 2760), True, 'import numpy as np\n'), ((4423, 4... |
import torch
from torch.utils.data import DataLoader
import numpy as np
from torch.utils.data import Dataset
import cv2
from data import transformations
from utils import personal_constants, constants
from tqdm import tqdm
from torchvision import transforms
import torchvision.utils as vutils
import matplotlib.pyplot ... | [
"data.transformations.RescaleValues",
"tqdm.tqdm",
"matplotlib.pyplot.show",
"torch.utils.data.DataLoader",
"matplotlib.pyplot.imshow",
"torch.cat",
"utils.training_helpers.unpack_batch",
"data.transformations.ChangeChannels",
"torchvision.utils.make_grid",
"matplotlib.pyplot.figure",
"data.tran... | [((3602, 3694), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'shuffle': '(False)', 'batch_size': 'batch_size', 'drop_last': '(True)', 'num_workers': '(0)'}), '(dataset, shuffle=False, batch_size=batch_size, drop_last=True,\n num_workers=0)\n', (3612, 3694), False, 'from torch.utils.data import DataLoa... |
import abc
import numpy as np
import h5py
import sensor
import state
import network_nodes
class Simulation(metaclass=abc.ABCMeta):
@abc.abstractmethod
def __init__(
self, parameters, room, resampling_algorithm, resampling_criterion, prior, transition_kernel, output_file_basename,
pseudo_random_numbers_genera... | [
"state.to_position",
"h5py.File",
"numpy.random.RandomState",
"h5py.special_dtype"
] | [((2794, 2883), 'h5py.File', 'h5py.File', (["(self._output_file_basename + '.hdf5')", '"""w"""'], {'driver': '"""core"""', 'libver': '"""latest"""'}), "(self._output_file_basename + '.hdf5', 'w', driver='core', libver=\n 'latest')\n", (2803, 2883), False, 'import h5py\n'), ((8195, 8219), 'h5py.File', 'h5py.File', ([... |
# coding=utf-8
# pylint: disable-msg=E1101,W0612
from datetime import datetime, timedelta
import operator
import numpy as np
import pytest
import pandas.compat as compat
from pandas.compat import range
import pandas as pd
from pandas import (
Categorical, DataFrame, Index, NaT, Series, bdate_range, date_range, ... | [
"pandas.option_context",
"numpy.isnan",
"pandas.util.testing.assert_index_equal",
"numpy.arange",
"pytest.mark.parametrize",
"pandas.bdate_range",
"pandas.DataFrame",
"numpy.random.randn",
"pytest.raises",
"datetime.timedelta",
"pandas.Period",
"operator.truediv",
"pandas.Timedelta",
"oper... | [((596, 675), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""bool_op"""', '[operator.and_, operator.or_, operator.xor]'], {}), "('bool_op', [operator.and_, operator.or_, operator.xor])\n", (619, 675), False, 'import pytest\n'), ((6209, 6283), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""op""... |
# The following is an algorithm to remove systematic effects in a large set of
# light curves based on a paper by <NAME>, <NAME> and <NAME> (2004)
# titled "Correcting systematic effects in a large set of photometric light
# curves".
import sys
import os.path
import os
import astropy.io.ascii as at
import n... | [
"numpy.set_printoptions",
"astropy.io.ascii.read",
"numpy.sum",
"numpy.copy",
"source_lc.source.from_ptf",
"numpy.median",
"numpy.empty",
"numpy.std",
"numpy.zeros",
"numpy.ones",
"numpy.shape",
"astropy.io.ascii.write"
] | [((387, 437), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.nan', 'precision': '(6)'}), '(threshold=np.nan, precision=6)\n', (406, 437), True, 'import numpy as np\n'), ((835, 867), 'numpy.zeros', 'np.zeros', (['(stars_dim, epoch_dim)'], {}), '((stars_dim, epoch_dim))\n', (843, 867), True, 'imp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import io
import json
import os
import os.path
import re
import csv
import subprocess
from PIL import Image
from math import sqrt, exp, log
from matplotlib import cm
from matplotlib import pyplot as plt
import numpy ... | [
"argparse.ArgumentParser",
"numpy.amin",
"matplotlib.cm.inferno",
"os.path.isfile",
"matplotlib.pyplot.imshow",
"re.findall",
"math.log",
"io.BytesIO",
"matplotlib.pyplot.show",
"csv.writer",
"numpy.vectorize",
"numpy.ndenumerate",
"math.sqrt",
"subprocess.check_output",
"matplotlib.pypl... | [((10363, 10439), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Extract and visualize Flir Image data"""'}), "(description='Extract and visualize Flir Image data')\n", (10386, 10439), False, 'import argparse\n'), ((1970, 2073), 'subprocess.check_output', 'subprocess.check_output', (["[s... |
# pylint: disable=all
"""Bokeh ESS plots."""
import bokeh.plotting as bkp
import numpy as np
from bokeh.layouts import gridplot
from bokeh.models import Dash, Span, ColumnDataSource
from bokeh.models.annotations import Title, Legend
from scipy.stats import rankdata
from . import backend_kwarg_defaults, backend_show
fr... | [
"numpy.zeros_like",
"bokeh.models.Dash",
"numpy.asarray",
"scipy.stats.rankdata",
"bokeh.models.annotations.Legend",
"numpy.max",
"bokeh.plotting.show",
"bokeh.models.Span",
"bokeh.models.annotations.Title",
"numpy.atleast_2d"
] | [((1358, 1375), 'numpy.atleast_2d', 'np.atleast_2d', (['ax'], {}), '(ax)\n', (1371, 1375), True, 'import numpy as np\n'), ((4234, 4380), 'bokeh.models.Span', 'Span', ([], {'location': '(400 / n_samples if relative else min_ess)', 'dimension': '"""width"""', 'line_color': '"""red"""', 'line_width': '(3)', 'line_dash': '... |
from itertools import chain
import numpy as np
class DegenerateTriangle(Exception):
pass
def looped_pairs(iterable):
"""
>>> list(looped_pairs([1,2,3]))
[(1, 2), (2, 3), (3, 1)]
"""
iterable = iter(iterable)
first = last = next(iterable)
for x in iterable:
yield last, x
... | [
"numpy.cross",
"numpy.shape",
"numpy.array",
"numpy.dot",
"itertools.chain",
"numpy.vstack"
] | [((2825, 2864), 'itertools.chain', 'chain', (['seq[:start]', 'seq[start + count:]'], {}), '(seq[:start], seq[start + count:])\n', (2830, 2864), False, 'from itertools import chain\n'), ((3181, 3204), 'numpy.dot', 'np.dot', (['mtrx', '(point - a)'], {}), '(mtrx, point - a)\n', (3187, 3204), True, 'import numpy as np\n')... |
import torch
import torch.nn as nn
from torchvision import transforms as TF
from models.NIMA_model.nima import NIMA
import argparse
import os
from PIL import Image
import pandas as pd
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
transforms = TF.Compose([
TF.Resize((224,224)),
TF.To... | [
"matplotlib.pyplot.title",
"os.mkdir",
"argparse.ArgumentParser",
"matplotlib.pyplot.figure",
"torch.device",
"torchvision.transforms.Normalize",
"torch.no_grad",
"os.path.join",
"numpy.round",
"pandas.DataFrame",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.close",
"os.path.exists",
"mo... | [((486, 509), 'numpy.round', 'np.round', (['mean_score', '(3)'], {}), '(mean_score, 3)\n', (494, 509), True, 'import numpy as np\n'), ((526, 548), 'numpy.round', 'np.round', (['std_score', '(3)'], {}), '(std_score, 3)\n', (534, 548), True, 'import numpy as np\n'), ((595, 611), 'matplotlib.pyplot.title', 'plt.title', ([... |
"""
code by <NAME> {git --> PURU2411 }
Motion controller of 6 dof kuka arm
"""
from sympy import symbols, cos, sin, pi, simplify, pprint, tan, expand_trig, sqrt, trigsimp, atan2
from sympy.matrices import Matrix
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import time
im... | [
"numpy.matrix",
"matplotlib.pyplot.show",
"numpy.cross",
"numpy.sin",
"numpy.array",
"numpy.reshape",
"numpy.cos",
"numpy.dot",
"sympy.matrices.Matrix",
"numpy.concatenate"
] | [((1431, 1441), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1439, 1441), True, 'import matplotlib.pyplot as plt\n'), ((1714, 1868), 'numpy.array', 'np.array', (['[[q1, np.pi / 2, a2, a1], [q2, 0, a3, 0], [q3 + np.pi / 2, np.pi / 2, 0, 0],\n [q4, -np.pi / 2, 0, a4], [q5, np.pi / 2, 0, 0], [q6, 0, 0, a5]]... |
import numpy as np
from gym.envs.robotics.utils import reset_mocap_welds, reset_mocap2body_xpos
from gym.spaces.box import Box
from sawyer.garage.misc.overrides import overrides
from sawyer.mujoco.robots.base import Robot
COLLISION_WHITELIST = [
# Liberal whitelist here
# Remove this section for a more conse... | [
"gym.spaces.box.Box",
"numpy.array"
] | [((1257, 1404), 'numpy.array', 'np.array', (['[0.0, 0.0, -0.140923828125, -1.2789248046875, -3.043166015625, -\n 2.139623046875, -0.047607421875, -0.7052822265625, -1.4102060546875]'], {}), '([0.0, 0.0, -0.140923828125, -1.2789248046875, -3.043166015625, -\n 2.139623046875, -0.047607421875, -0.7052822265625, -1.4... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.