code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""Plot quantile or local effective sample sizes."""
import numpy as np
import xarray as xr
from ..data import convert_to_dataset
from ..labels import BaseLabeller
from ..rcparams import rcParams
from ..sel_utils import xarray_var_iter
from ..stats import ess
from ..utils import _var_names, get_coords
from .plot_utils... | [
"numpy.linspace"
] | [((7851, 7904), 'numpy.linspace', 'np.linspace', (['(1 / n_points)', '(1 - 1 / n_points)', 'n_points'], {}), '(1 / n_points, 1 - 1 / n_points, n_points)\n', (7862, 7904), True, 'import numpy as np\n'), ((8228, 8271), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'n_points'], {'endpoint': '(False)'}), '(0, 1, n_point... |
# Copyright 2015 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... | [
"sys.stdout.write",
"tensorflow.python.platform.gfile.FastGFile",
"tensorflow.gfile.Exists",
"tensorflow.python.util.compat.as_bytes",
"argparse.ArgumentParser",
"tensorflow.logging.info",
"tensorflow.logging.error",
"tensorflow.logging.warning",
"tensorflow.python.platform.gfile.Walk",
"tensorflo... | [((57959, 58000), 'tensorflow.app.run', 'tf.app.run', ([], {'main': 'main', 'argv': '[sys.argv[0]]'}), '(main=main, argv=[sys.argv[0]])\n', (57969, 58000), True, 'import tensorflow as tf\n'), ((58058, 58083), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (58081, 58083), False, 'import argparse... |
# Copyright 2020 Google LLC
#
# 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 agreed to in writing, ... | [
"scipy.sparse.diags",
"tensorflow.math.argmax",
"tensorflow.convert_to_tensor",
"models.GCN",
"models.GAT",
"tensorflow.TensorShape",
"numpy.genfromtxt",
"numpy.power",
"numpy.dtype",
"numpy.ones",
"tensorflow.cast",
"scipy.sparse.csr_matrix",
"numpy.array",
"numpy.where",
"numpy.vstack"... | [((1550, 1580), 'tensorflow.math.argmax', 'tf.math.argmax', (['logits'], {'axis': '(1)'}), '(logits, axis=1)\n', (1564, 1580), True, 'import tensorflow as tf\n'), ((2389, 2409), 'scipy.sparse.diags', 'sp.diags', (['d_inv_sqrt'], {}), '(d_inv_sqrt)\n', (2397, 2409), True, 'import scipy.sparse as sp\n'), ((2649, 2664), '... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
Dans une grille en tore (pacman) privilégie les co-linéarités à angles triangulaires.
On fait passer la contrainte par une vague spatiale exogene (prédeterminée, pas émergente)
"""
import sys
if len(sys.argv)>1: mode = sys.argv[1]
else: mode = 'both'
import elastici... | [
"numpy.zeros_like",
"numpy.random.randn",
"numpy.sin",
"numpy.exp",
"numpy.cos",
"elasticite.main"
] | [((1264, 1274), 'elasticite.main', 'el.main', (['e'], {}), '(e)\n', (1271, 1274), True, 'import elasticite as el\n'), ((414, 445), 'numpy.zeros_like', 'np.zeros_like', (['self.lames[2, :]'], {}), '(self.lames[2, :])\n', (427, 445), True, 'import numpy as np\n'), ((714, 731), 'numpy.exp', 'np.exp', (['(-d / 0.05)'], {})... |
""" @package forcebalance.opt_geo_target Optimized Geometry fitting module.
@author <NAME>, <NAME>
@date 03/2019
"""
from __future__ import division
import os
import shutil
import numpy as np
import re
import subprocess
from collections import OrderedDict, defaultdict
from forcebalance.nifty import col, eqcgmx, flat, ... | [
"forcebalance.nifty.printcool_dictionary",
"numpy.sum",
"numpy.zeros",
"forcebalance.output.getLogger",
"forcebalance.molecule.Molecule",
"numpy.array",
"forcebalance.finite_difference.in_fd",
"forcebalance.finite_difference.fdwrap",
"collections.OrderedDict",
"numpy.dot",
"forcebalance.nifty.wa... | [((619, 638), 'forcebalance.output.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (628, 638), False, 'from forcebalance.output import getLogger\n'), ((3351, 3364), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (3362, 3364), False, 'from collections import OrderedDict, defaultdict\n'), ((3384... |
#%%
import sys
import os
#sys.path.append(os.getcwd() + '/connectome_tools/')
os.chdir(os.path.dirname(os.getcwd())) # make directory one step up the current directory
os.chdir(os.path.dirname(os.getcwd())) # make directory one step up the current directory
sys.path.append('/Users/mwinding/repos/maggot_models')
from ... | [
"sys.path.append",
"pandas.DataFrame",
"pymaid.CatmaidInstance",
"seaborn.heatmap",
"seaborn.clustermap",
"pandas.read_csv",
"pymaid.get_annotated",
"os.getcwd",
"connectome_tools.cascade_analysis.Cascade_Analyzer.run_cascades_parallel",
"pymaid.get_skids_by_annotation",
"numpy.where",
"numpy.... | [((259, 313), 'sys.path.append', 'sys.path.append', (['"""/Users/mwinding/repos/maggot_models"""'], {}), "('/Users/mwinding/repos/maggot_models')\n", (274, 313), False, 'import sys\n'), ((716, 766), 'pymaid.CatmaidInstance', 'pymaid.CatmaidInstance', (['url', 'token', 'name', 'password'], {}), '(url, token, name, passw... |
import os
import sys
import cv2
import numpy as np
def get_binary_img(img):
# gray img to bin image
bin_img = np.zeros(shape=(img.shape), dtype=np.uint8)
h = img.shape[0]
w = img.shape[1]
for i in range(h):
for j in range(w):
bin_img[i][j] = 255 if img[i][j] > 127 else 0
re... | [
"cv2.line",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imwrite",
"numpy.zeros",
"cv2.imread",
"cv2.hconcat",
"cv2.rectangle",
"cv2.merge",
"cv2.imshow"
] | [((120, 161), 'numpy.zeros', 'np.zeros', ([], {'shape': 'img.shape', 'dtype': 'np.uint8'}), '(shape=img.shape, dtype=np.uint8)\n', (128, 161), True, 'import numpy as np\n'), ((2354, 2375), 'cv2.imread', 'cv2.imread', (['file_name'], {}), '(file_name)\n', (2364, 2375), False, 'import cv2\n'), ((2391, 2428), 'cv2.cvtColo... |
import warnings
from typing import TYPE_CHECKING
from typing import Dict
from typing import List
from typing import Optional
import numpy as np
import pandas as pd
from etna.clustering.distances.base import Distance
from etna.core import BaseMixin
from etna.loggers import tslogger
if TYPE_CHECKING:
from etna.dat... | [
"numpy.empty",
"etna.loggers.tslogger.log",
"warnings.warn"
] | [((2814, 2870), 'numpy.empty', 'np.empty', ([], {'shape': '(self.series_number, self.series_number)'}), '(shape=(self.series_number, self.series_number))\n', (2822, 2870), True, 'import numpy as np\n'), ((2935, 2982), 'etna.loggers.tslogger.log', 'tslogger.log', (['f"""Calculating distance matrix..."""'], {}), "(f'Calc... |
try:
import debug_settings
except:
pass
import unittest
import torch
import os
import numpy as np
import gym
from gym import spaces
import matplotlib
import time
from torch import nn
from torch.optim import Adam
from torch.autograd import Variable
# BARK imports
from bark.runtime.commons.parameters import Pa... | [
"unittest.main",
"bark.runtime.commons.parameters.ParameterServer",
"torch.nn.ReLU",
"bark_ml.library_wrappers.lib_fqf_iqn_qrdqn.utils.update_params",
"torch.autograd.Variable",
"torch.argmax",
"bark_ml.library_wrappers.lib_fqf_iqn_qrdqn.utils.calculate_huber_loss",
"numpy.zeros",
"bark_ml.library_w... | [((10592, 10607), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10605, 10607), False, 'import unittest\n'), ((5138, 5160), 'torch.zeros', 'torch.zeros', (['(1, 2, 1)'], {}), '((1, 2, 1))\n', (5149, 5160), False, 'import torch\n'), ((5242, 5258), 'torch.rand', 'torch.rand', (['(1)', '(2)'], {}), '(1, 2)\n', (5252... |
import logging
import numpy as np
import os
import pickle
import scipy.sparse as sp
import sys
import tensorflow as tf
from scipy.sparse import linalg
from datetime import datetime #added
class DataLoader(object):
def __init__(self, xs, ys, batch_size, pad_with_last_sample=True, shuffle=False):
... | [
"tensorflow.trainable_variables",
"logging.Formatter",
"pickle.load",
"numpy.maximum.reduce",
"os.path.join",
"scipy.sparse.eye",
"tensorflow.Summary",
"numpy.power",
"numpy.transpose",
"scipy.sparse.coo_matrix",
"scipy.sparse.identity",
"numpy.repeat",
"scipy.sparse.diags",
"logging.Strea... | [((2704, 2722), 'scipy.sparse.coo_matrix', 'sp.coo_matrix', (['adj'], {}), '(adj)\n', (2717, 2722), True, 'import scipy.sparse as sp\n'), ((2864, 2884), 'scipy.sparse.diags', 'sp.diags', (['d_inv_sqrt'], {}), '(d_inv_sqrt)\n', (2872, 2884), True, 'import scipy.sparse as sp\n'), ((3094, 3115), 'scipy.sparse.coo_matrix',... |
"""
Interpolate frames from two frames using SuperSloMo version
"""
import argparse
from time import time
import os
import click
import cv2
import torch
from PIL import Image
import numpy as np
import model
from torchvision import transforms
from torch.functional import F
torch.set_grad_enabled(False)
device = torch.... | [
"os.mkdir",
"argparse.ArgumentParser",
"torch.cat",
"torchvision.transforms.Normalize",
"cv2.cvtColor",
"cv2.imwrite",
"torch.load",
"torchvision.transforms.ToPILImage",
"os.path.exists",
"torch.cuda.is_available",
"torch.set_grad_enabled",
"torch.functional.F.sigmoid",
"torch.stack",
"mod... | [((275, 304), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '(False)\n', (297, 304), False, 'import torch\n'), ((392, 413), 'torchvision.transforms.ToTensor', 'transforms.ToTensor', ([], {}), '()\n', (411, 413), False, 'from torchvision import transforms\n'), ((431, 454), 'torchvision.transform... |
import cv2
import numpy as np
import serial
import time
ser = serial.Serial('/dev/ttyACM0', baudrate = 9600, timeout = 1)
cap = cv2.VideoCapture(0)
cap.set(3,1280)
cap.set(4,720)
path_lower = np.array([0,80,0])
path_upper = np.array([179,255,255])
green_upper = np.array([88,162,154]) # Green : switch ... | [
"serial.Serial",
"cv2.GaussianBlur",
"cv2.boundingRect",
"cv2.putText",
"cv2.dilate",
"cv2.cvtColor",
"cv2.morphologyEx",
"cv2.waitKey",
"cv2.moments",
"cv2.imshow",
"numpy.ones",
"time.sleep",
"cv2.VideoCapture",
"numpy.array",
"cv2.erode",
"cv2.destroyAllWindows",
"cv2.inRange",
... | [((68, 123), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM0"""'], {'baudrate': '(9600)', 'timeout': '(1)'}), "('/dev/ttyACM0', baudrate=9600, timeout=1)\n", (81, 123), False, 'import serial\n'), ((137, 156), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (153, 156), False, 'import cv2\n'), ((206,... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import torch
from torch.autograd import Variable
from torch import nn
from torch.utils.data import DataLoader, Dataset, TensorDataset
from sklearn.metrics import accuracy_score
from sklearn.base import BaseEstimator
class StackedAutoEncoderClassifier(Base... | [
"torch.nn.MSELoss",
"torch.utils.data.DataLoader",
"numpy.argmax",
"torch.argmax",
"torch.autograd.Variable",
"torch.nn.CrossEntropyLoss",
"torch.save",
"numpy.max",
"torch.cuda.is_available",
"torch.utils.data.TensorDataset",
"torch.device",
"numpy.eye",
"torch.tensor",
"numpy.vstack"
] | [((1051, 1076), 'torch.device', 'torch.device', (['device_name'], {}), '(device_name)\n', (1063, 1076), False, 'import torch\n'), ((2072, 2084), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (2082, 2084), False, 'from torch import nn\n'), ((2114, 2135), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {})... |
#execute: python3 script_path image_path min_wavelet_level max_wavelet_level erosion_times output0 output1
import numpy as np
import pandas as pd
import pywt,cv2,sys,subprocess,homcloud,os
import matplotlib.pyplot as plt
import homcloud.interface as hc
args = sys.argv
image_path = args[1] # jpg file
min_wavelet_level... | [
"pandas.DataFrame",
"numpy.uint8",
"numpy.zeros_like",
"numpy.abs",
"cv2.cvtColor",
"cv2.getStructuringElement",
"numpy.float32",
"cv2.threshold",
"homcloud.interface.distance_transform",
"cv2.imread",
"pywt.wavedec2",
"cv2.erode",
"pywt.waverec2"
] | [((547, 569), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (557, 569), False, 'import pywt, cv2, sys, subprocess, homcloud, os\n'), ((670, 711), 'cv2.cvtColor', 'cv2.cvtColor', (['imArray', 'cv2.COLOR_BGR2GRAY'], {}), '(imArray, cv2.COLOR_BGR2GRAY)\n', (682, 711), False, 'import pywt, cv2, sys, s... |
"""Lightweight transformer to parse and augment US zipcodes with info from zipcode database."""
from h2oaicore.transformer_utils import CustomTransformer
import datatable as dt
import numpy as np
from abc import ABC, abstractmethod
_global_modules_needed_by_name = ['zipcodes==1.0.5']
import zipcodes
class ZipcodeLig... | [
"numpy.zeros",
"datatable.Frame",
"zipcodes.matching",
"datatable.join",
"datatable.isna"
] | [((824, 848), 'zipcodes.matching', 'zipcodes.matching', (['value'], {}), '(value)\n', (841, 848), False, 'import zipcodes\n'), ((1231, 1242), 'datatable.Frame', 'dt.Frame', (['X'], {}), '(X)\n', (1239, 1242), True, 'import datatable as dt\n'), ((1723, 1743), 'numpy.zeros', 'np.zeros', (['X.shape[0]'], {}), '(X.shape[0]... |
from tqdm import trange, tqdm
import numpy as np
from polaris2.geomvis import R2toR, R2toC2, R3S2toR, utilsh
import logging
log = logging.getLogger('log')
# Simulates a linear dipole imaged by 4f detection system.
class FourF:
def __init__(self, NA=1.2, M=60, n0=1.3, lamb=0.546, wpx_real=6.5,
npx... | [
"numpy.moveaxis",
"numpy.arctan2",
"numpy.abs",
"numpy.floor",
"numpy.einsum",
"numpy.product",
"numpy.sin",
"numpy.arange",
"polaris2.geomvis.R2toC2.xy",
"numpy.exp",
"numpy.tile",
"numpy.linalg.svd",
"numpy.fft.rfft2",
"numpy.fft.ifft2",
"numpy.fft.ifftshift",
"numpy.meshgrid",
"po... | [((130, 154), 'logging.getLogger', 'logging.getLogger', (['"""log"""'], {}), "('log')\n", (147, 154), False, 'import logging\n'), ((2123, 2195), 'numpy.einsum', 'np.einsum', (['"""ijkl,l->ijk"""', 'self.h_xyzJ_single_to_xye_bfp', 'dip_orientation'], {}), "('ijkl,l->ijk', self.h_xyzJ_single_to_xye_bfp, dip_orientation)\... |
# GP regression
import numpy as np
from sklearn.metrics import pairwise_distances
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import pickle
import os
def make_K_SE(x, sigma, l):
# using SE kernel def given in Murphy pg. 521
# get pairwise distances
km = pairwise_distances(x.res... | [
"pickle.dump",
"numpy.sum",
"numpy.sin",
"numpy.tile",
"numpy.exp",
"numpy.linalg.solve",
"numpy.meshgrid",
"numpy.zeros_like",
"numpy.multiply",
"matplotlib.pyplot.close",
"matplotlib.pyplot.colorbar",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"numpy.cos",
"numpy.squeeze",
"nump... | [((547, 564), 'numpy.tile', 'np.tile', (['xstar', 'N'], {}), '(xstar, N)\n', (554, 564), True, 'import numpy as np\n'), ((1399, 1413), 'numpy.array', 'np.array', (['[x1]'], {}), '([x1])\n', (1407, 1413), True, 'import numpy as np\n'), ((1423, 1437), 'numpy.array', 'np.array', (['[x2]'], {}), '([x2])\n', (1431, 1437), T... |
from _commons import warn, error, create_dir_path
import numpy as np
import time
from movielens import MovieLens
import random
#'binary_unknown'
class LinUserbase:
def __init__(self, alpha, dataset=None, max_items=500, allow_selecting_known_arms=True, fixed_rewards=True,
prob_reward_p... | [
"numpy.sum",
"numpy.zeros",
"numpy.identity",
"movielens.MovieLens",
"time.time",
"numpy.argsort",
"numpy.isnan",
"numpy.max",
"numpy.where",
"numpy.array",
"numpy.linalg.inv",
"numpy.matmul",
"numpy.random.choice",
"numpy.argwhere",
"numpy.dot",
"numpy.intersect1d",
"numpy.linalg.no... | [((934, 981), 'numpy.random.choice', 'np.random.choice', (['self.users_with_unrated_items'], {}), '(self.users_with_unrated_items)\n', (950, 981), True, 'import numpy as np\n'), ((1117, 1165), 'numpy.zeros', 'np.zeros', ([], {'shape': '(self.dataset.num_items, self.d)'}), '(shape=(self.dataset.num_items, self.d))\n', (... |
"""
The contents of this module are currently experimental and under active
development. More thorough documentation will be done when its development has
settled.
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
fr... | [
"numpy.minimum",
"time.time",
"numpy.arange",
"py_search.informed.best_first_search",
"inspect.getargspec",
"itertools.product",
"py_search.utils.compare_searches",
"numpy.add"
] | [((1348, 1374), 'numpy.arange', 'np.arange', (['(target.size + 1)'], {}), '(target.size + 1)\n', (1357, 1374), True, 'import numpy as np\n'), ((16352, 16405), 'py_search.utils.compare_searches', 'compare_searches', (['[problem, problem2]', '[cost_limited]'], {}), '([problem, problem2], [cost_limited])\n', (16368, 16405... |
#!/usr/bin/env python3
"""Test script for algorithm_rgb code
"""
import os
import sys
import numpy as np
import gdal
import algorithm_rgb
def _get_variables_header_fields() -> str:
"""Returns a string representing the variable header fields
Return:
Returns a string representing the variables' heade... | [
"numpy.rollaxis",
"os.path.basename",
"os.path.isdir",
"algorithm_rgb.VARIABLE_UNITS.split",
"os.path.exists",
"gdal.Open",
"algorithm_rgb.VARIABLE_NAMES.split",
"algorithm_rgb.VARIABLE_LABELS.split",
"sys.stderr.write",
"os.path.join",
"os.listdir"
] | [((353, 392), 'algorithm_rgb.VARIABLE_NAMES.split', 'algorithm_rgb.VARIABLE_NAMES.split', (['""","""'], {}), "(',')\n", (387, 392), False, 'import algorithm_rgb\n'), ((406, 446), 'algorithm_rgb.VARIABLE_LABELS.split', 'algorithm_rgb.VARIABLE_LABELS.split', (['""","""'], {}), "(',')\n", (441, 446), False, 'import algori... |
# Copyright 2016 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... | [
"tensorflow.contrib.testing.python.framework.util_test.latest_events",
"tensorflow.python.util.compat.as_bytes",
"tensorflow.contrib.learn.Estimator",
"tensorflow.contrib.learn.python.learn.estimators.estimator.SKCompat",
"tensorflow.contrib.learn.python.learn.estimators.estimator.GraphRewriteSpec",
"nump... | [((3461, 3479), 'tensorflow.contrib.learn.python.learn.datasets.base.load_boston', 'base.load_boston', ([], {}), '()\n', (3477, 3479), False, 'from tensorflow.contrib.learn.python.learn.datasets import base\n'), ((3775, 3791), 'tensorflow.contrib.learn.python.learn.datasets.base.load_iris', 'base.load_iris', ([], {}), ... |
#!/usr/bin/python
# BSD 3-Clause License
# Copyright (c) 2019, <NAME>
# 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 notice, t... | [
"numpy.zeros",
"cv2.resize"
] | [((2055, 2124), 'cv2.resize', 'cv2.resize', (['image'], {'dsize': '(width, height)', 'interpolation': 'interpolation'}), '(image, dsize=(width, height), interpolation=interpolation)\n', (2065, 2124), False, 'import cv2\n'), ((5232, 5300), 'numpy.zeros', 'np.zeros', (['(preprocessed_image.shape[0], preprocessed_image.sh... |
#===============================WIMPFuncs.py===================================#
# Created by <NAME> 2020
# Contains all the functions for doing the WIMPy calculations
#==============================================================================#
import numpy as np
from numpy import pi, sqrt, exp, zeros, size, sha... | [
"numpy.size",
"numpy.zeros_like",
"numpy.zeros",
"scipy.special.erf",
"numpy.exp",
"numpy.log10",
"numpy.sqrt"
] | [((2588, 2605), 'numpy.zeros_like', 'zeros_like', (['v_min'], {}), '(v_min)\n', (2598, 2605), False, 'from numpy import nan, isnan, column_stack, amin, amax, zeros_like\n'), ((4594, 4606), 'numpy.size', 'size', (['m_vals'], {}), '(m_vals)\n', (4598, 4606), False, 'from numpy import pi, sqrt, exp, zeros, size, shape, ar... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import pycocotools.coco as coco
import numpy as np
import torch
import json
import cv2
import os
from utils.image import flip, color_aug
from utils.image import get_affine_transf... | [
"math.ceil",
"numpy.random.randn",
"numpy.zeros",
"utils.image.color_aug",
"numpy.clip",
"cv2.imread",
"cv2.warpAffine",
"numpy.random.randint",
"numpy.array",
"numpy.random.random",
"utils.image.affine_transform",
"utils.image.get_affine_transform",
"numpy.arange",
"os.path.join"
] | [((556, 634), 'numpy.array', 'np.array', (['[box[0], box[1], box[0] + box[2], box[1] + box[3]]'], {'dtype': 'np.float32'}), '([box[0], box[1], box[0] + box[2], box[1] + box[3]], dtype=np.float32)\n', (564, 634), True, 'import numpy as np\n'), ((951, 1000), 'os.path.join', 'os.path.join', (['self.img_dir', "img_info['fi... |
import matplotlib.pyplot as plt
import numpy as np
import gpflow
import os
plt.style.use('ggplot')
N = 12
X = np.random.rand(N,1)
Y = np.sin(12*X) + 0.66*np.cos(25*X) + np.random.randn(N,1)*0.1 + 3
k = gpflow.kernels.Matern52(1, lengthscales=0.3)
m = gpflow.models.GPR(X, Y, kern=k)
m.likelihood.variance... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.plot",
"numpy.random.randn",
"gpflow.models.GPR",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.linspace",
"numpy.cos",
"numpy.random.rand",
"gpflow.kernels.Matern52",
"matplotlib.pyplot.savefig",
"numpy.sqrt"
] | [((81, 104), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (94, 104), True, 'import matplotlib.pyplot as plt\n'), ((120, 140), 'numpy.random.rand', 'np.random.rand', (['N', '(1)'], {}), '(N, 1)\n', (134, 140), True, 'import numpy as np\n'), ((216, 260), 'gpflow.kernels.Matern52... |
import numpy as np
def wls_eval(y, x, w=None):
"""
Method to evaluate error using weighted least squares method (WLS)
:param y: Array to evaluate error
:type y: numpy array (np.ndarray)
:param x: Array to evaluate error
:type x: numpy array (np.ndarray)
:param w: Weight array. If no argume... | [
"numpy.ones"
] | [((567, 591), 'numpy.ones', 'np.ones', (['(y.shape[0], 1)'], {}), '((y.shape[0], 1))\n', (574, 591), True, 'import numpy as np\n')] |
# ---- moveable.py -------------------------------------------------------------
import numpy as np
import os
import unittest
import h5py
from psgeom import moveable
def test_translation_matrix_from_vector():
x = np.random.randint(0,5,size=(3))
y = np.random.randint(0,5,size=(3))
yp = np.o... | [
"psgeom.moveable._angles_from_rotated_frame",
"numpy.abs",
"numpy.eye",
"numpy.ones",
"psgeom.moveable._rotation_matrix_from_angles",
"numpy.random.randint",
"numpy.array",
"numpy.random.rand",
"numpy.dot",
"numpy.testing.assert_array_almost_equal",
"psgeom.moveable._translation_matrix_from_vect... | [((226, 257), 'numpy.random.randint', 'np.random.randint', (['(0)', '(5)'], {'size': '(3)'}), '(0, 5, size=3)\n', (243, 257), True, 'import numpy as np\n'), ((270, 301), 'numpy.random.randint', 'np.random.randint', (['(0)', '(5)'], {'size': '(3)'}), '(0, 5, size=3)\n', (287, 301), True, 'import numpy as np\n'), ((316, ... |
from __future__ import division, print_function
import abc
import numpy as np
from menpo.image import Image
from menpo.feature import sparse_hog
from menpo.visualize import print_dynamic, progress_bar_str
from menpofit.base import noisy_align, build_sampling_grid
from menpofit.fittingresult import (NonParametricFittin... | [
"numpy.sum",
"numpy.asarray",
"numpy.zeros",
"menpo.image.Image.init_blank",
"menpofit.base.build_sampling_grid",
"numpy.hstack",
"menpofit.fittingresult.ParametricFittingResult",
"menpo.visualize.progress_bar_str",
"menpofit.fittingresult.NonParametricFittingResult",
"menpofit.fittingresult.SemiP... | [((9627, 9669), 'menpo.image.Image.init_blank', 'Image.init_blank', (['self.patch_shape'], {'fill': '(0)'}), '(self.patch_shape, fill=0)\n', (9643, 9669), False, 'from menpo.image import Image\n'), ((10289, 10368), 'menpofit.fittingresult.NonParametricFittingResult', 'NonParametricFittingResult', (['image', 'self'], {'... |
# Copyright (c) OpenMMLab. All rights reserved.
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" # see issue #152
os.environ["CUDA_VISIBLE_DEVICES"]="2,3"
import argparse
import os
import os.path as osp
import time
import warnings
import mmcv
from numpy.core.fromnumeric import argmax
import torch
from mmcv im... | [
"mmcv.runner.get_dist_info",
"mmdet.datasets.replace_ImageToTensor",
"argparse.ArgumentParser",
"numpy.argmax",
"mmcv.image.tensor2imgs",
"sklearn.metrics.classification_report",
"mmcv.utils.import_modules_from_strings",
"mmcv.Config.fromfile",
"mmcv.dump",
"torch.cuda.current_device",
"torch.no... | [((3098, 3166), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""MMDet test (and eval) a model"""'}), "(description='MMDet test (and eval) a model')\n", (3121, 3166), False, 'import argparse\n'), ((7188, 7216), 'mmcv.Config.fromfile', 'Config.fromfile', (['args.config'], {}), '(args.config... |
# -*- coding: utf-8 -*-
"""Helpers for various transformations."""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD-3-Clause
import os
import os.path as op
import glob
import numpy as np
from copy import deepcopy
from .fixes import jit, mean, _get_img_fdata
from .io.constants import FIFF
fro... | [
"numpy.trace",
"numpy.arctan2",
"numpy.nan_to_num",
"numpy.maximum",
"numpy.sum",
"numpy.abs",
"numpy.empty",
"numpy.allclose",
"dipy.align.reslice.reslice",
"numpy.einsum",
"numpy.ones",
"numpy.array_str",
"os.path.isfile",
"numpy.sin",
"numpy.linalg.norm",
"scipy.linalg.lstsq",
"os... | [((810, 877), 'numpy.array', 'np.array', (['[[0, -1, 0, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]'], {}), '([[0, -1, 0, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])\n', (818, 877), True, 'import numpy as np\n'), ((7951, 7966), 'numpy.asarray', 'np.asarray', (['pts'], {}), '(pts)\n', (7961, 7966), True, 'import nu... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Unit tests for utilities."""
import unittest
from cclib.parser import utils
import numpy
import scipy.spatial.transf... | [
"unittest.main",
"cclib.parser.utils.convertor",
"numpy.eye",
"cclib.parser.utils.get_rotation",
"cclib.parser.utils.WidthSplitter",
"cclib.parser.utils.float",
"numpy.array",
"cclib.parser.utils.PeriodicTable",
"numpy.testing.assert_allclose"
] | [((4533, 4548), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4546, 4548), False, 'import unittest\n'), ((1390, 1413), 'numpy.array', 'numpy.array', (['[-1, 0, 2]'], {}), '([-1, 0, 2])\n', (1401, 1413), False, 'import numpy\n'), ((1431, 1517), 'numpy.array', 'numpy.array', (['[[1.0, 1.0, 1.0], [0.0, 1.0, 2.0], [... |
# Copyright 2018-2020 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... | [
"numpy.allclose",
"pytest.skip",
"numpy.isclose",
"numpy.mean",
"pytest.mark.parametrize"
] | [((13842, 13905), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""init, sgntr, shp"""', 'INIT_KWARGS_SHAPES'], {}), "('init, sgntr, shp', INIT_KWARGS_SHAPES)\n", (13865, 13905), False, 'import pytest\n'), ((14151, 14217), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""init, sgntr, shp"""', 'INI... |
#!/usr/bin/env python
# classify.py: make classification of emotion given input features (in npy files)
# dataset: JSET v1.1
# author: <NAME> (<EMAIL>)
# Changelong
# 20210420: initial commit
# 2021042512: change to dense
# 20210430: use the real text-independent (TI) split
import numpy as np
import tensorflow as t... | [
"tensorflow.random.set_seed",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"numpy.load",
"numpy.random.seed",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.Dense",
"numpy.std",
"tensorflow.keras.Input",
"tensorflow.keras.Model",
"numpy.mean",
"random.seed",
... | [((323, 346), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(221)'], {}), '(221)\n', (341, 346), True, 'import tensorflow as tf\n'), ((362, 378), 'random.seed', 'random.seed', (['(221)'], {}), '(221)\n', (373, 378), False, 'import random\n'), ((379, 398), 'numpy.random.seed', 'np.random.seed', (['(221)'], {}),... |
#!/usr/bin/env python
import numpy as np
import math
from multi_link_common import *
#height is probably 0 from multi_link_common.py
#total mass and total length are also defined in multi_link_common.py
num_links = 5.0
link_length = total_length/num_links
link_mass = total_mass/num_links
ee_location = np.matrix([0.,... | [
"numpy.radians",
"numpy.matrix"
] | [((306, 345), 'numpy.matrix', 'np.matrix', (['[0.0, -total_length, height]'], {}), '([0.0, -total_length, height])\n', (315, 345), True, 'import numpy as np\n'), ((1572, 1609), 'numpy.radians', 'np.radians', (['[180, 120, 120, 120, 120]'], {}), '([180, 120, 120, 120, 120])\n', (1582, 1609), True, 'import numpy as np\n'... |
"""
Authors: <NAME>, <NAME> and <NAME>
All rights reserved, 2017.
"""
from collections import defaultdict, namedtuple
import torch
from skcuda import cublas, cufft
from pynvrtc.compiler import Program
import numpy as np
from cupy.cuda.function import Module
from cupy.cuda import device
from string import Template
St... | [
"torch.cuda.current_stream",
"skcuda.cufft.cufftPlanMany",
"collections.defaultdict",
"cupy.cuda.function.Module",
"numpy.imag",
"string.Template",
"cupy.cuda.device.Device",
"collections.namedtuple",
"numpy.real",
"torch.cuda.current_blas_handle",
"numpy.fft.fft2",
"numpy.fft.ifft2",
"skcud... | [((327, 356), 'collections.namedtuple', 'namedtuple', (['"""Stream"""', "['ptr']"], {}), "('Stream', ['ptr'])\n", (337, 356), False, 'from collections import defaultdict, namedtuple\n'), ((869, 895), 'collections.defaultdict', 'defaultdict', (['(lambda : None)'], {}), '(lambda : None)\n', (880, 895), False, 'from colle... |
import numpy as np
import matplotlib.pyplot as plt
import csv
plt.rcParams.update({'font.size':18})
coefficient = 0.75
with open('fake_fingerprint_mean.csv','r')as f:
f_csv = csv.reader(f)
for row1 in f_csv:
row1 = [float(i) for i in row1]
with open('fake_fingerprint_std.csv','r')as f:
f... | [
"matplotlib.pyplot.show",
"csv.reader",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.rcParams.update",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.fill_between"
] | [((67, 105), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 18}"], {}), "({'font.size': 18})\n", (86, 105), True, 'import matplotlib.pyplot as plt\n'), ((693, 729), 'numpy.arange', 'np.arange', ([], {'start': '(0)', 'stop': '(128)', 'step': '(1)'}), '(start=0, stop=128, step=1)\n', (702, 7... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | [
"os.mkdir",
"os.unlink",
"pyspark.context.SparkContext.getOrCreate",
"pyspark.util.VersionUtils.majorMinorVersion",
"random.shuffle",
"os.getppid",
"socket.socket",
"pyspark.conf.SparkConf",
"collections.defaultdict",
"pyspark.context.SparkContext",
"pyspark.serializers.NoOpSerializer",
"glob.... | [((99178, 99233), 'unittest2.skipIf', 'unittest.skipIf', (['(not _have_scipy)', '"""SciPy not installed"""'], {}), "(not _have_scipy, 'SciPy not installed')\n", (99193, 99233), True, 'import unittest2 as unittest\n'), ((99575, 99630), 'unittest2.skipIf', 'unittest.skipIf', (['(not _have_numpy)', '"""NumPy not installed... |
import torch
import torch.nn as nn
import collections
import numpy as np
import math
import pdb
# Class that handles all the messy hierarchical observation stuff
class HierarchyUtils(object):
def __init__(self, ll_obs_sz, hl_obs_sz, hl_action_space, theta_sz, add_count):
self.ll_obs_sz = ll_obs_sz
... | [
"torch.zeros",
"numpy.expand_dims",
"numpy.concatenate",
"torch.from_numpy"
] | [((1626, 1673), 'numpy.concatenate', 'np.concatenate', (['[ll_raw_obs, thetas, counts]', '(1)'], {}), '([ll_raw_obs, thetas, counts], 1)\n', (1640, 1673), True, 'import numpy as np\n'), ((1709, 1748), 'numpy.concatenate', 'np.concatenate', (['[ll_raw_obs, thetas]', '(1)'], {}), '([ll_raw_obs, thetas], 1)\n', (1723, 174... |
"""
* @file compare_result.py
*
* Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
"""
import numpy a... | [
"numpy.fromfile"
] | [((479, 542), 'numpy.fromfile', 'np.fromfile', (['"""../../result_files/output_0.bin"""'], {'dtype': '"""float16"""'}), "('../../result_files/output_0.bin', dtype='float16')\n", (490, 542), True, 'import numpy as np\n'), ((601, 664), 'numpy.fromfile', 'np.fromfile', (['"""../../result_files/output_1.bin"""'], {'dtype':... |
import numpy as np
import tensorflow as tf
from evaluations.racing_agent import Agent
class RacingAgent(Agent):
def __init__(self, checkpoint_path):
self.load(checkpoint_path)
def action(self, obs, state=None, **kwargs) -> np.ndarray:
observation = tf.constant(obs['lidar'], dtype=tf.float32)... | [
"numpy.ones",
"tensorflow.constant",
"tensorflow.squeeze"
] | [((692, 714), 'numpy.ones', 'np.ones', ([], {'shape': '(1080,)'}), '(shape=(1080,))\n', (699, 714), True, 'import numpy as np\n'), ((277, 320), 'tensorflow.constant', 'tf.constant', (["obs['lidar']"], {'dtype': 'tf.float32'}), "(obs['lidar'], dtype=tf.float32)\n", (288, 320), True, 'import tensorflow as tf\n'), ((381, ... |
'''
@Time :
@Author : <NAME>
@File : demo_3d.py
@Brief :
'''
import argparse
import torch
from pathlib import Path
import numpy as np
from pcdet.config import cfg, cfg_from_yaml_file
from pcdet.datasets.plusai.plusai_bag_dataset import DemoDataset
from pcdet.models import build_network, load_dat... | [
"pcdet.models.load_data_to_gpu",
"argparse.ArgumentParser",
"pcdet.config.cfg_from_yaml_file",
"pcdet.utils.common_utils.create_logger",
"pathlib.Path",
"torch.no_grad",
"numpy.random.shuffle"
] | [((1121, 1149), 'pcdet.utils.common_utils.create_logger', 'common_utils.create_logger', ([], {}), '()\n', (1147, 1149), False, 'from pcdet.utils import common_utils\n'), ((450, 499), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""arg parser"""'}), "(description='arg parser')\n", (473, 49... |
from keras.models import Model
from keras.callbacks import ModelCheckpoint
from keras.layers.recurrent import LSTM
from keras.layers import Dense, Input, Embedding
from keras.preprocessing.sequence import pad_sequences
from collections import Counter
import nltk
import numpy as np
BATCH_SIZE = 64
NUM_EPOCHS = 100
HIDD... | [
"numpy.save",
"keras.preprocessing.sequence.pad_sequences",
"keras.callbacks.ModelCheckpoint",
"numpy.zeros",
"keras.models.Model",
"keras.layers.Dense",
"keras.layers.Embedding",
"keras.layers.recurrent.LSTM",
"keras.layers.Input",
"collections.Counter"
] | [((567, 576), 'collections.Counter', 'Counter', ([], {}), '()\n', (574, 576), False, 'from collections import Counter\n'), ((594, 603), 'collections.Counter', 'Counter', ([], {}), '()\n', (601, 603), False, 'from collections import Counter\n'), ((1565, 1644), 'numpy.save', 'np.save', (['"""models/eng-to-cmn/eng-to-cmn-... |
import matplotlib.pyplot as plt
import numpy as np
def grafico (tempo_inicial, tempo_final, delta_t, frequencia, Valor_medio):
# Data for plotting
t = np.arange(tempo_inicial, tempo_final, delta_t)
s = Valor_medio + np.sin(frequencia * np.pi * t)
#s = t*t - 3*t + 1
fig, ax = plt.... | [
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((168, 214), 'numpy.arange', 'np.arange', (['tempo_inicial', 'tempo_final', 'delta_t'], {}), '(tempo_inicial, tempo_final, delta_t)\n', (177, 214), True, 'import numpy as np\n'), ((316, 330), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (328, 330), True, 'import matplotlib.pyplot as plt\n'), ((515, ... |
import argparse
import os
import time
import timeit
import numpy as np
from rsgd.algo.recur_mech import sgd_recur
from rsgd.common.dat import load_dat
from rsgd.common.logistic import logit_loss
from rsgd.common.logistic import logistic_grad
from rsgd.common.logistic import logistic_test
from rsgd.common.svm import hsv... | [
"numpy.zeros_like",
"numpy.flip",
"argparse.ArgumentParser",
"numpy.log",
"numpy.random.randn",
"timeit.default_timer",
"numpy.square",
"numpy.zeros",
"time.strftime",
"rsgd.common.dat.load_dat",
"rsgd.algo.recur_mech.sgd_recur",
"numpy.min",
"numpy.mean",
"numpy.array",
"numpy.linspace"... | [((657, 679), 'numpy.min', 'np.min', (['dp_eps'], {'axis': '(1)'}), '(dp_eps, axis=1)\n', (663, 679), True, 'import numpy as np\n'), ((765, 799), 'os.path.join', 'os.path.join', (['args.data_dir', 'dname'], {}), '(args.data_dir, dname)\n', (777, 799), False, 'import os\n'), ((811, 869), 'rsgd.common.dat.load_dat', 'loa... |
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import cv2
import numpy as np
import utils
from numpy import matrix as mat
def generate_3d_points(spread=0.06 , npoints=3):
ax=np.linspace(-spread,spread,npoints)
xx,yy=np.meshgrid(ax,ax)
return np.vstack((xx.flatten(),yy.flatten(),np.zeros(len(ax)**2)... | [
"numpy.matrix",
"numpy.meshgrid",
"cv2.waitKey",
"utils.eulerAnglesToRotationMatrix",
"numpy.zeros",
"cv2.Rodrigues",
"numpy.array",
"pdb.set_trace",
"numpy.linspace",
"cv2.rectangle",
"cv2.imshow"
] | [((187, 224), 'numpy.linspace', 'np.linspace', (['(-spread)', 'spread', 'npoints'], {}), '(-spread, spread, npoints)\n', (198, 224), True, 'import numpy as np\n'), ((233, 252), 'numpy.meshgrid', 'np.meshgrid', (['ax', 'ax'], {}), '(ax, ax)\n', (244, 252), True, 'import numpy as np\n'), ((370, 381), 'numpy.zeros', 'np.z... |
from autoarray.structures.arrays.two_d import array_2d
from autoarray.structures.grids.two_d import grid_2d_pixelization
from autoarray.inversion import mapper_util
from autoarray.structures.grids.two_d import grid_2d_util
from autoarray.structures.arrays.two_d import array_2d_util
import itertools
import numpy... | [
"numpy.full",
"autoarray.inversion.mapper_util.mapping_matrix_from",
"autoarray.inversion.mapper_util.adaptive_pixel_signals_from",
"autoarray.structures.grids.two_d.grid_2d_util.grid_pixel_indexes_2d_slim_from",
"itertools.chain.from_iterable",
"autoarray.inversion.mapper_util.pixelization_index_for_voro... | [((5179, 5511), 'autoarray.inversion.mapper_util.mapping_matrix_from', 'mapper_util.mapping_matrix_from', ([], {'pixelization_index_for_sub_slim_index': 'self.pixelization_index_for_sub_slim_index', 'pixels': 'self.pixels', 'total_mask_pixels': 'self.source_grid_slim.mask.pixels_in_mask', 'slim_index_for_sub_slim_index... |
import os.path as op
import numpy as np
import argparse
import matplotlib.pyplot as plt
from pandas import read_csv
from tqdm import tqdm
from mne.io import read_raw_edf, read_raw_bdf
from mne import Annotations, events_from_annotations
def _find_pd_candidates(pd, sfreq, chunk, baseline, zscore, min_i, overlap,
... | [
"matplotlib.pyplot.title",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.isnan",
"numpy.round",
"mne.events_from_annotations",
"numpy.std",
"numpy.cumsum",
"matplotlib.pyplot.show",
"numpy.median",
"mne.io.read_raw_bdf",
"matplotlib.pyplot.ylabel",
"numpy.quantile",
"matplotlib.pypl... | [((4016, 4032), 'numpy.median', 'np.median', (['diffs'], {}), '(diffs)\n', (4025, 4032), True, 'import numpy as np\n'), ((9813, 9823), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (9821, 9823), True, 'import matplotlib.pyplot as plt\n'), ((11105, 11130), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ... |
import cv2
import numpy as np
import tensorflow as tf
import dataset.plots as pl
import dataset.dataloader as dl
tf.random.set_seed(0)
from dataset.coco import cn as cfg
cfg.DATASET.INPUT_SHAPE = [512, 384, 3]
cfg.DATASET.NORM = False
cfg.DATASET.BGR = True
cfg.DATASET.HALF_BODY_PROB = 1.
ds = dl.load_tfds(cfg, 'va... | [
"tensorflow.random.set_seed",
"numpy.uint8",
"numpy.sum",
"cv2.waitKey",
"cv2.destroyAllWindows",
"dataset.dataloader.load_tfds"
] | [((115, 136), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(0)'], {}), '(0)\n', (133, 136), True, 'import tensorflow as tf\n'), ((299, 393), 'dataset.dataloader.load_tfds', 'dl.load_tfds', (['cfg', '"""val"""'], {'det': '(False)', 'predict_kp': '(True)', 'drop_remainder': '(False)', 'visualize': '(True)'}), "... |
#!/usr/bin/env python3
# Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
import argparse
import base64
import h5py
import logging
import numpy as np
import PIL.Image
import os
import sys
try:
from io import StringIO
except ImportError:
from io import StringIO
# Add path for DIGITS package
s... | [
"digits.utils.image.image_to_array",
"h5py.File",
"os.path.abspath",
"io.StringIO",
"argparse.ArgumentParser",
"digits.job.Job.load",
"os.path.isdir",
"caffe_pb2.Datum",
"numpy.empty",
"digits.inference.errors.InferenceError",
"digits.utils.image.resize_image",
"digits.utils.lmdbreader.DbReade... | [((718, 761), 'logging.getLogger', 'logging.getLogger', (['"""digits.tools.inference"""'], {}), "('digits.tools.inference')\n", (735, 761), False, 'import logging\n'), ((1305, 1337), 'os.path.join', 'os.path.join', (['jobs_dir', 'model_id'], {}), '(jobs_dir, model_id)\n', (1317, 1337), False, 'import os\n'), ((1349, 13... |
from __future__ import division
from __future__ import print_function
import time
import os
import warnings
# Train on CPU (hide GPU) due to memory constraints
os.environ['CUDA_VISIBLE_DEVICES'] = ""
import tensorflow as tf
from tensorboard.plugins.hparams import api as hp
import numpy as np
import scipy.sparse as s... | [
"os.mkdir",
"input_data.load_data",
"time.strftime",
"tensorflow.compat.v1.placeholder_with_default",
"scipy.sparse.eye",
"outputs.save_adj",
"preprocessing.preprocess_graph",
"tensorflow.sparse.to_dense",
"os.path.exists",
"train.train_test_model",
"scipy.sparse.identity",
"model.GCNModelAE",... | [((3056, 3149), 'input_data.load_data', 'load_data', (['norm_expression_path', 'gold_standard_path', 'model_timestamp', 'FLAGS.random_prior'], {}), '(norm_expression_path, gold_standard_path, model_timestamp, FLAGS.\n random_prior)\n', (3065, 3149), False, 'from input_data import load_data\n'), ((3419, 3539), 'prepr... |
"""Testing for Spectral Clustering methods"""
from cPickle import dumps, loads
import numpy as np
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_great... | [
"sklearn.utils.testing.assert_raises",
"sklearn.cluster.SpectralClustering",
"sklearn.metrics.pairwise_distances",
"sklearn.utils.testing.assert_equal",
"numpy.ones",
"numpy.random.RandomState",
"cPickle.dumps",
"scipy.sparse.coo_matrix",
"numpy.max",
"numpy.array",
"numpy.mean",
"sklearn.clus... | [((714, 894), 'numpy.array', 'np.array', (['[[1, 5, 2, 1, 0, 0, 0], [5, 1, 3, 1, 0, 0, 0], [2, 3, 1, 1, 0, 0, 0], [1, 1,\n 1, 1, 2, 1, 1], [0, 0, 0, 2, 2, 3, 2], [0, 0, 0, 1, 3, 1, 4], [0, 0, 0,\n 1, 2, 4, 1]]'], {}), '([[1, 5, 2, 1, 0, 0, 0], [5, 1, 3, 1, 0, 0, 0], [2, 3, 1, 1, 0, 0, \n 0], [1, 1, 1, 1, 2, 1,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""templates.py -- A set of predefined "base" prospector model specifications
that can be used as a starting point and then combined or altered.
"""
from copy import deepcopy
import numpy as np
from . import priors
from . import transforms
__all__ = ["TemplateLibrary",
... | [
"numpy.full",
"copy.deepcopy",
"numpy.ones_like",
"numpy.zeros",
"numpy.array",
"numpy.arange",
"numpy.log10"
] | [((21866, 21914), 'numpy.array', 'np.array', (['[1e-09, 0.1, 0.3, 1.0, 3.0, 6.0, 13.6]'], {}), '([1e-09, 0.1, 0.3, 1.0, 3.0, 6.0, 13.6])\n', (21874, 21914), True, 'import numpy as np\n'), ((2509, 2536), 'numpy.arange', 'np.arange', (['(ncomp - 1)', '(0)', '(-1)'], {}), '(ncomp - 1, 0, -1)\n', (2518, 2536), True, 'impor... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | [
"numpy.meshgrid",
"batch_science.measurement_utils.compute_steps_to_result",
"numpy.where",
"numpy.array",
"numpy.log10",
"numpy.sqrt",
"matplotlib.pyplot.subplots",
"batch_science.measurement_utils.get_index_values"
] | [((1208, 1269), 'matplotlib.pyplot.subplots', 'plt.subplots', (['nrows', 'ncols'], {'figsize': '(plot_width, plot_height)'}), '(nrows, ncols, figsize=(plot_width, plot_height))\n', (1220, 1269), True, 'import matplotlib.pyplot as plt\n'), ((4179, 4226), 'batch_science.measurement_utils.get_index_values', 'get_index_val... |
import psyneulink as pnl
import numpy as np
colors_input_layer = pnl.TransferMechanism(size=3,
function=pnl.Linear,
name='COLORS_INPUT')
words_input_layer = pnl.TransferMechanism(size=3,
fu... | [
"numpy.array",
"psyneulink.Logistic",
"psyneulink.Composition",
"psyneulink.TransferMechanism"
] | [((67, 138), 'psyneulink.TransferMechanism', 'pnl.TransferMechanism', ([], {'size': '(3)', 'function': 'pnl.Linear', 'name': '"""COLORS_INPUT"""'}), "(size=3, function=pnl.Linear, name='COLORS_INPUT')\n", (88, 138), True, 'import psyneulink as pnl\n'), ((246, 316), 'psyneulink.TransferMechanism', 'pnl.TransferMechanism... |
import os
import sys
try: import commands
except: pass
import numpy as np
import time
import math
import multiprocessing as mp
import itertools
nn = "\n"
tt = "\t"
ss = "/"
cc = ","
def main():
#[1]
subentwork_identifier_obj = SubnetworkIdentifier()
##End main
from sklearn.cluster import AgglomerativeClustering... | [
"os.path.exists",
"os.system",
"sklearn.mixture.GaussianMixture",
"itertools.combinations",
"numpy.array",
"sys.exit",
"commands.getoutput"
] | [((4712, 4732), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (4726, 4732), False, 'import os\n'), ((5159, 5169), 'sys.exit', 'sys.exit', ([], {}), '()\n', (5167, 5169), False, 'import sys\n'), ((1990, 2041), 'itertools.combinations', 'itertools.combinations', (['geneset_obj.gene_id_list', '(2)'], {})... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import torch.optim as optim
import time
import os
import numpy as np
from tqdm.auto import tqdm, trange
from collections import OrderedDict
import warnings
NUM_CONV_LAYERS = [1,2,3,4] #2
... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.MaxPool2d",
"numpy.power",
"torch.nn.Conv2d",
"torch.nn.CrossEntropyLoss",
"numpy.array",
"numpy.arange",
"torch.nn.Linear",
"numpy.squeeze",
"torch.nn.AvgPool2d",
"collections.OrderedDict"
] | [((725, 750), 'numpy.power', 'np.power', (['(10)', 'log_dropout'], {}), '(10, log_dropout)\n', (733, 750), True, 'import numpy as np\n'), ((2944, 2969), 'numpy.power', 'np.power', (['(10)', 'log_dropout'], {}), '(10, log_dropout)\n', (2952, 2969), True, 'import numpy as np\n'), ((9923, 9944), 'torch.nn.CrossEntropyLoss... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 25 18:04:49 2018
@author: Kazuki
"""
import numpy as np
import pandas as pd
import os, gc
from glob import glob
from tqdm import tqdm
import sys
sys.path.append(f'/home/{os.environ.get("USER")}/PythonLibrary')
import lgbextension as ex
import lig... | [
"utils.send_line",
"utils.stop_instance",
"utils.load_target",
"numpy.random.seed",
"pandas.read_csv",
"utils.postprocess",
"gc.collect",
"utils.start",
"numpy.random.randint",
"utils.savefig_sub",
"numpy.mean",
"glob.glob",
"multiprocessing.cpu_count",
"pandas.DataFrame",
"numpy.std",
... | [((399, 420), 'utils.start', 'utils.start', (['__file__'], {}), '(__file__)\n', (410, 420), False, 'import utils, utils_metric\n'), ((635, 658), 'numpy.random.randint', 'np.random.randint', (['(9999)'], {}), '(9999)\n', (652, 658), True, 'import numpy as np\n'), ((659, 679), 'numpy.random.seed', 'np.random.seed', (['SE... |
from __future__ import print_function
import torch
from PIL import Image
import inspect
import re
import numpy as np
import os
import time
import collections
import torch.nn as nn
import sys
import math
from torch.nn.modules.module import _addindent
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
... | [
"os.remove",
"os.makedirs",
"math.sqrt",
"numpy.median",
"numpy.std",
"os.path.exists",
"torch.nn.modules.module._addindent",
"numpy.transpose",
"time.time",
"torch.abs",
"numpy.min",
"numpy.mean",
"numpy.max",
"inspect.currentframe",
"PIL.Image.fromarray",
"re.search"
] | [((1090, 1118), 'PIL.Image.fromarray', 'Image.fromarray', (['image_numpy'], {}), '(image_numpy)\n', (1105, 1118), False, 'from PIL import Image\n'), ((1767, 1838), 're.search', 're.search', (['"""\\\\bvarname\\\\s*\\\\(\\\\s*([A-Za-z_][A-Za-z0-9_]*)\\\\s*\\\\)"""', 'line'], {}), "('\\\\bvarname\\\\s*\\\\(\\\\s*([A-Za-z... |
"""
Functions to convert between local enu, local llh, and global xyz coordinates
Translated from Matlab
"""
import numpy as np
from . import datums
def xyz2llh(xyz, datum=(0, 0)):
"""
XYZ2LLH calculates longitude, latitude, and height from global cartesisan coordinates.
LLH = xyz2llh(XYZ, DATUM) calcula... | [
"numpy.divide",
"numpy.multiply",
"numpy.arctan2",
"numpy.square",
"numpy.isnan",
"numpy.shape",
"numpy.sin",
"numpy.array",
"numpy.linalg.inv",
"numpy.cos",
"numpy.reshape",
"numpy.dot"
] | [((1649, 1681), 'numpy.arctan2', 'np.arctan2', (['xyz[:, 1]', 'xyz[:, 0]'], {}), '(xyz[:, 1], xyz[:, 0])\n', (1659, 1681), True, 'import numpy as np\n'), ((4555, 4587), 'numpy.multiply', 'np.multiply', (['origin', '(np.pi / 180)'], {}), '(origin, np.pi / 180)\n', (4566, 4587), True, 'import numpy as np\n'), ((4597, 461... |
import torch
import numpy
from deep_signature.nn.datasets import DeepSignatureTupletsDataset
from deep_signature.nn.datasets import DeepSignatureEuclideanCurvatureTupletsOnlineDataset
from deep_signature.nn.datasets import DeepSignatureEquiaffineCurvatureTupletsOnlineDataset
from deep_signature.nn.datasets import DeepS... | [
"deep_signature.nn.losses.CurvatureLoss",
"numpy.load",
"argparse.ArgumentParser",
"deep_signature.nn.networks.DeepSignatureCurvatureNet",
"torch.set_default_dtype",
"deep_signature.nn.trainers.ModelTrainer",
"torch.device",
"common.utils.get_latest_subdirectory"
] | [((721, 759), 'torch.set_default_dtype', 'torch.set_default_dtype', (['torch.float64'], {}), '(torch.float64)\n', (744, 759), False, 'import torch\n'), ((774, 790), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (788, 790), False, 'from argparse import ArgumentParser\n'), ((5859, 5874), 'deep_signature.... |
from __future__ import print_function, absolute_import, division
import numpy as np
from numba import unittest_support as unittest
from numba import roc, intp
WAVESIZE = 64
@roc.jit(device=True)
def wave_reduce(val):
tid = roc.get_local_id(0)
laneid = tid % WAVESIZE
width = WAVESIZE // 2
while widt... | [
"numba.unittest_support.main",
"numba.roc.get_local_id",
"numpy.copy",
"numba.roc.jit",
"numpy.zeros",
"numpy.arange",
"numpy.linspace",
"numba.roc.wavebarrier",
"numba.roc.get_group_id"
] | [((178, 198), 'numba.roc.jit', 'roc.jit', ([], {'device': '(True)'}), '(device=True)\n', (185, 198), False, 'from numba import roc, intp\n'), ((231, 250), 'numba.roc.get_local_id', 'roc.get_local_id', (['(0)'], {}), '(0)\n', (247, 250), False, 'from numba import roc, intp\n'), ((534, 551), 'numba.roc.wavebarrier', 'roc... |
# Copyright (c) 2016-present, Facebook, 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 agreed... | [
"functools.partial",
"caffe2.python.core.CreateOperator",
"numpy.finfo",
"hypothesis.strategies.floats"
] | [((1460, 1513), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Normalize"""', '"""X"""', '"""Y"""'], {'axis': 'axis'}), "('Normalize', 'X', 'Y', axis=axis)\n", (1479, 1513), False, 'from caffe2.python import core\n'), ((2206, 2261), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""No... |
"""
Author:
<NAME> <<EMAIL>>
Usage:
make_bb_dist_mats.py dmap [options]
Options:
-p, --pdb <pdb> The PDB file.
-c, --chains <chain-ids> Comma-separated list of chain identifiers
(defaults to the first chain).
-o, --output <file> Save the plot to a f... | [
"pylab.close",
"matplotlib.rc",
"pickle.dump",
"numpy.ma.masked_greater_equal",
"numpy.linalg.norm",
"pylab.gcf",
"pylab.tick_params",
"numpy.set_printoptions",
"pylab.pcolormesh",
"itertools.permutations",
"pylab.ylabel",
"random.seed",
"pylab.ylim",
"pylab.xlabel",
"prody.parsePDB",
... | [((7313, 7351), 'numpy.zeros', 'numpy.zeros', (['(12, 12)'], {'dtype': '"""float64"""'}), "((12, 12), dtype='float64')\n", (7324, 7351), False, 'import numpy\n'), ((8518, 8556), 'numpy.linalg.norm', 'numpy.linalg.norm', (['(a_coords - b_coords)'], {}), '(a_coords - b_coords)\n', (8535, 8556), False, 'import numpy\n'), ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from gym.spaces import Box
import numpy as np
import logging
import ray
import ray.experimental.tf_utils
from ray.rllib.agents.sac.sac_model import SACModel
from ray.rllib.agents.ddpg.noop_model import NoopMod... | [
"ray.rllib.utils.try_import_tf",
"numpy.zeros_like",
"ray.rllib.utils.try_import_tfp",
"ray.rllib.utils.tf_ops.minimize_and_clip",
"ray.rllib.agents.dqn.dqn_policy._postprocess_dqn",
"numpy.prod",
"ray.rllib.models.ModelCatalog.get_model_v2",
"numpy.product",
"numpy.array",
"ray.rllib.policy.tf_po... | [((735, 750), 'ray.rllib.utils.try_import_tf', 'try_import_tf', ([], {}), '()\n', (748, 750), False, 'from ray.rllib.utils import try_import_tf, try_import_tfp\n'), ((757, 773), 'ray.rllib.utils.try_import_tfp', 'try_import_tfp', ([], {}), '()\n', (771, 773), False, 'from ray.rllib.utils import try_import_tf, try_impor... |
import numpy as np
from .MaterialBase import Material
from Florence.Tensor import trace, Voigt
class NeoHookeanBSmith(Material):
"""The fundamental Neo-Hookean internal energy, described in <NAME> et. al.
W(C) = mu/2*(C:I-3) + lamb/2*(J - alpha)**2 - mu/2*ln(C:I + 1)
"""
def __init__(self, ndim,... | [
"numpy.trace",
"numpy.einsum",
"numpy.isclose",
"Florence.MaterialLibrary.LLDispatch._NeoHookean_.KineticMeasures",
"numpy.dot",
"Florence.Tensor.Voigt",
"Florence.Tensor.trace",
"numpy.sqrt"
] | [((1002, 1026), 'Florence.MaterialLibrary.LLDispatch._NeoHookean_.KineticMeasures', 'KineticMeasures', (['self', 'F'], {}), '(self, F)\n', (1017, 1026), False, 'from Florence.MaterialLibrary.LLDispatch._NeoHookean_ import KineticMeasures\n'), ((1425, 1436), 'numpy.trace', 'np.trace', (['b'], {}), '(b)\n', (1433, 1436),... |
import os
import numpy as np
import unittest
from tqdm import trange
from autograd import Tensor, SGD, NLLLoss, fetch_mnist
from autograd import Adam
import autograd.nn as nn
np.random.seed(1)
__optimizers__ = {}
__optimizers__['sgd'] = SGD
__optimizers__['adam'] = Adam
class MNISTNet(nn.Module):
def __init__(s... | [
"autograd.NLLLoss",
"autograd.nn.LogSoftmax",
"autograd.Tensor",
"numpy.random.seed",
"numpy.argmax",
"autograd.fetch_mnist",
"autograd.nn.ReLU",
"numpy.random.randint",
"os.getenv",
"autograd.nn.Dense"
] | [((175, 192), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (189, 192), True, 'import numpy as np\n'), ((380, 398), 'autograd.nn.Dense', 'nn.Dense', (['(784)', '(128)'], {}), '(784, 128)\n', (388, 398), True, 'import autograd.nn as nn\n'), ((416, 425), 'autograd.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (... |
import warnings
warnings.filterwarnings("ignore")
import os
import re
import numpy as np
import scipy.io as io
from util import strs
from dataset.data_util import pil_load_img
from dataset.dataload import TextDataset, TextInstance
import cv2
from util import io as libio
class TotalText(TextDataset):
def __init__... | [
"numpy.stack",
"re.split",
"dataset.data_util.pil_load_img",
"scipy.io.loadmat",
"warnings.filterwarnings",
"util.strs.remove_all",
"dataset.dataload.TextInstance",
"os.path.join",
"os.listdir",
"util.io.read_lines"
] | [((16, 49), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (39, 49), False, 'import warnings\n'), ((785, 854), 'os.path.join', 'os.path.join', (['data_root', '"""Images"""', "('Train' if is_training else 'Test')"], {}), "(data_root, 'Images', 'Train' if is_training else 'T... |
'''
Be careful about action_spec defined here
'''
from collections import OrderedDict
import numpy as np
from grasp.envs import MujocoEnv
from grasp.models.robots import Sawyer
from grasp.utils import transform_utils as T
from grasp.models.grippers import gripper_factory
from termcolor import colored
class Sawy... | [
"grasp.utils.transform_utils.make_pose",
"grasp.models.grippers.gripper_factory",
"grasp.models.robots.Sawyer",
"numpy.ones",
"numpy.clip",
"grasp.utils.transform_utils.pose_inv",
"grasp.utils.transform_utils.pose_in_A_to_pose_in_B",
"numpy.array",
"grasp.utils.transform_utils.mat2quat",
"numpy.si... | [((2658, 2666), 'grasp.models.robots.Sawyer', 'Sawyer', ([], {}), '()\n', (2664, 2666), False, 'from grasp.models.robots import Sawyer\n'), ((4753, 4779), 'numpy.clip', 'np.clip', (['action', 'low', 'high'], {}), '(action, low, high)\n', (4760, 4779), True, 'import numpy as np\n'), ((5517, 5587), 'numpy.array', 'np.arr... |
#!/usr/bin/env python
import logging
import random
import sys
import time
from functools import partial
import os
import numpy as np
from utils.evaluation import eval_with_specific_model
from utils.loader import prepare_datasets
from toolkit.joint_ner_and_md_model import MainTaggerModel
from utils import models_... | [
"toolkit.joint_ner_and_md_model.MainTaggerModel",
"logging.error",
"functools.partial",
"logging.basicConfig",
"random.shuffle",
"utils.evaluation.eval_with_specific_model",
"time.time",
"os.path.isfile",
"numpy.mean",
"sys.stdout.flush",
"utils.loader.prepare_datasets",
"os.path.join",
"log... | [((426, 465), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (445, 465), False, 'import logging\n'), ((475, 500), 'logging.getLogger', 'logging.getLogger', (['"""main"""'], {}), "('main')\n", (492, 500), False, 'import logging\n'), ((658, 697), 'utils.read_param... |
from meta_mb.utils.serializable import Serializable
import numpy as np
from gym.spaces import Box
class ImgWrapperEnv(Serializable):
def __init__(self, env, vae=None,
use_img=True, img_size=(64, 64, 3),
latent_dim=None, time_steps=4):
Serializable.quick_init(self, locals... | [
"numpy.zeros",
"numpy.ones"
] | [((1180, 1248), 'numpy.zeros', 'np.zeros', (['(self._img_size[:-1] + (self._num_chan * self._time_steps,))'], {}), '(self._img_size[:-1] + (self._num_chan * self._time_steps,))\n', (1188, 1248), True, 'import numpy as np\n'), ((1851, 1896), 'numpy.ones', 'np.ones', (['(self._img_size + (self._n_channels,))'], {}), '(se... |
"""
Classes of variables for equations/terms.
"""
from __future__ import print_function
from __future__ import absolute_import
from collections import deque
import numpy as nm
from sfepy.base.base import (real_types, complex_types, assert_, get_default,
output, OneTypeList, Container, Str... | [
"sfepy.discrete.conditions.get_condition_value",
"numpy.ravel",
"numpy.empty",
"numpy.allclose",
"numpy.arange",
"sfepy.discrete.common.dof_info.is_active_bc",
"sfepy.base.base.assert_",
"sfepy.discrete.common.dof_info.DofInfo",
"six.iteritems",
"numpy.unique",
"collections.deque",
"sfepy.disc... | [((1762, 1787), 'sfepy.base.base.get_default', 'get_default', (['var_indx', '{}'], {}), '(var_indx, {})\n', (1773, 1787), False, 'from sfepy.base.base import real_types, complex_types, assert_, get_default, output, OneTypeList, Container, Struct, basestr, iter_dict_of_lists\n'), ((3236, 3283), 'sfepy.base.base.iter_dic... |
#!/usr/bin/env python
#
# ----------------------------------------------------------------------
#
# <NAME>, U.S. Geological Survey
# <NAME>, GNS Science
# <NAME>, University of Chicago
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copyright (c) ... | [
"IntegratorInertia.IntegratorInertia.__init__",
"Quadrature3DLinear.Quadrature3DLinear",
"numpy.array"
] | [((1243, 1281), 'IntegratorInertia.IntegratorInertia.__init__', 'IntegratorInertia.__init__', (['self', 'name'], {}), '(self, name)\n', (1269, 1281), False, 'from IntegratorInertia import IntegratorInertia\n'), ((1359, 1379), 'Quadrature3DLinear.Quadrature3DLinear', 'Quadrature3DLinear', ([], {}), '()\n', (1377, 1379),... |
"""
Parametrized surfaces using a CoordinateMap
"""
import numpy as np
from nose.tools import assert_equal
from nipy.core.api import CoordinateMap, CoordinateSystem
from nipy.core.api import Grid
uv = CoordinateSystem('uv', 'input')
xyz = CoordinateSystem('xyz', 'output')
def parametric_mapping(vals):
"""
P... | [
"nipy.core.api.CoordinateMap",
"enthought.mayavi.mlab.draw",
"nipy.core.api.Grid",
"enthought.mayavi.mlab.mesh",
"numpy.dtype",
"nipy.core.api.CoordinateSystem",
"numpy.random.standard_normal",
"numpy.array"
] | [((204, 235), 'nipy.core.api.CoordinateSystem', 'CoordinateSystem', (['"""uv"""', '"""input"""'], {}), "('uv', 'input')\n", (220, 235), False, 'from nipy.core.api import CoordinateMap, CoordinateSystem\n'), ((242, 275), 'nipy.core.api.CoordinateSystem', 'CoordinateSystem', (['"""xyz"""', '"""output"""'], {}), "('xyz', ... |
import os
import imageio
import argparse
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import utils
def draw_distributions(filename, save_dir, type='mean', node_no=0, save_plots=False, plot_time=0.5):
file_desc = utils.get_file_info(filename)
layer = file_desc['layer_name']
bat... | [
"matplotlib.pyplot.title",
"seaborn.lineplot",
"argparse.ArgumentParser",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"numpy.random.normal",
"utils.load_mean_std_from_file",
"imageio.mimsave",
"utils.get_file_info",
"matplotlib.pyplot.close",
"os.path.exists",
"matplotlib.pyplo... | [((247, 276), 'utils.get_file_info', 'utils.get_file_info', (['filename'], {}), '(filename)\n', (266, 276), False, 'import utils\n'), ((426, 465), 'utils.load_mean_std_from_file', 'utils.load_mean_std_from_file', (['filename'], {}), '(filename)\n', (455, 465), False, 'import utils\n'), ((2471, 2500), 'utils.get_file_in... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: <NAME> October 2018. MGP-Module adapted from Futoma et al. (https://arxiv.org/abs/1706.04152)
"""
import faulthandler
import os.path
import pickle
import sys
from time import time
import traceback
import numpy as np
from sacred import Experiment
from sklearn... | [
"tensorflow.meshgrid",
"tensorflow.slice",
"tensorflow.reduce_sum",
"tensorflow.matrix_band_part",
"numpy.abs",
"tensorflow.trainable_variables",
"numpy.sum",
"numpy.floor",
"tensorflow.reshape",
"tensorflow.logging.set_verbosity",
"tensorflow.diag_part",
"tensorflow.multiply",
"tensorflow.C... | [((938, 959), 'sacred.Experiment', 'Experiment', (['"""MGP-TCN"""'], {}), "('MGP-TCN')\n", (948, 959), False, 'from sacred import Experiment\n'), ((1648, 1678), 'numpy.logical_and', 'np.logical_and', (['mask', 'min_mask'], {}), '(mask, min_mask)\n', (1662, 1678), True, 'import numpy as np\n'), ((1753, 1765), 'numpy.ara... |
import numpy as np
import json
import sys
import os
import activations
import mnist
import utils
# Stop on RuntimeWarning during matrix processing : prevent silent overflows
np.seterr(all='raise')
def feed_forward(X_input: np.ndarray, weights: list, activation_fn: list) -> np.ndarray:
"""Feed fordward the netwo... | [
"numpy.sum",
"numpy.argmax",
"numpy.mean",
"os.path.join",
"activations.listToActivations",
"utils.save",
"mnist.load_data",
"json.loads",
"utils.print_network_visualization",
"numpy.random.randn",
"matplotlib.pyplot.close",
"os.path.dirname",
"numpy.empty_like",
"matplotlib.pyplot.show",
... | [((176, 198), 'numpy.seterr', 'np.seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (185, 198), True, 'import numpy as np\n'), ((1648, 1670), 'numpy.empty_like', 'np.empty_like', (['weights'], {}), '(weights)\n', (1661, 1670), True, 'import numpy as np\n'), ((2296, 2321), 'os.path.dirname', 'os.path.dirname', (... |
'''
REDS dataset
support reading images from lmdb, image folder and memcached
'''
import os.path as osp
import random
import pickle
import logging
import numpy as np
import cv2
import lmdb
import torch
import torch.utils.data as data
import data.util as util
try:
import mc # import memcached
except ImportError:
... | [
"numpy.stack",
"data.util.get_image_paths",
"random.randint",
"mc.pyvector",
"numpy.frombuffer",
"data.util.read_img",
"cv2.imdecode",
"data.util.augment",
"random.choice",
"numpy.transpose",
"mc.MemcachedClient.GetInstance",
"random.random",
"mc.ConvertBuffer",
"lmdb.open",
"cv2.merge",... | [((337, 362), 'logging.getLogger', 'logging.getLogger', (['"""base"""'], {}), "('base')\n", (354, 362), False, 'import logging\n'), ((2504, 2602), 'lmdb.open', 'lmdb.open', (["self.opt['dataroot_GT']"], {'readonly': '(True)', 'lock': '(False)', 'readahead': '(False)', 'meminit': '(False)'}), "(self.opt['dataroot_GT'], ... |
from collections import OrderedDict
from io import StringIO
from itertools import islice
import os
from typing import Any, Callable, Optional, Type
import numpy as np
import pandas._libs.json as json
from pandas._libs.tslibs import iNaT
from pandas.errors import AbstractMethodError
from pandas.core.dtypes.common imp... | [
"pandas.io.formats.printing.pprint_thing",
"pandas.io.common.get_filepath_or_buffer",
"pandas.core.dtypes.common.ensure_str",
"pandas.io.common._stringify_path",
"pandas.io.common._get_handle",
"pandas.DataFrame",
"pandas.io.parsers._validate_integer",
"os.path.exists",
"pandas.isna",
"pandas.core... | [((1537, 1565), 'pandas.io.common._stringify_path', '_stringify_path', (['path_or_buf'], {}), '(path_or_buf)\n', (1552, 1565), False, 'from pandas.io.common import BaseIterator, _get_handle, _infer_compression, _stringify_path, get_filepath_or_buffer\n'), ((18064, 18108), 'pandas.io.common._infer_compression', '_infer_... |
"""Functions to visualize matrices of data."""
import warnings
import matplotlib as mpl
from matplotlib.collections import LineCollection
import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
import pandas as pd
try:
from scipy.cluster import hierarchy
_no_scipy = False
except Impo... | [
"numpy.nanpercentile",
"matplotlib.cm.get_cmap",
"scipy.cluster.hierarchy.linkage",
"matplotlib.pyplot.figure",
"numpy.product",
"numpy.arange",
"matplotlib.pyplot.gca",
"matplotlib.colors.ListedColormap",
"pandas.DataFrame",
"matplotlib.colors.Normalize",
"matplotlib.pyplot.setp",
"numpy.ndim... | [((1723, 1749), 'numpy.zeros', 'np.zeros', (['data.shape', 'bool'], {}), '(data.shape, bool)\n', (1731, 1749), True, 'import numpy as np\n'), ((1983, 2053), 'pandas.DataFrame', 'pd.DataFrame', (['mask'], {'index': 'data.index', 'columns': 'data.columns', 'dtype': 'bool'}), '(mask, index=data.index, columns=data.columns... |
""" Logging to Visdom server """
import numpy as np
import visdom
from .logger import Logger
class BaseVisdomLogger(Logger):
'''
The base class for logging output to Visdom.
***THIS CLASS IS ABSTRACT AND MUST BE SUBCLASSED***
Note that the Visdom server is designed to also handle a serv... | [
"numpy.array",
"visdom.Visdom"
] | [((852, 903), 'visdom.Visdom', 'visdom.Visdom', ([], {'server': "('http://' + server)", 'port': 'port'}), "(server='http://' + server, port=port)\n", (865, 903), False, 'import visdom\n'), ((2347, 2398), 'visdom.Visdom', 'visdom.Visdom', ([], {'server': "('http://' + server)", 'port': 'port'}), "(server='http://' + ser... |
#!/usr/bin/env python
from collections import *
import gym
from gym import spaces
import numpy as np
import pybullet as p
import sys
import time
np.set_printoptions(precision=3, suppress=True, linewidth=10000)
def add_opts(parser):
parser.add_argument('--gui', action='store_true')
parser.add_argument('--delay', ... | [
"numpy.abs",
"pybullet.renderImage",
"numpy.empty",
"pybullet.applyExternalForce",
"gym.spaces.Discrete",
"numpy.sin",
"numpy.linalg.norm",
"pybullet.connect",
"numpy.set_printoptions",
"numpy.copy",
"pybullet.setGravity",
"event_log.EventLog",
"numpy.finfo",
"pybullet.resetBasePositionAnd... | [((147, 211), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)', 'suppress': '(True)', 'linewidth': '(10000)'}), '(precision=3, suppress=True, linewidth=10000)\n', (166, 211), True, 'import numpy as np\n'), ((2008, 2048), 'pybullet.getBasePositionAndOrientation', 'p.getBasePositionAndOrientation... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `hotelling` package."""
import pytest
import numpy as np
import pandas as pd
from pandas.testing import assert_series_equal, assert_frame_equal
from hotelling.stats import hotelling_t2
def test_hotelling_test_array_two_sample():
x = np.asarray([[23, 45... | [
"pandas.DataFrame",
"pandas.read_csv",
"numpy.asarray",
"pandas.Index",
"hotelling.stats.hotelling_t2",
"numpy.array"
] | [((301, 392), 'numpy.asarray', 'np.asarray', (['[[23, 45, 15], [40, 85, 18], [215, 307, 60], [110, 110, 50], [65, 105, 24]]'], {}), '([[23, 45, 15], [40, 85, 18], [215, 307, 60], [110, 110, 50], [65,\n 105, 24]])\n', (311, 392), True, 'import numpy as np\n'), ((397, 494), 'numpy.asarray', 'np.asarray', (['[[277, 230... |
#!/usr/bin/env python3
"""
logistic regression
"""
import numpy as np
from loguru import logger
from scipy.optimize import minimize
from sklearn.utils.extmath import safe_sparse_dot
from scipy.special import logsumexp
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import LabelEncoder, LabelBinar... | [
"numpy.random.randn",
"numpy.zeros",
"numpy.ones",
"numpy.transpose",
"numpy.rint",
"numpy.random.choice"
] | [((1165, 1195), 'numpy.random.randn', 'np.random.randn', (['X.shape[1]', '(1)'], {}), '(X.shape[1], 1)\n', (1180, 1195), True, 'import numpy as np\n'), ((1907, 1932), 'numpy.zeros', 'np.zeros', (['(X.shape[1], 1)'], {}), '((X.shape[1], 1))\n', (1915, 1932), True, 'import numpy as np\n'), ((2496, 2508), 'numpy.rint', 'n... |
import logging
from typing import Any, Dict, List, Text, Tuple, Optional
from rasa.nlu.tokenizers.whitespace_tokenizer import WhitespaceTokenizer
from rasa.nlu.components import Component
from rasa.nlu.config import RasaNLUModelConfig
from rasa.nlu.training_data import Message, TrainingData
from rasa.nlu.tokenizers.to... | [
"rasa.nlu.tokenizers.whitespace_tokenizer.WhitespaceTokenizer",
"rasa.utils.train_utils.align_tokens",
"rasa.nlu.utils.hugging_face.registry.model_class_dict.keys",
"numpy.array",
"numpy.reshape",
"logging.getLogger"
] | [((594, 621), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (611, 621), False, 'import logging\n'), ((1381, 1402), 'rasa.nlu.tokenizers.whitespace_tokenizer.WhitespaceTokenizer', 'WhitespaceTokenizer', ([], {}), '()\n', (1400, 1402), False, 'from rasa.nlu.tokenizers.whitespace_tokenizer ... |
import os
import sys
import pickle as pkl
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
from utils import *
plt.rcParams['text.usetex'] = True #Let TeX do the typsetting
plt.rcParams['text.latex.preamble'] = [
r'\usepackage{sansmath}', r'\sansmath'
] #Force s... | [
"pickle.dump",
"numpy.percentile",
"matplotlib.pyplot.figure",
"pickle.load",
"numpy.arange",
"numpy.linspace",
"matplotlib.pyplot.subplots_adjust",
"os.path.join"
] | [((16382, 16409), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 6)'}), '(figsize=(10, 6))\n', (16392, 16409), True, 'import matplotlib.pyplot as plt\n'), ((16516, 16593), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'bottom': '(0.18)', 'top': '(0.92)', 'left': '(0.12)', 'right': ... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
import matplotlib.patches as patches
from scipy.interpolate import RectBivariateSpline
from LucasKanade import *
from TemplateCorrection import *
# write your script here, we recommend the above libraries for making your animation
fram... | [
"matplotlib.pyplot.title",
"numpy.load",
"numpy.save",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.gca"
] | [((325, 354), 'numpy.load', 'np.load', (['"""../data/carseq.npy"""'], {}), "('../data/carseq.npy')\n", (332, 354), True, 'import numpy as np\n'), ((391, 419), 'numpy.load', 'np.load', (['"""./carseqrects.npy"""'], {}), "('./carseqrects.npy')\n", (398, 419), True, 'import numpy as np\n'), ((1663, 1708), 'numpy.save', 'n... |
import numpy as np
import h5py
import os
import palettable as pal
palette = pal.wesanderson.Moonrise1_5.mpl_colormap
import networkx as nx
from networkx.drawing.nx_agraph import graphviz_layout
from pylab import *
import matplotlib.pyplot as plt
import matplotlib
class Conf:
outdir = "out"
if __name__ == "__... | [
"h5py.File",
"matplotlib.pyplot.savefig",
"matplotlib.colors.Normalize",
"matplotlib.pyplot.axis",
"networkx.kamada_kawai_layout",
"numpy.shape",
"networkx.grid_2d_graph"
] | [((968, 1020), 'h5py.File', 'h5py.File', (["(conf.outdir + '/run-' + rank + '.h5')", '"""r"""'], {}), "(conf.outdir + '/run-' + rank + '.h5', 'r')\n", (977, 1020), False, 'import h5py\n'), ((1027, 1074), 'matplotlib.colors.Normalize', 'matplotlib.colors.Normalize', ([], {'vmin': '(0.0)', 'vmax': '(4.0)'}), '(vmin=0.0, ... |
import cv2
import numpy as np
import random
from affine_transform.utils import affine_transformation
class RandomTranslate(object):
"""Translate the given image using a randomly chosen amount in the given range.
Args:
shifts (tuple): The amount to translate the image in the x-axis and y-... | [
"affine_transform.utils.affine_transformation",
"cv2.getAffineTransform",
"numpy.array",
"random.randint"
] | [((751, 809), 'numpy.array', 'np.array', (['[[0.0, 0.0], [0.0, 1.0], [1.0, 0.0]]', 'np.float32'], {}), '([[0.0, 0.0], [0.0, 1.0], [1.0, 0.0]], np.float32)\n', (759, 809), True, 'import numpy as np\n'), ((859, 906), 'random.randint', 'random.randint', (['(-self.shifts[0])', 'self.shifts[0]'], {}), '(-self.shifts[0], sel... |
"""
solve the diffusion equation:
phi_t = k phi_{xx}
with a Crank-Nicolson implicit discretization
<NAME> (2013-04-03)
"""
import numpy as np
from scipy import linalg
import matplotlib.pyplot as plt
from diffusion_explicit import Grid1d
import matplotlib as mpl
# Use LaTeX for rendering
mpl.rcParams['mathtext.fo... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"numpy.matrix",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"numpy.ones",
"scipy.linalg.solve_banded",
"numpy.array",
"diffusion_explicit.Grid1d",
"m... | [((3108, 3141), 'numpy.array', 'np.array', (['[32, 64, 128, 256, 512]'], {}), '([32, 64, 128, 256, 512])\n', (3116, 3141), True, 'import numpy as np\n'), ((5901, 5910), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (5908, 5910), True, 'import matplotlib.pyplot as plt\n'), ((5962, 5978), 'diffusion_explicit.Grid... |
############################################################################################
#
# Project: Peter Moss Acute Myeloid & Lymphoblastic Leukemia AI Research Project
# Repository: ALL Detection System 2020
# Project: AllDS2020 CNN
#
# Author: <NAME> (<EMAIL>)
# Contributors:
# Title: ... | [
"numpy.dstack",
"numpy.random.seed",
"os.path.basename",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"cv2.imread",
"pathlib.Path",
"random.seed",
"numpy.array",
"numpy.reshape",
"Classes.Helpers.Helpers",
"sklearn.utils.shuffle",
"Classes.Augmentation.A... | [((1238, 1260), 'Classes.Helpers.Helpers', 'Helpers', (['"""Data"""', '(False)'], {}), "('Data', False)\n", (1245, 1260), False, 'from Classes.Helpers import Helpers\n'), ((1413, 1428), 'numpy.random.seed', 'seed', (['self.seed'], {}), '(self.seed)\n', (1417, 1428), False, 'from numpy.random import seed\n'), ((1437, 14... |
import networkx as nx
import random
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import math
import time
import sys
G = nx.Graph()
ListI = []
ListSI = []
lam = 0.6
mu = 1.0
global tGlobal
tGlobal = 0
c = 0
NUMBEROFNODE = int(1e4)
MAXNEIGHBORCOUNT = 100
def Init_Data(G,ListI):
... | [
"numpy.random.binomial",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"math.pow",
"time.perf_counter",
"random.choice",
"networkx.Graph"
] | [((159, 169), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (167, 169), True, 'import networkx as nx\n'), ((332, 373), 'numpy.random.binomial', 'np.random.binomial', (['(1)', '(0.95)', 'NUMBEROFNODE'], {}), '(1, 0.95, NUMBEROFNODE)\n', (350, 373), True, 'import numpy as np\n'), ((2534, 2554), 'random.choice', 'random... |
""" Models that use various Approximate Nearest Neighbours libraries in order to quickly
generate recommendations and lists of similar items.
See http://www.benfrederickson.com/approximate-nearest-neighbours-for-recommender-systems/
"""
import itertools
import logging
import numpy
from implicit.als import Alternatin... | [
"faiss.GpuIndexIVFFlat",
"nmslib.init",
"faiss.IndexIVFFlat",
"faiss.StandardGpuResources",
"numpy.append",
"faiss.IndexFlat",
"numpy.linalg.norm",
"numpy.arange",
"numpy.array",
"annoy.AnnoyIndex",
"numpy.delete",
"logging.getLogger",
"numpy.sqrt"
] | [((1098, 1132), 'numpy.linalg.norm', 'numpy.linalg.norm', (['factors'], {'axis': '(1)'}), '(factors, axis=1)\n', (1115, 1132), False, 'import numpy\n'), ((1270, 1308), 'numpy.sqrt', 'numpy.sqrt', (['(max_norm ** 2 - norms ** 2)'], {}), '(max_norm ** 2 - norms ** 2)\n', (1280, 1308), False, 'import numpy\n'), ((6135, 61... |
from typing import List, Tuple
import cv2
import imutils
import numpy as np
def adaptively_match_digit_hypotheses(template: np.ndarray, image: np.ndarray, scale_iterations: int = 10,
scale_min: float = 0.5, scale_max: float = 1.0,
match_thre... | [
"numpy.where",
"numpy.linspace",
"cv2.matchTemplate"
] | [((596, 647), 'numpy.linspace', 'np.linspace', (['scale_min', 'scale_max', 'scale_iterations'], {}), '(scale_min, scale_max, scale_iterations)\n', (607, 647), True, 'import numpy as np\n'), ((952, 1010), 'cv2.matchTemplate', 'cv2.matchTemplate', (['resized', 'template', 'cv2.TM_CCOEFF_NORMED'], {}), '(resized, template... |
import numpy as np
from tslearn.metrics import cdist_gak
from tslearn.svm import TimeSeriesSVC, TimeSeriesSVR
__author__ = '<NAME> <EMAIL>[<EMAIL>'
def test_gamma_value_svm():
n, sz, d = 5, 10, 3
rng = np.random.RandomState(0)
time_series = rng.randn(n, sz, d)
labels = rng.randint(low=0, high=2, siz... | [
"numpy.testing.assert_allclose",
"numpy.random.RandomState",
"numpy.sqrt"
] | [((214, 238), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (235, 238), True, 'import numpy as np\n'), ((848, 872), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (869, 872), True, 'import numpy as np\n'), ((729, 777), 'numpy.testing.assert_allclose', 'np.tes... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2021.
#
# 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 modifications or derivat... | [
"qiskit.aqua.utils.validation.validate_min",
"qiskit.QuantumCircuit",
"qiskit.aqua.operators.evolution_instruction",
"numpy.logical_not",
"numpy.zeros",
"qiskit.aqua.operators.suzuki_expansion_slice_pauli_list",
"numpy.where",
"qiskit.aqua.utils.validation.validate_in_set",
"qiskit.ClassicalRegister... | [((1532, 1559), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1549, 1559), False, 'import logging\n'), ((3508, 3559), 'qiskit.aqua.utils.validation.validate_min', 'validate_min', (['"""num_time_slices"""', 'num_time_slices', '(1)'], {}), "('num_time_slices', num_time_slices, 1)\n", (352... |
# 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... | [
"strawberryfields.Engine",
"numpy.random.seed",
"numpy.ravel",
"pytest.mark.skipif",
"strawberryfields.ops.MSgate",
"pytest.mark.parametrize",
"strawberryfields.ops.BSgate",
"strawberryfields.ops.Coherent",
"strawberryfields.ops.MeasureHomodyne",
"strawberryfields.Program",
"strawberryfields.ops... | [((1300, 1318), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (1314, 1318), True, 'import numpy as np\n'), ((1354, 1414), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""name,expected"""', 'eng_backend_params'], {}), "('name,expected', eng_backend_params)\n", (1377, 1414), False, 'import ... |
"""Desk environment with Franka Panda arm."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from dm_control import mujoco
from dm_control.utils import inverse_kinematics
import gym
import numpy as np
from PIL import Image
class RoboDesk(gym.E... | [
"numpy.random.uniform",
"dm_control.mujoco.Physics.from_xml_path",
"os.path.dirname",
"numpy.zeros",
"numpy.ones",
"numpy.clip",
"numpy.asarray",
"numpy.random.random",
"numpy.array",
"numpy.linalg.norm",
"gym.spaces.Box",
"PIL.Image.fromarray",
"dm_control.mujoco.Camera",
"dm_control.util... | [((651, 691), 'dm_control.mujoco.Physics.from_xml_path', 'mujoco.Physics.from_xml_path', (['model_path'], {}), '(model_path)\n', (679, 691), False, 'from dm_control import mujoco\n'), ((4111, 4134), 'gym.spaces.Dict', 'gym.spaces.Dict', (['spaces'], {}), '(spaces)\n', (4126, 4134), False, 'import gym\n'), ((4332, 4431)... |
import tensorflow as tf
import numpy as np
prime_states = {
2 : True,
3 : True,
4 : False
}
def is_prime(givenNumber):
if givenNumber not in prime_states:
prime_states[givenNumber] = True
for num in range(2, int(givenNumber ** 0.5) + 1):
if givenNumber % num == 0:
... | [
"tensorflow.keras.layers.Dense",
"tensorflow.keras.optimizers.Adam",
"numpy.array",
"tensorflow.keras.Sequential"
] | [((595, 616), 'tensorflow.keras.Sequential', 'tf.keras.Sequential', ([], {}), '()\n', (614, 616), True, 'import tensorflow as tf\n'), ((1017, 1043), 'tensorflow.keras.optimizers.Adam', 'tf.keras.optimizers.Adam', ([], {}), '()\n', (1041, 1043), True, 'import tensorflow as tf\n'), ((637, 694), 'tensorflow.keras.layers.D... |
import numpy as np
import matplotlib.pyplot as plt
# Compute the x and y coordinates for points on a sine curve
x = np.arange(0, 3 * np.pi, 0.1)
y_sin = np.sin(x)
y_cos = np.cos(x)
# Plot the points using matplotlib
plt.plot(x, y_sin)
plt.plot(x,y_cos)
plt.show() # You must call plt.show() to make graphics appear. | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.sin",
"numpy.arange",
"numpy.cos"
] | [((117, 145), 'numpy.arange', 'np.arange', (['(0)', '(3 * np.pi)', '(0.1)'], {}), '(0, 3 * np.pi, 0.1)\n', (126, 145), True, 'import numpy as np\n'), ((154, 163), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (160, 163), True, 'import numpy as np\n'), ((172, 181), 'numpy.cos', 'np.cos', (['x'], {}), '(x)\n', (178, 181),... |
from math import ceil
import torch
from torch import nn
from torch.nn.modules import dropout
import numpy as np
class Model(nn.Module):
# delta_t -- input vector, q -- output vector, bdiv -- batches division
def __init__(self, delta_t_init, q_init, bsize, nlayers, device, dropout):
super(Model, self).... | [
"numpy.sum",
"torch.randn",
"numpy.array",
"torch.nn.Linear",
"torch.nn.LSTM"
] | [((662, 757), 'torch.nn.LSTM', 'nn.LSTM', ([], {'input_size': 'self.bsize', 'hidden_size': 'self.bsize', 'num_layers': 'nlayers', 'dropout': 'dropout'}), '(input_size=self.bsize, hidden_size=self.bsize, num_layers=nlayers,\n dropout=dropout)\n', (669, 757), False, 'from torch import nn\n'), ((828, 863), 'torch.randn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.