code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import json
import urllib.request
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import style
from data import key, arrholo, arrcolors, urlist
# Declaring variables and dictionaries
timestr = time.strftime("%d%m%Y")
timestr2 = time.strftime("%d.%m.%Y")
st... | [
"matplotlib.pyplot.title",
"pandas.DataFrame",
"matplotlib.pyplot.show",
"matplotlib.style.use",
"matplotlib.pyplot.bar",
"time.strftime",
"numpy.argsort",
"numpy.sort",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.savefig"
] | [((255, 278), 'time.strftime', 'time.strftime', (['"""%d%m%Y"""'], {}), "('%d%m%Y')\n", (268, 278), False, 'import time\n'), ((291, 316), 'time.strftime', 'time.strftime', (['"""%d.%m.%Y"""'], {}), "('%d.%m.%Y')\n", (304, 316), False, 'import time\n'), ((318, 345), 'matplotlib.style.use', 'style.use', (['"""seaborn-bri... |
# Copyright 2019 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.test.main",
"keras.Input",
"keras.Model",
"numpy.random.random_sample",
"keras.initializers.TruncatedNormal",
"numpy.ones",
"keras.backend.eval",
"numpy.random.randint",
"keras.layers.multi_head_attention.MultiHeadAttention",
"absl.testing.parameterized.named_parameters",
"keras.back... | [((1272, 1402), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('key_value_same_proj', None, None, [40, 80])", "('key_value_different_proj', 32, 60, [40, 60])"], {}), "(('key_value_same_proj', None, None, [40, 80]\n ), ('key_value_different_proj', 32, 60, [40, 60]))\n", (1302, 14... |
import numpy as np
import xml.etree.cElementTree as ET
import xml.dom.minidom as minidom
import imp
import glob
import os
import random
import numpy as np
import stl
from stl import mesh
import metaworld
def combine_xmls(xmls):
trees = [ET.parse(xml) for xml in xmls]
roots = [tree.getroot() for tree in trees]... | [
"xml.etree.cElementTree.parse",
"os.path.expanduser",
"numpy.random.choice"
] | [((2020, 2065), 'numpy.random.choice', 'np.random.choice', (['xmls'], {'size': '(3)', 'replace': '(False)'}), '(xmls, size=3, replace=False)\n', (2036, 2065), True, 'import numpy as np\n'), ((243, 256), 'xml.etree.cElementTree.parse', 'ET.parse', (['xml'], {}), '(xml)\n', (251, 256), True, 'import xml.etree.cElementTre... |
from Cython.Build import cythonize
def configuration(parent_package="", top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration("lic", parent_package, top_path)
return config
| [
"numpy.distutils.misc_util.Configuration"
] | [((160, 206), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""lic"""', 'parent_package', 'top_path'], {}), "('lic', parent_package, top_path)\n", (173, 206), False, 'from numpy.distutils.misc_util import Configuration\n')] |
##########################################################################
# Copyright (c) 2017 <NAME>
# <EMAIL>
##########################################################################
import os
import math
import numpy as np
import sklearn
from sklearn.utils import shuffle
from sklearn.metrics import *
from skl... | [
"numpy.log",
"math.sqrt",
"numpy.std",
"numpy.power",
"numpy.place",
"numpy.any",
"numpy.nonzero",
"numpy.mean",
"numpy.arange",
"numpy.loadtxt"
] | [((1419, 1435), 'numpy.any', 'np.any', (['zero_std'], {}), '(zero_std)\n', (1425, 1435), True, 'import numpy as np\n'), ((442, 488), 'numpy.loadtxt', 'np.loadtxt', (['"""spambase.data.csv"""'], {'delimiter': '""","""'}), "('spambase.data.csv', delimiter=',')\n", (452, 488), True, 'import numpy as np\n'), ((1328, 1348),... |
from gym.spaces import Box, Discrete, Tuple
import numpy as np
# TODO (sven): add IMPALA-style option.
# from ray.rllib.examples.models.impala_vision_nets import TorchImpalaVisionNet
from ray.rllib.models.torch.misc import normc_initializer as \
torch_normc_initializer, SlimFC
from ray.rllib.models.catalog import ... | [
"ray.rllib.utils.torch_ops.one_hot",
"ray.rllib.models.torch.torch_modelv2.TorchModelV2.__init__",
"ray.rllib.models.torch.misc.SlimFC",
"ray.rllib.utils.annotations.override",
"ray.rllib.models.utils.get_filter_config",
"ray.rllib.models.torch.misc.normc_initializer",
"numpy.product",
"ray.rllib.util... | [((656, 674), 'ray.rllib.utils.framework.try_import_torch', 'try_import_torch', ([], {}), '()\n', (672, 674), False, 'from ray.rllib.utils.framework import try_import_torch\n'), ((5150, 5167), 'ray.rllib.utils.annotations.override', 'override', (['ModelV2'], {}), '(ModelV2)\n', (5158, 5167), False, 'from ray.rllib.util... |
#!/usr/bin/env python
import collections
import numpy as np
def greaterarray( a1 , a2 ,a1val =None, a2val = None) :
"""
Given two arrays a1 and a2 of equal length, return an array with the
ith element of a1 if a1[i] > a2[i] and a2[i] otherwise.
"""
if a1val ==None:
a1val = 0
if a2val == None:
a2val = ... | [
"numpy.fmax"
] | [((743, 758), 'numpy.fmax', 'np.fmax', (['a1', 'a2'], {}), '(a1, a2)\n', (750, 758), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""plotting.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1DjgQ3HJZMJZ8XMZbauij0rmP-koSbpa8
"""
import numpy as np
import matplotlib.pyplot as plt
import pickle
from matplotlib.collections import LineCollection
# Goals
... | [
"matplotlib.pyplot.savefig",
"numpy.flip",
"matplotlib.pyplot.show",
"numpy.roll",
"matplotlib.pyplot.fill",
"matplotlib.pyplot.close",
"numpy.asarray",
"numpy.zeros",
"matplotlib.pyplot.figure",
"pickle.load",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplo... | [((915, 953), 'numpy.zeros', 'np.zeros', (['(frame_count, segment_count)'], {}), '((frame_count, segment_count))\n', (923, 953), True, 'import numpy as np\n'), ((1777, 1797), 'numpy.repeat', 'np.repeat', (['left_x', '(2)'], {}), '(left_x, 2)\n', (1786, 1797), True, 'import numpy as np\n'), ((1809, 1827), 'numpy.roll', ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import numpy as np
from numpy import linalg
from sklearn.decomposition import PCA
#################################################################
#################################################################
#######################################... | [
"numpy.transpose",
"numpy.diag_indices",
"numpy.shape",
"numpy.linalg.norm",
"numpy.eye",
"numpy.cov",
"numpy.sqrt"
] | [((634, 654), 'numpy.transpose', 'np.transpose', (['points'], {}), '(points)\n', (646, 654), True, 'import numpy as np\n'), ((761, 781), 'numpy.transpose', 'np.transpose', (['points'], {}), '(points)\n', (773, 781), True, 'import numpy as np\n'), ((860, 874), 'numpy.cov', 'np.cov', (['points'], {}), '(points)\n', (866,... |
import math
import numpy as np
from PIL import Image
from skimage import color, io
def load(image_path):
"""Loads an image from a file path.
HINT: Look up `skimage.io.imread()` function.
Args:
image_path: file path to the image.
Returns:
out: numpy array of shape(image_height, imag... | [
"skimage.color.rgb2hsv",
"numpy.square",
"numpy.hstack",
"numpy.mean",
"numpy.sqrt",
"skimage.io.imread",
"skimage.color.rgb2lab"
] | [((390, 432), 'skimage.io.imread', 'io.imread', (['image_path'], {'plugin': '"""matplotlib"""'}), "(image_path, plugin='matplotlib')\n", (399, 432), False, 'from skimage import color, io\n'), ((1405, 1427), 'numpy.mean', 'np.mean', (['image'], {'axis': '(2)'}), '(image, axis=2)\n', (1412, 1427), True, 'import numpy as ... |
import os
import numpy as np
from PIL import Image
import sys
# from OSS import read_image
class Results(object):
def __init__(self, root_dir):
self.root_dir = root_dir
def _read_mask(self, sequence, frame_id):
try:
mask_path = os.path.join(self.root_dir, sequence, f'{frame_id}.png... | [
"sys.stdout.write",
"numpy.ones",
"PIL.Image.open",
"numpy.max",
"numpy.arange",
"sys.stderr.write",
"os.path.join",
"sys.exit"
] | [((1089, 1125), 'numpy.ones', 'np.ones', (['(num_objects, *masks.shape)'], {}), '((num_objects, *masks.shape))\n', (1096, 1125), True, 'import numpy as np\n'), ((266, 322), 'os.path.join', 'os.path.join', (['self.root_dir', 'sequence', 'f"""{frame_id}.png"""'], {}), "(self.root_dir, sequence, f'{frame_id}.png')\n", (27... |
'''
Iterative closest point
<NAME>
pyKinectTools
2012
'''
import numpy as np
from numpy import dot
from scipy import spatial
def IterativeClosestPoint(pts_new, pts_ref, max_iters=25, min_change=.001, pt_tolerance=5000, return_transform=False):
# pts_new = y
# pts_ref = x
pts_new = pts_new.copy()
pts_ref = pt... | [
"numpy.outer",
"numpy.abs",
"numpy.copy",
"numpy.zeros",
"numpy.linalg.svd",
"numpy.linalg.det",
"numpy.random.random",
"scipy.spatial.cKDTree",
"numpy.dot",
"numpy.eye",
"numpy.all"
] | [((425, 449), 'scipy.spatial.cKDTree', 'spatial.cKDTree', (['pts_ref'], {}), '(pts_ref)\n', (440, 449), False, 'from scipy import spatial\n'), ((504, 513), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (510, 513), True, 'import numpy as np\n'), ((525, 536), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (533, 536)... |
#ttensor_test
# Created by ay27 at 17/1/15
import unittest
import numpy as np
import tensorflow as tf
from tensorD.base.type import TTensor
from numpy.random import rand
class MyTestCase(unittest.TestCase):
def test_extract(self):
g = rand(2, 3, 4)
a = rand(5, 2)
b = rand(6, 3)
... | [
"unittest.main",
"numpy.einsum",
"tensorflow.Session",
"tensorflow.constant",
"numpy.random.rand",
"numpy.testing.assert_array_almost_equal",
"tensorD.base.type.TTensor"
] | [((720, 735), 'unittest.main', 'unittest.main', ([], {}), '()\n', (733, 735), False, 'import unittest\n'), ((252, 265), 'numpy.random.rand', 'rand', (['(2)', '(3)', '(4)'], {}), '(2, 3, 4)\n', (256, 265), False, 'from numpy.random import rand\n'), ((278, 288), 'numpy.random.rand', 'rand', (['(5)', '(2)'], {}), '(5, 2)\... |
#!/usr/bin/env python
"""ckwg +29
* Copyright 2019 by Kitware, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright no... | [
"optparse.OptionParser",
"cv2.cvtColor",
"cv2.imwrite",
"cv2.remap",
"numpy.hstack",
"cv2.imread",
"cv2.FileStorage",
"cv2.initUndistortRectifyMap"
] | [((1881, 1906), 'optparse.OptionParser', 'OptionParser', ([], {'usage': 'usage'}), '(usage=usage)\n', (1893, 1906), False, 'from optparse import OptionParser\n'), ((2188, 2207), 'cv2.imread', 'cv2.imread', (['args[0]'], {}), '(args[0])\n', (2198, 2207), False, 'import cv2\n'), ((2547, 2580), 'cv2.FileStorage', 'cv2.Fil... |
# --------------------------------------------------------
# SiamMask
# Licensed under The MIT License
# Written by <NAME> (wangqiang2015 at ia.ac.cn)
# --------------------------------------------------------
from pycocotools.coco import COCO
import cv2
import numpy as np
from os.path import join, isdir
from os import... | [
"sys.stdout.write",
"os.mkdir",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.isdir",
"concurrent.futures.ProcessPoolExecutor",
"time.time",
"cv2.warpAffine",
"pycocotools.coco.COCO",
"numpy.mean",
"sys.stdout.flush",
"numpy.array",
"os.path.join",
"concurrent.futures.as_completed",
... | [((417, 496), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""COCO Parallel Preprocessing for SiamMask"""'}), "(description='COCO Parallel Preprocessing for SiamMask')\n", (440, 496), False, 'import argparse\n'), ((1983, 2001), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (19... |
import torch
from torch.utils.data import Dataset
from torchvision import transforms, datasets
import numpy as np
from tqdm import tqdm
import pickle
from PIL import Image
import os
class TwoCropTransform:
"""Create two crops of the same image"""
def __init__(self, transform):
self.transform = transf... | [
"torchvision.transforms.ColorJitter",
"torchvision.transforms.RandomHorizontalFlip",
"numpy.zeros",
"torchvision.transforms.RandomResizedCrop",
"torchvision.transforms.RandomGrayscale",
"PIL.Image.fromarray",
"numpy.max",
"numpy.array_split",
"torchvision.transforms.Normalize",
"os.path.join",
"... | [((470, 484), 'numpy.max', 'np.max', (['[w, h]'], {}), '([w, h])\n', (476, 484), True, 'import numpy as np\n'), ((2426, 2476), 'torchvision.transforms.Normalize', 'transforms.Normalize', ([], {'mean': 'self.mean', 'std': 'self.std'}), '(mean=self.mean, std=self.std)\n', (2446, 2476), False, 'from torchvision import tra... |
import streamlit as st
import json
from mapper import mapper
import backtest as bt
from datetime import datetime
from datetime import timedelta
import plotly.express as px
import streamlit as st
import pandas as pd
import numpy as np
import pickle
import os
from twilio.rest import Client
from twilio_cred import acco... | [
"streamlit.text_input",
"numpy.argmax",
"streamlit.title",
"pickle.load",
"os.path.join",
"streamlit.subheader",
"streamlit.spinner",
"streamlit.date_input",
"mapper.mapper.keys",
"plotly.express.line",
"backtest.main",
"streamlit.button",
"streamlit.text",
"datetime.timedelta",
"streaml... | [((349, 379), 'twilio.rest.Client', 'Client', (['account_sid', 'authtoken'], {}), '(account_sid, authtoken)\n', (355, 379), False, 'from twilio.rest import Client\n'), ((1491, 1512), 'numpy.array', 'np.array', (['data.values'], {}), '(data.values)\n', (1499, 1512), True, 'import numpy as np\n'), ((1602, 1624), 'numpy.a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 6 14:52:31 2022
@author: pmy
"""
import numpy as np
import pandas as pd
import pickle
def downcast(series):
if series.dtype == np.int64:
ii8 = np.iinfo(np.int8)
ii16 = np.iinfo(np.int16)
ii32 = np.iinfo(np.int32)
... | [
"numpy.finfo",
"pandas.isna",
"numpy.iinfo"
] | [((229, 246), 'numpy.iinfo', 'np.iinfo', (['np.int8'], {}), '(np.int8)\n', (237, 246), True, 'import numpy as np\n'), ((262, 280), 'numpy.iinfo', 'np.iinfo', (['np.int16'], {}), '(np.int16)\n', (270, 280), True, 'import numpy as np\n'), ((296, 314), 'numpy.iinfo', 'np.iinfo', (['np.int32'], {}), '(np.int32)\n', (304, 3... |
from src.mrcnn_imports import *
from configs.config_factory import *
from src.evaluation import *
from src.point_cloud import *
import src.dataset as ds
import src.dataset_urban3d as dsu
import argparse
import shutil
from pathlib import Path
import numpy as np
MAX_DISPLAY_COUNT = 30
def save_image(path, name, img, co... | [
"src.dataset_urban3d.create_urban3d_model",
"numpy.ndarray",
"argparse.ArgumentParser",
"pathlib.Path"
] | [((1098, 1144), 'numpy.ndarray', 'np.ndarray', ([], {'shape': 'mask.shape[:2]', 'dtype': 'np.int'}), '(shape=mask.shape[:2], dtype=np.int)\n', (1108, 1144), True, 'import numpy as np\n'), ((2856, 2908), 'src.dataset_urban3d.create_urban3d_model', 'dsu.create_urban3d_model', (['ds_type', 'config.IMAGE_TYPE'], {}), '(ds_... |
'''
Decision Tree
===================
Usage: <python> decisionTree.py
[--kfoldk=<int>]
[--maxDepth=<int>]
[--purityMeasure=<str>]
[--minForSplit=<int>]
kfoldk : k value for k-fold
1 < kfoldk <= 194
Default = 10
maxDepth : maximun depth for the tree
maxD... | [
"numpy.full",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"collections.Counter",
"numpy.zeros",
"numpy.unique",
"numpy.max",
"numpy.where",
"matplotlib.pyplot.figure",
"utils.get_labels",
"matplotlib.pyplot.ticklabel_format",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.p... | [((11224, 11236), 'numpy.max', 'np.max', (['arr1'], {}), '(arr1)\n', (11230, 11236), True, 'import numpy as np\n'), ((11277, 11306), 'numpy.where', 'np.where', (['mask', '"""red"""', '"""blue"""'], {}), "(mask, 'red', 'blue')\n", (11285, 11306), True, 'import numpy as np\n'), ((11317, 11329), 'matplotlib.pyplot.figure'... |
# coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. 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 cop... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"transformers.squad_convert_examples_to_features",
"tensorflow_datasets.load",
"transformers.data.processors.squad.SquadV1Processor",
"logging.getLogger",
"torch.cuda.device_count",
"torch.device",
"torch.no_grad",
"os.path.join",
"torch.ones",
"... | [((1364, 1391), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1381, 1391), False, 'import logging\n'), ((1418, 1440), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (1429, 1440), False, 'import random\n'), ((1445, 1470), 'numpy.random.seed', 'np.random.seed', (['arg... |
import numpy as np
import matplotlib.pyplot as plt
import pickle
def rect(x: np.ndarray) -> np.ndarray:
"""
Rectangle function.
"""
y = (5/2)*np.ones([len(x)])
for i in range(1, 40, 2):
y += np.sin(x*i)/(np.pi*i)
return 2*(y - 5/2)
def sinc(x: np.ndarray) -> np.ndarray:
"""
sin... | [
"pickle.dump",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.random.randn",
"numpy.sinc",
"numpy.sin",
"numpy.tan",
"numpy.linspace",
"numpy.cos",
"numpy.random.rand"
] | [((350, 360), 'numpy.sinc', 'np.sinc', (['x'], {}), '(x)\n', (357, 360), True, 'import numpy as np\n'), ((516, 525), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (522, 525), True, 'import numpy as np\n'), ((561, 570), 'numpy.cos', 'np.cos', (['x'], {}), '(x)\n', (567, 570), True, 'import numpy as np\n'), ((843, 876), '... |
import numpy as np
import pandas
import matplotlib.pyplot as plt
from keras import layers, optimizers, models
from sklearn.preprocessing import LabelEncoder
import tempfile
import urllib.request
train_file = tempfile.NamedTemporaryFile()
test_file = tempfile.NamedTemporaryFile()
urllib.request.urlretrieve("https://ar... | [
"matplotlib.pyplot.title",
"tempfile.NamedTemporaryFile",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"keras.layers.Dropout",
"matplotlib.pyplot.legend",
"numpy.zeros",
"matplotlib.pyplot.ylabel",
"sklearn.preprocessing.LabelEncoder",
"keras.layers.Dense",
"keras.mod... | [((210, 239), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (237, 239), False, 'import tempfile\n'), ((252, 281), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (279, 281), False, 'import tempfile\n'), ((813, 874), 'pandas.read_csv', 'pd.read_csv', (['t... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 5 12:17:03 2019
@author: albert
"""
from collections import deque
import numpy as np
import matplotlib.pyplot as plt
import pickle
identity_threshold = 0.618 #Golden ratio ;)
cluster_mutations = {}
def getlargestset(keylist,setdict):
# Finds... | [
"numpy.load",
"numpy.save",
"pickle.dump",
"numpy.copy",
"numpy.all",
"numpy.where",
"collections.deque"
] | [((12132, 12164), 'numpy.all', 'np.all', (['(condition1 == condition2)'], {}), '(condition1 == condition2)\n', (12138, 12164), True, 'import numpy as np\n'), ((12213, 12236), 'numpy.load', 'np.load', (['"""clusters.npy"""'], {}), "('clusters.npy')\n", (12220, 12236), True, 'import numpy as np\n'), ((12252, 12265), 'num... |
import numpy as np
import tensorflow as tf
from t3f import ops
from t3f import approximate
from t3f import initializers
class _ApproximateTest():
def testAddN(self):
# Sum a bunch of TT-matrices.
tt_a = initializers.random_matrix(((2, 1, 4), (2, 2, 2)), tt_rank=2,
dty... | [
"tensorflow.test.main",
"t3f.initializers.random_matrix",
"tensorflow.stack",
"numpy.array",
"t3f.approximate.add_n",
"t3f.approximate.reduce_sum_batch",
"t3f.initializers.random_tensor_batch"
] | [((4563, 4577), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (4575, 4577), True, 'import tensorflow as tf\n'), ((217, 296), 't3f.initializers.random_matrix', 'initializers.random_matrix', (['((2, 1, 4), (2, 2, 2))'], {'tt_rank': '(2)', 'dtype': 'self.dtype'}), '(((2, 1, 4), (2, 2, 2)), tt_rank=2, dtype=sel... |
import torch
import torch.nn as nn
from torch import Tensor
from torch.autograd import Variable
import numpy as np
import random
import io
import matplotlib.pyplot as plt
def make_image(ax, map, traj, players, attention_weights=None):
"""
:param test_map: (Tensor) map features
:param traj: (Tensor) traje... | [
"numpy.sin",
"numpy.cos"
] | [((2939, 2951), 'numpy.cos', 'np.cos', (['A[i]'], {}), '(A[i])\n', (2945, 2951), True, 'import numpy as np\n'), ((2960, 2972), 'numpy.sin', 'np.sin', (['A[i]'], {}), '(A[i])\n', (2966, 2972), True, 'import numpy as np\n')] |
import random
import time
from types import SimpleNamespace
import numpy as np
from jina.clients.python import PyClient
from jina.drivers.querylang.queryset.dunderkey import dunder_get
from jina.helper import cached_property
from jina.logging.profile import TimeContext
from jina.proto.uid import *
from tests import r... | [
"jina.logging.profile.TimeContext",
"random.randint",
"time.sleep",
"jina.drivers.querylang.queryset.dunderkey.dunder_get",
"jina.clients.python.PyClient.check_input",
"numpy.array",
"numpy.int64",
"tests.random_docs",
"types.SimpleNamespace"
] | [((1601, 1626), 'random.randint', 'random.randint', (['(0)', '(100000)'], {}), '(0, 100000)\n', (1615, 1626), False, 'import random\n'), ((1707, 1722), 'tests.random_docs', 'random_docs', (['(10)'], {}), '(10)\n', (1718, 1722), False, 'from tests import random_docs\n'), ((1933, 1946), 'numpy.array', 'np.array', (['tmp'... |
import copy
import math
import os
import pickle
import random
import numpy as np
import torch
from parlai.agents.seq2seq.modules import RNNEncoder as Encoder
from parlai.core.agents import Agent
from parlai.core.build_data import modelzoo_path
from parlai.core.dict import DictionaryAgent
from parlai.core.utils import P... | [
"pickle.dump",
"torch.bmm",
"torch.nn.MultiMarginLoss",
"numpy.argsort",
"os.path.isfile",
"torch.nn.Softmax",
"numpy.exp",
"torch.nn.functional.sigmoid",
"torch.no_grad",
"parlai.core.utils.PaddingUtils.pad_text",
"torch.load",
"torch.Tensor",
"torch.nn.Linear",
"torch.zeros",
"transfor... | [((821, 854), 'numpy.concatenate', 'np.concatenate', (['numerator'], {'axis': '(0)'}), '(numerator, axis=0)\n', (835, 854), True, 'import numpy as np\n'), ((16858, 16884), 'copy.deepcopy', 'copy.deepcopy', (['observation'], {}), '(observation)\n', (16871, 16884), False, 'import copy\n'), ((17092, 17239), 'parlai.core.u... |
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
"paddle.fluid.layers.split",
"paddle.fluid.initializer.Constant",
"paddle.fluid.ExecutionStrategy",
"paddle.fluid.layers.data",
"paddle.fluid.program_guard",
"paddle.fluid.layers.tanh",
"numpy.ones",
"paddle.fluid.initializer.UniformInitializer",
"numpy.isclose",
"numpy.exp",
"paddle.fluid.layer... | [((13691, 13818), 'paddle.fluid.layers.data', 'layers.data', ([], {'name': '"""init_hidden"""', 'shape': '[num_layers, batch_size_each, hidden_size]', 'dtype': '"""float32"""', 'append_batch_size': '(False)'}), "(name='init_hidden', shape=[num_layers, batch_size_each,\n hidden_size], dtype='float32', append_batch_si... |
from __future__ import print_function
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.rcParams["font.family"] = "serif"
plt.rcParams["mathtext.fontset"] = "cm"
from orphics import maps,io,cosmology,stats
from pixell import enmap
import numpy as np
import os,sys
from soapack import interfaces... | [
"numpy.load",
"numpy.maximum",
"numpy.zeros",
"orphics.io.Plotter",
"orphics.stats.bin2D",
"tilec.covtools.signal_average",
"numpy.linalg.eigh",
"matplotlib.use",
"numpy.arange",
"soapack.interfaces.get_act_mr3_crosslinked_mask",
"pixell.enmap.fft"
] | [((56, 77), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (70, 77), False, 'import matplotlib\n'), ((585, 627), 'soapack.interfaces.get_act_mr3_crosslinked_mask', 'sints.get_act_mr3_crosslinked_mask', (['region'], {}), '(region)\n', (619, 627), True, 'from soapack import interfaces as sints\n'),... |
import numpy as np
class ReplayBuffer:
def __init__(self, size, obs_size, n_nodes):
self.size = size
self.obs = np.zeros([self.size, obs_size], dtype=np.float32)
self.adj = np.zeros([self.size, n_nodes, n_nodes], dtype=np.float32)
self.weight_matrix = np.zeros([self.size, n_nodes,... | [
"numpy.array",
"numpy.zeros",
"numpy.random.choice"
] | [((135, 184), 'numpy.zeros', 'np.zeros', (['[self.size, obs_size]'], {'dtype': 'np.float32'}), '([self.size, obs_size], dtype=np.float32)\n', (143, 184), True, 'import numpy as np\n'), ((204, 261), 'numpy.zeros', 'np.zeros', (['[self.size, n_nodes, n_nodes]'], {'dtype': 'np.float32'}), '([self.size, n_nodes, n_nodes], ... |
import numpy as np
a0 = 1
b0 = 0
k1 = 0.8
k2 = 0.6
ts = [0, 10]
def analytical_a(t, a0=a0, b0=b0, k1=k1, k2=k2):
return k2 * (a0 + b0) / (k1 + k2) \
+ (a0 - k2 * (a0 + b0) / (k1 + k2)) * np.exp(-(k1 + k2) * t)
def analytical_b(t, a0=a0, b0=b0, k1=k1, k2=k2):
return k1 * (a0 + b0) / (k1 + k2) \
... | [
"numpy.exp"
] | [((206, 228), 'numpy.exp', 'np.exp', (['(-(k1 + k2) * t)'], {}), '(-(k1 + k2) * t)\n', (212, 228), True, 'import numpy as np\n'), ((369, 391), 'numpy.exp', 'np.exp', (['(-(k1 + k2) * t)'], {}), '(-(k1 + k2) * t)\n', (375, 391), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
# @Time : 11/15/20 1:04 AM
# @Author : <NAME>
# @Affiliation : Massachusetts Institute of Technology
# @Email : <EMAIL>
# @File : get_esc_result.py
# summarize esc 5-fold cross validation result
import argparse
import numpy as np
parser = argparse.ArgumentParser(formatter_class=argp... | [
"argparse.ArgumentParser",
"numpy.argmax",
"numpy.savetxt",
"numpy.zeros",
"numpy.mean"
] | [((276, 355), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (299, 355), False, 'import argparse\n'), ((835, 899), 'numpy.savetxt', 'np.savetxt', (["(args.exp_path + '/result.csv')",... |
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
import torch
import torch.nn as nn
from functools import partial
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
from timm.models.vision_transformer import _cfg
from timm.models.registry import register_model
from timm.models.layers ... | [
"torch.nn.Dropout",
"functools.partial",
"timm.models.layers.DropPath",
"timm.models.layers.to_2tuple",
"timm.models.vision_transformer._cfg",
"torch.nn.ModuleList",
"timm.models.layers.trunc_normal_",
"torch.nn.Conv2d",
"math.floor",
"torch.nn.MaxPool1d",
"torch.nn.init.constant_",
"torch.nn.... | [((8235, 8241), 'timm.models.vision_transformer._cfg', '_cfg', ([], {}), '()\n', (8239, 8241), False, 'from timm.models.vision_transformer import _cfg\n'), ((855, 894), 'torch.nn.Linear', 'nn.Linear', (['in_features', 'hidden_features'], {}), '(in_features, hidden_features)\n', (864, 894), True, 'import torch.nn as nn\... |
'''
@author: <NAME> (jakpra)
@copyright: Copyright 2020, <NAME>
@license: Apache 2.0
'''
import sys
import bcolz
import pickle
import numpy as np
glove_path = sys.argv[1] # 'C:\\Users\\Jakob\\Downloads\\glove.840B.300d'
size = int(sys.argv[2]) # 840
dim = int(sys.argv[3]) # 300
words = []
idx = 0
word2idx = {}
ve... | [
"numpy.array",
"numpy.zeros"
] | [((341, 352), 'numpy.zeros', 'np.zeros', (['(1)'], {}), '(1)\n', (349, 352), True, 'import numpy as np\n'), ((624, 642), 'numpy.array', 'np.array', (['line[1:]'], {}), '(line[1:])\n', (632, 642), True, 'import numpy as np\n')] |
import numpy as np
from scipy.special import erf, erfcx
import warnings
def gather(df, melted_columns, value_name="value", var_name="variable"):
"""Gather melted_columns."""
id_vars = [column for column in df.columns if column not in melted_columns]
melted = df.melt(id_vars=id_vars, value_name=value_name,... | [
"numpy.maximum",
"warnings.simplefilter",
"numpy.zeros",
"numpy.clip",
"numpy.where",
"warnings.catch_warnings",
"numpy.exp",
"numpy.sqrt"
] | [((498, 515), 'numpy.zeros', 'np.zeros', (['Z_shape'], {}), '(Z_shape)\n', (506, 515), True, 'import numpy as np\n'), ((820, 836), 'numpy.maximum', 'np.maximum', (['(0)', 'x'], {}), '(0, x)\n', (830, 836), True, 'import numpy as np\n'), ((876, 905), 'numpy.where', 'np.where', (['(x < 0)', '(slope * x)', 'x'], {}), '(x ... |
from __future__ import absolute_import, division, print_function
import numpy as np
import time
from ..core import IdentityOperator, asoperator
from ..memory import empty, zeros
from ..utils.mpi import MPI
from .core import AbnormalStopIteration, IterativeAlgorithm
from .stopconditions import MaxIterationStopCondition... | [
"numpy.dot",
"numpy.dtype",
"numpy.array",
"time.time"
] | [((7342, 7353), 'time.time', 'time.time', ([], {}), '()\n', (7351, 7353), False, 'import time\n'), ((2673, 2703), 'numpy.array', 'np.array', (['b', 'dtype'], {'copy': '(False)'}), '(b, dtype, copy=False)\n', (2681, 2703), True, 'import numpy as np\n'), ((8032, 8044), 'numpy.dot', 'np.dot', (['x', 'x'], {}), '(x, x)\n',... |
import numpy as np
import scipy.linalg as la
from .geometry import product
class Basis:
"""Class for representing a basis in the preferred Euclidean space
Parameters
----------
elements : array-like
Basis elements
inner_product : str or callable, default='trace'
Inner product in ... | [
"scipy.linalg.solve",
"numpy.zeros"
] | [((614, 665), 'numpy.zeros', 'np.zeros', (['(self.dim, self.dim)'], {'dtype': 'np.complex128'}), '((self.dim, self.dim), dtype=np.complex128)\n', (622, 665), True, 'import numpy as np\n'), ((1177, 1201), 'scipy.linalg.solve', 'la.solve', (['self.gram', 'rhs'], {}), '(self.gram, rhs)\n', (1185, 1201), True, 'import scip... |
#!/usr/bin/env python
#
# Copyright (C) 2017 - Massachusetts Institute of Technology (MIT)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option... | [
"hapi.volumeConcentration",
"numpy.log",
"bisect.bisect",
"numpy.exp",
"numpy.linspace"
] | [((7292, 7320), 'hapi.volumeConcentration', 'hp.volumeConcentration', (['P', 'T'], {}), '(P, T)\n', (7314, 7320), True, 'import hapi as hp\n'), ((2309, 2343), 'numpy.exp', 'exp', (['(-const * LowerStateEnergy / T)'], {}), '(-const * LowerStateEnergy / T)\n', (2312, 2343), False, 'from numpy import complex128, int64, fl... |
# -*- coding: utf-8 -*-
"""
Created on Fri May 10 14:56:18 2019
@author: v.fave
"""
"""
Defines Kerbol system in terms of pykep planets.
"""
#!/usr/bin/env ipython
# -*- coding: cp1252 -*-
import pykep as pk
import numpy as np
from collections import OrderedDict, namedtuple
from math import degre... | [
"math.sqrt",
"math.radians",
"numpy.array",
"pykep.epoch",
"collections.OrderedDict"
] | [((1975, 3037), 'numpy.array', 'np.array', (['[[0.0, 0.0, 5263138.304, 0.2, 7.0, 70.0, 15.0, 3.14, 250.0, 0.0, 257.0, \n 168.60938, 1172458888.2740736, 9646.663], [1.0, 0.0, 9832684.544, 0.01,\n 2.1, 15.0, 0.0, 3.14, 700.0, 90.0, 791.0, 8171.7302, 1172458888.2740736,\n 85109.365], [2.0, 0.0, 31500.0, 0.55, 12.... |
"""
Notes:
This is related to a [previous question][1], but is perhaps a more concise phrasing.
I have an `N x N` image and I want to know what the minimum `σ` is that I need before I can downsample my image by a factor of two without losing any information (w.r.t the information in the blurred image).
He... | [
"numpy.abs",
"scipy.ndimage.gaussian_filter",
"numpy.fft.fft",
"numpy.zeros",
"numpy.sin",
"numpy.fft.fftshift",
"numpy.fft.fft2",
"numpy.linspace",
"numpy.random.rand",
"numpy.sqrt"
] | [((2228, 2292), 'scipy.ndimage.gaussian_filter', 'scipy.ndimage.gaussian_filter', (['f'], {'sigma': 'sigma', 'truncate': 'truncate'}), '(f, sigma=sigma, truncate=truncate)\n', (2257, 2292), False, 'import scipy\n'), ((6775, 6797), 'numpy.linspace', 'np.linspace', (['(0)', '(1.0)', 'N'], {}), '(0, 1.0, N)\n', (6786, 679... |
#! -*- coding: utf-8 -*-
# bert做language model任务,小说生成
from __future__ import print_function
import glob, os, json, re
import numpy as np
from tqdm import tqdm
from bert4keras.backend import keras, K
from bert4keras.bert import build_bert_model
from bert4keras.tokenizer import Tokenizer, load_vocab
from bert4keras.opti... | [
"bert4keras.tokenizer.Tokenizer",
"bert4keras.tokenizer.load_vocab",
"bert4keras.optimizers.Adam",
"bert4keras.backend.K.sparse_categorical_crossentropy",
"os.path.exists",
"bert4keras.snippets.open",
"re.findall",
"bert4keras.backend.K.sum",
"glob.glob",
"bert4keras.bert.build_bert_model",
"re.... | [((843, 872), 'glob.glob', 'glob.glob', (['"""/root/金庸/*/*.txt"""'], {}), "('/root/金庸/*/*.txt')\n", (852, 872), False, 'import glob, os, json, re\n'), ((1282, 1303), 'bert4keras.tokenizer.load_vocab', 'load_vocab', (['dict_path'], {}), '(dict_path)\n', (1292, 1303), False, 'from bert4keras.tokenizer import Tokenizer, l... |
import matplotlib.pyplot as plt
from scipy.fftpack import fft
from scipy.io import wavfile # get the api
import numpy as np
import scipy.fftpack as fftp
from PIL import Image, ImageDraw, ImageFont, ImageMath
from pyray.axes import *
def plt_fft(filename, plot=False):
fs, data = wavfile.read(filename) # load the data... | [
"PIL.Image.new",
"matplotlib.pyplot.show",
"numpy.flip",
"matplotlib.pyplot.plot",
"numpy.copy",
"scipy.io.wavfile.read",
"scipy.io.wavfile.write",
"scipy.fftpack.fft",
"matplotlib.pyplot.figure",
"scipy.fftpack.ifft",
"numpy.array",
"numpy.sin",
"PIL.ImageDraw.Draw"
] | [((282, 304), 'scipy.io.wavfile.read', 'wavfile.read', (['filename'], {}), '(filename)\n', (294, 304), False, 'from scipy.io import wavfile\n'), ((399, 405), 'scipy.fftpack.fft', 'fft', (['a'], {}), '(a)\n', (402, 405), False, 'from scipy.fftpack import fft\n'), ((919, 935), 'scipy.fftpack.ifft', 'fftp.ifft', (['myfft'... |
import matplotlib
matplotlib.use('Agg')
import numpy as np
np.random.seed(123)
import matplotlib.pyplot as plt
plt.figure()
plt.subplot(1, 1, 1)
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.savefig('procedural.png', facecolor='0.95')
fig = plt.figure() # create a figure object
ax = fig.add_subplot(1, 1, 1)... | [
"matplotlib.pyplot.subplot",
"numpy.random.seed",
"matplotlib.pyplot.plot",
"matplotlib.patches.Circle",
"matplotlib.pyplot.rcdefaults",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.random.random",
"matplotlib.pyplot.rc",
"numpy.linspace",
"numpy.random.poisson",
"matplotlib.pyplot.yla... | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((59, 78), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (73, 78), True, 'import numpy as np\n'), ((113, 125), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (123,... |
import pytest
from diametery.skeleton import get_total_flux
import numpy as np
def test_get_total_flux():
flux = np.array([
[(0.2, 0.1), (0.3, 0.15), (-0.8, -0.2), (-0.4, 0.22)],
[(0.4, -0.35), (0.6, 0.1), (0, 0), (-0.5, 0.03)],
[(-0.5, 0.04), (0.9, -0.5), (0.7, -0.1), (-0.2, 0.2)]
])
... | [
"diametery.skeleton.get_total_flux",
"numpy.array",
"numpy.all"
] | [((118, 298), 'numpy.array', 'np.array', (['[[(0.2, 0.1), (0.3, 0.15), (-0.8, -0.2), (-0.4, 0.22)], [(0.4, -0.35), (0.6,\n 0.1), (0, 0), (-0.5, 0.03)], [(-0.5, 0.04), (0.9, -0.5), (0.7, -0.1), (\n -0.2, 0.2)]]'], {}), '([[(0.2, 0.1), (0.3, 0.15), (-0.8, -0.2), (-0.4, 0.22)], [(0.4, -\n 0.35), (0.6, 0.1), (0, 0... |
from backbone.model import SE_IR, MobileFaceNet, l2_norm
import torch
import numpy as np
from PIL import Image
from torchvision import transforms as trans
import math
from align_v2 import Face_Alignt
from mtcnn import MTCNN
from utils.utils import load_facebank as _load_facebank
from utils.utils import prepare_facebank... | [
"os.mkdir",
"numpy.load",
"numpy.amin",
"utils.utils.prepare_facebank",
"torch.cat",
"numpy.argmin",
"os.path.isfile",
"numpy.mean",
"torch.no_grad",
"backbone.model.MobileFaceNet",
"mtcnn.MTCNN",
"torchvision.transforms.functional.hflip",
"align_v2.Face_Alignt",
"numpy.power",
"torch.lo... | [((2447, 2502), 'torch.load', 'torch.load', (["('%s/facebank.pth' % self.conf.facebank_path)"], {}), "('%s/facebank.pth' % self.conf.facebank_path)\n", (2457, 2502), False, 'import torch\n'), ((2522, 2571), 'numpy.load', 'np.load', (["('%s/names.npy' % self.conf.facebank_path)"], {}), "('%s/names.npy' % self.conf.faceb... |
from __future__ import print_function
import numpy as np
import time
import scipy.misc
from scipy.ndimage.morphology import grey_dilation
from multiprocessing import Process, Queue
from .symbol_drawing import draw_symbol
from random import shuffle as non_np_shuffle
def save_batch_as_png(batch, labels, dir_path_with_s... | [
"numpy.minimum",
"numpy.multiply",
"argparse.ArgumentParser",
"numpy.random.seed",
"random.shuffle",
"numpy.zeros",
"numpy.expand_dims",
"time.time",
"numpy.append",
"numpy.random.randint",
"numpy.array",
"multiprocessing.Queue",
"scipy.ndimage.morphology.grey_dilation",
"multiprocessing.P... | [((1511, 1557), 'numpy.zeros', 'np.zeros', (['(size_with_margin, size_with_margin)'], {}), '((size_with_margin, size_with_margin))\n', (1519, 1557), True, 'import numpy as np\n'), ((1637, 1704), 'scipy.ndimage.morphology.grey_dilation', 'grey_dilation', (['mask'], {'size': '(2 * margin + 1)', 'mode': '"""constant"""', ... |
import numpy as np
from prody.dynamics import NMA, MaskedGNM
from prody.dynamics.mode import Mode
from prody.dynamics.modeset import ModeSet
from prody.utilities import importLA, copy, showFigure, div0
from prody import LOGGER, SETTINGS
__all__ = ['showDomains', 'showEmbedding', 'getDomainList']
## normalization me... | [
"numpy.abs",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.mean",
"prody.utilities.showFigure",
"numpy.append",
"mpl_toolkits.mplot3d.Axes3D",
"prody.utilities.importLA",
"numpy.hstack",
"prody.LOGGER.warn",
"numpy.dot",
"prody.utilities.div0",
"matplotlib.pyplot.plot",
"matplotlib.pypl... | [((736, 753), 'numpy.array', 'np.array', (['domains'], {}), '(domains)\n', (744, 753), True, 'import numpy as np\n'), ((2354, 2365), 'numpy.abs', 'np.abs', (['lwd'], {}), '(lwd)\n', (2360, 2365), True, 'import numpy as np\n'), ((3047, 3098), 'matplotlib.pyplot.plot', 'plot', (['x', 'y', 'linespec'], {'linewidth': 'line... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from itertools import chain
class AttentionCritic(nn.Module):
"""
Attention network, used as critic for all agents. Each agent gets its own
observation and action, and can also attend over the other agents' encoded
o... | [
"torch.stack",
"torch.nn.Sequential",
"torch.nn.ModuleList",
"torch.nn.BatchNorm1d",
"torch.cat",
"torch.nn.functional.softmax",
"numpy.array",
"torch.nn.Linear",
"torch.nn.LeakyReLU",
"numpy.sqrt"
] | [((1236, 1251), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (1249, 1251), True, 'import torch.nn as nn\n'), ((1275, 1290), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (1288, 1290), True, 'import torch.nn as nn\n'), ((1321, 1336), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (133... |
import sys
import io
import tarfile
from pathlib import Path
import os as os
from os import listdir
import boto3
import json
import base64
import shortuuid as su
import bioimagepath as bp
import bioims
import sagemaker
from sagemaker.pytorch import PyTorch
from sagemaker.inputs import FileSystemInput
import torch
impor... | [
"os.mkdir",
"boto3.client",
"bioimstrain.model_fn",
"json.dumps",
"pathlib.Path",
"os.path.isfile",
"numpy.mean",
"os.path.join",
"os.chdir",
"s3fs.core.S3FileSystem",
"numpy.max",
"bioimagepath.getRoiEmbeddingKey",
"tarfile.open",
"numpy.save",
"os.system",
"numpy.min",
"bioimagepat... | [((1946, 1964), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (1958, 1964), False, 'import boto3\n'), ((1971, 1985), 's3fs.core.S3FileSystem', 'S3FileSystem', ([], {}), '()\n', (1983, 1985), False, 'from s3fs.core import S3FileSystem\n'), ((1992, 2017), 'boto3.client', 'boto3.client', (['"""sagemaker"... |
#!/usr/bin/env python-real
import os
import sys
import numpy as np
import h5py
def main(signal, samplingRate):
N = int(np.ceil(samplingRate * 50e-3)) # length of sub samples
signal = signal[int(np.remainder(len(signal),N)):] # cut signal so can be devided by N
X = np.reshape(signal, (-1,N)) # split signal into ... | [
"h5py.File",
"numpy.ceil",
"numpy.median",
"numpy.std",
"numpy.logical_not",
"numpy.mean",
"numpy.diff",
"numpy.reshape"
] | [((273, 300), 'numpy.reshape', 'np.reshape', (['signal', '(-1, N)'], {}), '(signal, (-1, N))\n', (283, 300), True, 'import numpy as np\n'), ((444, 458), 'numpy.median', 'np.median', (['rms'], {}), '(rms)\n', (453, 458), True, 'import numpy as np\n'), ((471, 482), 'numpy.std', 'np.std', (['rms'], {}), '(rms)\n', (477, 4... |
import numpy as np
import torch
from torch.autograd import gradcheck
from torchvision import ops
from itertools import product
import unittest
class RoIPoolTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.dtype = torch.float64
def slow_roi_pooling(self, x, rois, pool_h, pool_w, ... | [
"torch.autograd.gradcheck",
"torchvision.ops.ps_roi_pool",
"torchvision.ops.RoIAlign",
"numpy.floor",
"torch.device",
"unittest.main",
"torch.ones",
"torchvision.ops.PSRoIPool",
"torchvision.ops.roi_align",
"torchvision.ops.PSRoIAlign",
"torchvision.ops.ps_roi_align",
"torchvision.ops.roi_pool... | [((61045, 61060), 'unittest.main', 'unittest.main', ([], {}), '()\n', (61058, 61060), False, 'import unittest\n'), ((588, 621), 'torch.round', 'torch.round', (['(rois * spatial_scale)'], {}), '(rois * spatial_scale)\n', (599, 621), False, 'import torch\n'), ((1610, 1629), 'torch.device', 'torch.device', (['"""cpu"""'],... |
from collections import OrderedDict
from typing import Dict, Any, Optional, List, cast, Union
import gym
import numpy as np
import torch
from gym.spaces.dict import Dict as SpaceDict
from core.base_abstractions.preprocessor import Preprocessor
from utils.cacheless_frcnn import fasterrcnn_resnet50_fpn
from utils.misc_... | [
"gym.spaces.dict.Dict",
"torch.ones",
"numpy.digitize",
"utils.cacheless_frcnn.fasterrcnn_resnet50_fpn",
"torch.cat",
"utils.system.get_logger",
"torch.cuda.device_count",
"torch.cuda.is_available",
"gym.spaces.Box",
"torch.arange",
"torch.device",
"torch.zeros",
"torch.nn.DataParallel",
"... | [((1657, 1697), 'utils.cacheless_frcnn.fasterrcnn_resnet50_fpn', 'fasterrcnn_resnet50_fpn', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (1680, 1697), False, 'from utils.cacheless_frcnn import fasterrcnn_resnet50_fpn\n'), ((2005, 2054), 'torch.zeros', 'torch.zeros', (['res', 'res', 'maxdets'], {'dtype': 'torc... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 19 13:37:34 2018
@author: r.dewinter
"""
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 19 11:59:44 2018
@author: r.dewinter
"""
from TBTD import TBTD
from SRD import SRD
from WB import WB
from DBD import DBD
from SPD import SPD
from CSI import CSI
fr... | [
"platypus.Problem",
"ast.literal_eval",
"os.makedirs",
"platypus.Real",
"numpy.std",
"platypus.nondominated",
"os.path.exists",
"numpy.max",
"numpy.mean",
"numpy.array",
"hypervolume.hypervolume",
"platypus.SPEA2"
] | [((1834, 1851), 'platypus.Problem', 'Problem', (['(6)', '(2)', '(16)'], {}), '(6, 2, 16)\n', (1841, 1851), False, 'from platypus import Problem\n'), ((2055, 2069), 'platypus.SPEA2', 'SPEA2', (['problem'], {}), '(problem)\n', (2060, 2069), False, 'from platypus import SPEA2\n'), ((2124, 2154), 'platypus.nondominated', '... |
""" Exercises for ANN """
import numpy
from ann.neural_network import NeuralNetwork
import matplotlib.pyplot as plt
from skimage import transform, io
def main():
# Sampling inputs and outputs
#view_example_of_training_data()
#desired_target_test = 9 # specific position on the test file
#view_example... | [
"matplotlib.pyplot.show",
"ann.neural_network.NeuralNetwork",
"numpy.argmax",
"matplotlib.pyplot.imshow",
"numpy.asarray",
"numpy.asfarray",
"numpy.zeros",
"numpy.insert",
"matplotlib.pyplot.figure",
"skimage.transform.resize",
"skimage.io.imread"
] | [((729, 798), 'ann.neural_network.NeuralNetwork', 'NeuralNetwork', (['input_nodes', 'hidden_nodes', 'output_nodes', 'learning_rate'], {}), '(input_nodes, hidden_nodes, output_nodes, learning_rate)\n', (742, 798), False, 'from ann.neural_network import NeuralNetwork\n'), ((865, 875), 'matplotlib.pyplot.show', 'plt.show'... |
# A checkpoint manager for TensorBoard logs
#-------------------------------------------------------------------------------
import os
import glob
import collections
import numpy as np
from tensorboard.backend.event_processing.event_file_loader import EventFileLoader
from tensorboard.backend.event_processing.event_acc... | [
"numpy.sum",
"os.path.isdir",
"numpy.argsort",
"numpy.min",
"numpy.diff",
"os.path.splitext",
"tensorboard.backend.event_processing.event_accumulator.EventAccumulator",
"glob.glob",
"collections.OrderedDict",
"os.path.split",
"os.path.join",
"numpy.concatenate"
] | [((1642, 1692), 'os.path.join', 'os.path.join', (['self.directory', "(self.subprefix + '*')"], {}), "(self.directory, self.subprefix + '*')\n", (1654, 1692), False, 'import os\n'), ((2217, 2242), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (2240, 2242), False, 'import collections\n'), ((3731... |
"""
@author: <NAME> <<EMAIL>>
"""
import gym_super_mario_bros
from gym.spaces import Box
from gym import Wrapper
from nes_py.wrappers import JoypadSpace
from gym_super_mario_bros.actions import SIMPLE_MOVEMENT, COMPLEX_MOVEMENT, RIGHT_ONLY
import cv2
import numpy as np
import subprocess as sp
import torch.multiprocess... | [
"cv2.resize",
"subprocess.Popen",
"cv2.cvtColor",
"nes_py.wrappers.JoypadSpace",
"numpy.zeros",
"gym.spaces.Box",
"torch.multiprocessing.Process",
"torch.multiprocessing.Pipe",
"numpy.concatenate"
] | [((3384, 3409), 'nes_py.wrappers.JoypadSpace', 'JoypadSpace', (['env', 'actions'], {}), '(env, actions)\n', (3395, 3409), False, 'from nes_py.wrappers import JoypadSpace\n'), ((926, 965), 'cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_RGB2GRAY'], {}), '(frame, cv2.COLOR_RGB2GRAY)\n', (938, 965), False, 'import c... |
from random import randint, uniform
import numpy as np
class ImagePool:
def __init__(self, pool_size=200):
assert pool_size >= 0 and pool_size == int(pool_size),\
"'pool_size' must be a positive integer or be equal to 0!"
self.pool_size = pool_size
self.images = []
def q... | [
"numpy.stack",
"random.randint",
"random.uniform"
] | [((1008, 1039), 'numpy.stack', 'np.stack', (['return_images'], {'axis': '(0)'}), '(return_images, axis=0)\n', (1016, 1039), True, 'import numpy as np\n'), ((641, 654), 'random.uniform', 'uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (648, 654), False, 'from random import randint, uniform\n'), ((715, 745), 'random.randint... |
import numpy
import time
import matplotlib.pyplot as plt
# wspolczynnik uczenia
eta = 0.1
# momentum
alfa = 0.7
class NeuralNetwork:
def __repr__(self):
return "Instance of NeuralNetwork"
def __str__(self):
if self.is_bias:
return "hidden_layer (wiersze - neurony) :\n" + str(
... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.random.shuffle",
"numpy.argmax",
"numpy.asarray",
"matplotlib.pyplot.legend",
"numpy.zeros",
"numpy.random.random",
"numpy.exp",
"numpy.dot",
"matplotlib.pyplot.ylabel",
"matplotlib.p... | [((12660, 12670), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (12668, 12670), True, 'import matplotlib.pyplot as plt\n'), ((13102, 13146), 'numpy.asarray', 'numpy.asarray', (['two_dim_list_of_return_values'], {}), '(two_dim_list_of_return_values)\n', (13115, 13146), False, 'import numpy\n'), ((13165, 13185)... |
from caffe2.proto import caffe2_pb2
import numpy as np
from PIL import Image
from matplotlib import pyplot
import os
from caffe2.python import core, workspace, models
import torch
IMAGE_LOCATION = "/home/an1/detectron2/caffe2_model/input.jpg"
INIT_NET = '/home/an1/detectron2/caffe2_model/model_init.pb'
PREDICT_NET = '... | [
"caffe2.proto.caffe2_pb2.NetDef",
"caffe2.python.core.DeviceOption",
"caffe2.python.workspace.Predictor",
"numpy.float",
"PIL.Image.open",
"numpy.array",
"pdb.set_trace"
] | [((391, 417), 'PIL.Image.open', 'Image.open', (['IMAGE_LOCATION'], {}), '(IMAGE_LOCATION)\n', (401, 417), False, 'from PIL import Image\n'), ((424, 437), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (432, 437), True, 'import numpy as np\n'), ((529, 544), 'numpy.array', 'np.array', (['[img]'], {}), '([img])\n', ... |
import torch
import numpy as np
from importlib import import_module
from .default import NormalNN
from .regularization import SI, L2, EWC, MAS
from dataloaders.wrapper import Storage
class Memory(Storage):
def reduce(self, m):
self.storage = self.storage[:m]
def get_tensor(self):
storage = [x... | [
"torch.utils.data.ConcatDataset",
"torch.utils.data.DataLoader",
"importlib.import_module",
"numpy.zeros",
"torch.cat",
"torch.Tensor",
"numpy.dot",
"numpy.eye"
] | [((373, 399), 'torch.cat', 'torch.cat', (['storage'], {'axis': '(1)'}), '(storage, axis=1)\n', (382, 399), False, 'import torch\n'), ((1008, 1052), 'torch.utils.data.ConcatDataset', 'torch.utils.data.ConcatDataset', (['dataset_list'], {}), '(dataset_list)\n', (1038, 1052), False, 'import torch\n'), ((1080, 1208), 'torc... |
# The similarity function will be placed here to determine which cars will be conisdered when generating
# aggregate data
from numpy.linalg import norm
import numpy as np
def cos_sim_function(a, b):
"""simple cos similarity function"""
cos_sim = np.dot(a, b) / (norm(a) * norm(b))
return cos_sim
def pip... | [
"numpy.dot",
"numpy.linalg.norm"
] | [((257, 269), 'numpy.dot', 'np.dot', (['a', 'b'], {}), '(a, b)\n', (263, 269), True, 'import numpy as np\n'), ((273, 280), 'numpy.linalg.norm', 'norm', (['a'], {}), '(a)\n', (277, 280), False, 'from numpy.linalg import norm\n'), ((283, 290), 'numpy.linalg.norm', 'norm', (['b'], {}), '(b)\n', (287, 290), False, 'from nu... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# ufit, a universal scattering fitting suite
#
# Copyright (c) 2013-2019, <NAME> and contributors. All rights reserved.
# Licensed under a 2-clause BSD license, see LICENSE.
# **************************************... | [
"numpy.log",
"ufit.param.Param.from_init",
"numpy.linspace",
"numpy.convolve",
"re.compile"
] | [((556, 592), 're.compile', 're.compile', (['"""[a-zA-Z][a-zA-Z0-9_]*$"""'], {}), "('[a-zA-Z][a-zA-Z0-9_]*$')\n", (566, 592), False, 'import re\n'), ((1136, 1165), 'ufit.param.Param.from_init', 'Param.from_init', (['pname', 'width'], {}), '(pname, width)\n', (1151, 1165), False, 'from ufit.param import Param\n'), ((151... |
import vaex
import numpy as np
from .utils import _ensure_strings_from_expressions, _ensure_string_from_expression
@vaex.register_dataframe_accessor('geo')
class DataFrameAccessorGeo(object):
"""Geometry/geographic helper methods
Example:
>>> df_xyz = df.geo.spherical2cartesian(df.longitude, df.latitude, ... | [
"numpy.radians",
"numpy.arctan2",
"numpy.deg2rad",
"vaex.register_dataframe_accessor",
"numpy.sin",
"numpy.cos",
"numpy.sqrt"
] | [((117, 156), 'vaex.register_dataframe_accessor', 'vaex.register_dataframe_accessor', (['"""geo"""'], {}), "('geo')\n", (149, 156), False, 'import vaex\n'), ((4477, 4501), 'numpy.sqrt', 'np.sqrt', (['(x ** 2 + y ** 2)'], {}), '(x ** 2 + y ** 2)\n', (4484, 4501), True, 'import numpy as np\n'), ((4539, 4555), 'numpy.arct... |
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.ioff()
import matplotlib.gridspec as gridspec
from astropy.io import fits
import emcee
#from schwimmbad import MPIPool
from multiprocessing import Pool
import smart
import model_fit
import mcmc_utils
impor... | [
"numpy.load",
"numpy.abs",
"argparse.ArgumentParser",
"numpy.nanmedian",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.fill_between",
"pandas.DataFrame",
"matplotlib.pyplot.close",
"os.path.exists",
"numpy.isfinite",
"numpy.ma... | [((57, 78), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (71, 78), False, 'import matplotlib\n'), ((111, 121), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '()\n', (119, 121), True, 'import matplotlib.pyplot as plt\n'), ((465, 498), 'warnings.filterwarnings', 'warnings.filterwarnings', (['""... |
__author__ = "<NAME>"
import abc
import numpy as np
import matplotlib.pyplot as plt
import mongoengine as mg
from . import roi as ru
from . import db
from ..img_utils import view_utils as vu
# connect when module is imported (?)
# ... is this the most efficient way to do this?
#mg.connect('prelim')
# __19c_hex_ge... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.imshow",
"numpy.floor",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.cos",
"numpy.linspace",
"matplotlib.pyplot.subplots"
] | [((8736, 8768), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10.0, 10.0)'}), '(figsize=(10.0, 10.0))\n', (8746, 8768), True, 'import matplotlib.pyplot as plt\n'), ((9047, 9067), 'matplotlib.pyplot.imshow', 'plt.imshow', (['prvw_slc'], {}), '(prvw_slc)\n', (9057, 9067), True, 'import matplotlib.pyplot as... |
from libs.extension import Extension
import pandas as pd
import numpy as np
class Hb(Extension):
"""环比"""
def __init__(self, apis_copy, apis, *args, **kwargs):
# 执行父类方法,获得self.apis/self.apis_copy/self.value
super(Hb, self).__init__(apis_copy, apis, *args, **kwargs)
def before_search(self... | [
"pandas.DataFrame",
"libs.extension.Extension.groupby_and_sum",
"numpy.int32"
] | [((957, 1017), 'libs.extension.Extension.groupby_and_sum', 'Extension.groupby_and_sum', (['self.db_results[0][0]', 'self.value'], {}), '(self.db_results[0][0], self.value)\n', (982, 1017), False, 'from libs.extension import Extension\n'), ((1050, 1110), 'libs.extension.Extension.groupby_and_sum', 'Extension.groupby_and... |
import numpy as np
import pytest
from numpy.testing import assert_almost_equal, assert_raises
from ...tools import rot_ksamp
from .. import KSample
class TestKSample:
@pytest.mark.parametrize(
"n, obs_stat, obs_pvalue, indep_test",
[(1000, 4.28e-7, 1.0, "CCA"), (100, 8.24e-5, 0.001, "Dcorr")],
... | [
"numpy.testing.assert_raises",
"pytest.mark.parametrize",
"numpy.random.seed",
"numpy.testing.assert_almost_equal"
] | [((175, 307), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""n, obs_stat, obs_pvalue, indep_test"""', "[(1000, 4.28e-07, 1.0, 'CCA'), (100, 8.24e-05, 0.001, 'Dcorr')]"], {}), "('n, obs_stat, obs_pvalue, indep_test', [(1000, \n 4.28e-07, 1.0, 'CCA'), (100, 8.24e-05, 0.001, 'Dcorr')])\n", (198, 307), Fals... |
#!/usr/bin/env python
# Copyright 2011-2017 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | [
"numpy.asarray",
"numpy.zeros",
"SimpleITK.GetArrayFromImage",
"SimpleITK.RescaleIntensity",
"numpy.nonzero",
"skimage.feature.greycomatrix",
"numpy.min",
"numpy.max",
"numpy.linalg.svd",
"SimpleITK.GetImageFromArray",
"numpy.arctan",
"numpy.round",
"numpy.gradient"
] | [((1701, 1719), 'numpy.gradient', 'np.gradient', (['image'], {}), '(image)\n', (1712, 1719), True, 'import numpy as np\n'), ((1828, 1844), 'numpy.nonzero', 'np.nonzero', (['mask'], {}), '(mask)\n', (1838, 1844), True, 'import numpy as np\n'), ((1856, 1875), 'numpy.min', 'np.min', (['nonzeros[0]'], {}), '(nonzeros[0])\n... |
import os
import sys
import numpy as np
import pandas as pd
from pycompss.api.api import compss_wait_on
from pycompss.api.task import task
from data_managers.fundamentals_extraction import FundamentalsCollector
from data_managers.price_extraction import PriceExtractor
from data_managers.sic import load_sic
from model... | [
"data_managers.sic.load_sic",
"utils.load_symbol_list",
"numpy.isnan",
"os.path.isfile",
"pycompss.api.api.compss_wait_on",
"os.path.join",
"data_managers.fundamentals_extraction.FundamentalsCollector",
"pandas.DataFrame",
"pycompss.api.task.task",
"sys.getprofile",
"numpy.finfo",
"data_manage... | [((593, 619), 'pycompss.api.task.task', 'task', ([], {'returns': 'pd.DataFrame'}), '(returns=pd.DataFrame)\n', (597, 619), False, 'from pycompss.api.task import task\n'), ((1731, 1757), 'pycompss.api.task.task', 'task', ([], {'returns': 'pd.DataFrame'}), '(returns=pd.DataFrame)\n', (1735, 1757), False, 'from pycompss.a... |
# -*- coding: utf-8 -*-
"""CARND3
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1a44b45RBXDba9Nj99y_VLiS6lOwt5uKL
"""
import os
import csv
import cv2
import glob
from PIL import Image
import numpy as np
import sklearn
import random
import pandas as p... | [
"pandas.read_csv",
"random.shuffle",
"sklearn.model_selection.train_test_split",
"cv2.warpAffine",
"numpy.random.randint",
"os.chdir",
"pandas.DataFrame",
"cv2.cvtColor",
"keras.layers.convolutional.Cropping2D",
"keras.layers.Flatten",
"seaborn.set",
"pandas.concat",
"tensorflow.image.resize... | [((418, 434), 'os.chdir', 'os.chdir', (['"""data"""'], {}), "('data')\n", (426, 434), False, 'import os\n'), ((483, 523), 'pandas.read_csv', 'pd.read_csv', (['"""driving_log.csv"""'], {'header': '(0)'}), "('driving_log.csv', header=0)\n", (494, 523), True, 'import pandas as pd\n'), ((714, 758), 'seaborn.set', 'sns.set'... |
#!/usr/bin/env python
import numpy
import kernel_tuner
from collections import OrderedDict
def tune():
with open('stencil.cl', 'r') as f:
kernel_string = f.read()
problem_size = (4096, 2048)
size = numpy.prod(problem_size)
x_old = numpy.random.randn(size).astype(numpy.float32)
x_new = nu... | [
"numpy.copy",
"numpy.random.randn",
"kernel_tuner.tune_kernel",
"collections.OrderedDict",
"numpy.prod"
] | [((221, 245), 'numpy.prod', 'numpy.prod', (['problem_size'], {}), '(problem_size)\n', (231, 245), False, 'import numpy\n'), ((318, 335), 'numpy.copy', 'numpy.copy', (['x_old'], {}), '(x_old)\n', (328, 335), False, 'import numpy\n'), ((381, 394), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (392, 394), Fa... |
# Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code mus... | [
"scipy.signal.lfilter_zi",
"numpy.outer",
"scipy.signal.cont2discrete",
"scipy.signal.lfilter",
"struct.unpack",
"socket.socket",
"struct.pack"
] | [((4069, 4105), 'scipy.signal.cont2discrete', 'signal.cont2discrete', (['(num, den)', 'dt'], {}), '((num, den), dt)\n', (4089, 4105), False, 'from scipy import signal\n'), ((4882, 4915), 'scipy.signal.lfilter_zi', 'signal.lfilter_zi', (['self.b', 'self.a'], {}), '(self.b, self.a)\n', (4899, 4915), False, 'from scipy im... |
# -*- coding: utf-8 -*-
"""
Created on Thu May 8 04:07:43 2014
@author: <NAME>
"""
import h5py
import numpy as np
import pandas
import multiprocessing
import os
# import time
import traceback
import sys
import warnings
import pickle
try:
import h5features
except ImportError:
sys.path.insert(0, os.path.join(
... | [
"numpy.sum",
"argparse.ArgumentParser",
"pandas.HDFStore",
"numpy.empty",
"numpy.argmin",
"multiprocessing.cpu_count",
"numpy.int64",
"h5features.read",
"h5py.File",
"os.path.getsize",
"os.path.realpath",
"numpy.float",
"numpy.mod",
"metrics.dtw.dtw",
"multiprocessing.Pool",
"numpy.con... | [((2681, 2701), 'numpy.int64', 'np.int64', (['by_n_pairs'], {}), '(by_n_pairs)\n', (2689, 2701), True, 'import numpy as np\n'), ((2722, 2740), 'numpy.sum', 'np.sum', (['by_n_pairs'], {}), '(by_n_pairs)\n', (2728, 2740), True, 'import numpy as np\n'), ((3790, 3821), 'numpy.zeros', 'np.zeros', (['n_cpu'], {'dtype': 'np.i... |
import argparse
import numpy as np
from load_data import *
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
def build_dataset_nbayes(episodes, vocabulary, context_size, test_ep):
(X_train, Y1_tra... | [
"sklearn.feature_extraction.text.CountVectorizer",
"sklearn.naive_bayes.MultinomialNB",
"argparse.ArgumentParser",
"numpy.mean",
"sklearn.feature_extraction.text.TfidfTransformer"
] | [((885, 937), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""clf_nbayes.py"""'}), "(description='clf_nbayes.py')\n", (908, 937), False, 'import argparse\n'), ((1884, 1913), 'numpy.mean', 'np.mean', (['(predicted == Y1_test)'], {}), '(predicted == Y1_test)\n', (1891, 1913), True, 'import ... |
import threading
import multiprocessing
import numpy as np
import os
import random
#import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.contrib.slim as slim
import scipy.signal
from scipy.misc import imresize
import gym
from gym import wrappers
from atari_wrappers import *
from dqn_utils import *... | [
"tensorflow.train.Coordinator",
"numpy.random.seed",
"tensorflow.reduce_sum",
"numpy.argmax",
"tensorflow.get_collection",
"tensorflow.reset_default_graph",
"tensorflow.reshape",
"gym.wrappers.Monitor",
"tensorflow.Variable",
"numpy.mean",
"tensorflow.clip_by_global_norm",
"numpy.prod",
"mul... | [((16392, 16422), 'gym.benchmark_spec', 'gym.benchmark_spec', (['"""Atari40M"""'], {}), "('Atari40M')\n", (16410, 16422), False, 'import gym\n'), ((16567, 16591), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (16589, 16591), True, 'import tensorflow as tf\n'), ((16792, 16863), 'tensorflo... |
# -*- coding: utf-8 -*-
"""
This procedure will a fact table of distinct users with the summary of scores over the time
The table depends on the number of tests over the time (the size of the cohort)
It is necessary to run create_dataset.py before
Examples
run: python scores_dataset.py 2 'avg_test_ms'
run: python sco... | [
"pandas.read_csv",
"numpy.arange",
"pandas.DataFrame"
] | [((556, 620), 'pandas.read_csv', 'pd.read_csv', (['"""../data/interim/df_measures.csv"""'], {'encoding': '"""utf-8"""'}), "('../data/interim/df_measures.csv', encoding='utf-8')\n", (567, 620), True, 'import pandas as pd\n'), ((645, 715), 'pandas.read_csv', 'pd.read_csv', (['"""../data/interim/df_measures_users.csv"""']... |
# MIT License
#
# Copyright (C) IBM Corporation 2018
#
# 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... | [
"pickle.dump",
"numpy.zeros_like",
"copy.deepcopy",
"numpy.sum",
"importlib.import_module",
"numpy.argmax",
"numpy.unique",
"numpy.zeros",
"numpy.shape",
"sklearn.utils.class_weight.compute_class_weight",
"numpy.cumsum",
"numpy.linalg.norm",
"numpy.array",
"numpy.matmul",
"logging.getLog... | [((1453, 1480), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1470, 1480), False, 'import logging\n'), ((2707, 2761), 'importlib.import_module', 'importlib.import_module', (['"""art.classifiers.scikitlearn"""'], {}), "('art.classifiers.scikitlearn')\n", (2730, 2761), False, 'import impo... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 09:29:01 2020
@author: bdobson
"""
import os
import pandas as pd
from matplotlib import pyplot as plt
import numpy as np
"""Addresses
"""
data_root = os.path.join("C:\\","Users","bdobson","Documents","GitHub","cwsd_demand","data")
nrfa_data_root = os.path.join(data_... | [
"pandas.DataFrame",
"numpy.outer",
"numpy.maximum",
"pandas.read_csv",
"pandas.to_datetime",
"os.path.join",
"pandas.concat"
] | [((204, 294), 'os.path.join', 'os.path.join', (['"""C:\\\\"""', '"""Users"""', '"""bdobson"""', '"""Documents"""', '"""GitHub"""', '"""cwsd_demand"""', '"""data"""'], {}), "('C:\\\\', 'Users', 'bdobson', 'Documents', 'GitHub',\n 'cwsd_demand', 'data')\n", (216, 294), False, 'import os\n'), ((302, 340), 'os.path.join... |
import torch
import h5py
import faiss
import numpy as np
import os
import pickle
import config
import random
from urllib.request import urlretrieve
from tqdm import tqdm
from torch.utils.data import Dataset,DataLoader
from scipy.sparse import csr_matrix
from sklearn.cluster import AgglomerativeClustering
from sklearn.... | [
"numpy.stack",
"anndata.read_h5ad",
"tqdm.tqdm",
"numpy.load",
"pickle.dump",
"h5py.File",
"torch.utils.data.DataLoader",
"random.shuffle",
"faiss.Clustering",
"numpy.zeros",
"os.path.exists",
"scipy.sparse.csr_matrix",
"numpy.array",
"sklearn.decomposition.PCA",
"pickle.load",
"faiss.... | [((1905, 1932), 'tqdm.tqdm', 'tqdm', (["dataset_name['human']"], {}), "(dataset_name['human'])\n", (1909, 1932), False, 'from tqdm import tqdm\n'), ((2127, 2154), 'tqdm.tqdm', 'tqdm', (["dataset_name['mouse']"], {}), "(dataset_name['mouse'])\n", (2131, 2154), False, 'from tqdm import tqdm\n'), ((3639, 3667), 'numpy.zer... |
import numpy as np
def _c(ca,i,j,P,Q):
if ca[i,j] > -1:
return ca[i,j]
elif i == 0 and j == 0:
ca[i,j] = P[0].dist(Q[0])
elif i > 0 and j == 0:
ca[i,j] = max(_c(ca,i-1,0,P,Q), P[i].dist(Q[0]))
elif i == 0 and j > 0:
ca[i,j] = max(_c(ca,0,j-1,P,Q), P[0].dist(Q[j]))
el... | [
"numpy.multiply"
] | [((592, 611), 'numpy.multiply', 'np.multiply', (['ca', '(-1)'], {}), '(ca, -1)\n', (603, 611), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
@date Created on Thur Apr 30 2020
@author martin_g for Eomys
"""
# Standard library imports
# Third party imports
import numpy as np
# Local application imports
def calc_main_loudness(spec_third, field_type):
"""Calculate core loudness
The code is based on BASIC program publishe... | [
"numpy.floor",
"numpy.zeros",
"numpy.append",
"numpy.array",
"numpy.arange",
"numpy.log10"
] | [((1187, 1231), 'numpy.array', 'np.array', (['[45, 55, 65, 71, 80, 90, 100, 120]'], {}), '([45, 55, 65, 71, 80, 90, 100, 120])\n', (1195, 1231), True, 'import numpy as np\n'), ((1385, 1786), 'numpy.array', 'np.array', (['[(-32, -24, -16, -10, -5, 0, -7, -3, 0, -2, 0), (-29, -22, -15, -10, -4, 0,\n -7, -2, 0, -2, 0),... |
# -*- coding: utf-8 -*-
from deap.tools import selNSGA2
from copy import deepcopy
from datetime import datetime
import numpy as np
from ....Classes.Output import Output
from ....Classes.XOutput import XOutput
from ....Classes.DataKeeper import DataKeeper
from ....Classes.ParamExplorerSet import ParamExplorerSet
from ... | [
"copy.deepcopy",
"deap.tools.selNSGA2",
"numpy.array",
"datetime.datetime.now"
] | [((7691, 7720), 'numpy.array', 'np.array', (['paramexplorer_value'], {}), '(paramexplorer_value)\n', (7699, 7720), True, 'import numpy as np\n'), ((4276, 4304), 'deap.tools.selNSGA2', 'selNSGA2', (['pop', 'self.size_pop'], {}), '(pop, self.size_pop)\n', (4284, 4304), False, 'from deap.tools import selNSGA2\n'), ((8435,... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"mindspore.dataset.vision.py_transforms.Normalize",
"mindspore.dataset.vision.py_transforms.Resize",
"os.path.join",
"mindspore.dataset.vision.py_transforms.CenterCrop",
"os.path.isdir",
"random.shuffle",
"numpy.asarray",
"os.walk",
"mindspore.dataset.GeneratorDataset",
"mindspore.dataset.transfor... | [((1347, 1370), 'os.path.isdir', 'os.path.isdir', (['dir_path'], {}), '(dir_path)\n', (1360, 1370), False, 'import os\n'), ((5432, 5464), 'mindspore.dataset.transforms.py_transforms.Compose', 'py_transforms.Compose', (['transform'], {}), '(transform)\n', (5453, 5464), True, 'import mindspore.dataset.transforms.py_trans... |
# coding: utf-8
# Copyright (c) 2021 AkaiKKRteam.
# Distributed under the terms of the Apache License, Version 2.0.
import shutil
from pymatgen.core.sites import PeriodicSite
from pymatgen.core import Structure
from pymatgen.analysis.structure_matcher import StructureMatcher
import json
from pymatgen.symmetry.analy... | [
"pyakaikkr.StructureSpeciesConverter",
"numpy.histogram",
"pymatgen.io.cif.CifParser",
"shutil.rmtree",
"os.path.join",
"sys.path.append",
"matplotlib.pyplot.close",
"numpy.identity",
"numpy.max",
"matplotlib.pyplot.subplots",
"json.dump",
"pymatgen.core.sites.PeriodicSite",
"pymatgen.core.S... | [((648, 704), 'sys.path.append', 'sys.path.append', (['"""/home/kino/tmp/AkaiKKRPythonUtil/util"""'], {}), "('/home/kino/tmp/AkaiKKRPythonUtil/util')\n", (663, 704), False, 'import sys\n'), ((2188, 2225), 'os.makedirs', 'os.makedirs', (['directory'], {'exist_ok': '(True)'}), '(directory, exist_ok=True)\n', (2199, 2225)... |
from unittest import TestCase
from spyplink.plink_reader import Major_reader
from bitarray import bitarray
import logging
import numpy as np
import pandas as pd
lg = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
class TestMajor_reader(TestCase):
def setUp(self):
self.plink_file = ... | [
"numpy.load",
"numpy.random.shuffle",
"numpy.sum",
"logging.basicConfig",
"numpy.isnan",
"numpy.equal",
"numpy.mean",
"numpy.arange",
"pandas.read_table",
"spyplink.plink_reader.Major_reader",
"bitarray.bitarray",
"logging.getLogger"
] | [((167, 194), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (184, 194), False, 'import logging\n'), ((195, 235), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (214, 235), False, 'import logging\n'), ((1426, 1474), 'spyplink.pli... |
from src import constants
from src.plot_functions.plot_agentEstimator import AgentEstimatorPloter
from src.plot_functions.plot_controller import ControllerPlot, plot_scenario, plot_scenario_last
from src.plot_functions.plot_targetEstimator import Analyser_Target_TargetEstimator_FormatCSV
import matplotlib.pyplot as plt... | [
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show",
"src.plot_functions.plot_targetEstimator.Analyser_Target_TargetEstimator_FormatCSV"
] | [((657, 800), 'src.plot_functions.plot_targetEstimator.Analyser_Target_TargetEstimator_FormatCSV', 'Analyser_Target_TargetEstimator_FormatCSV', (['""""""', 'constants.ResultsPath.SAVE_LOAD_DATA_REFERENCE', 'constants.ResultsPath.SAVE_LAOD_PLOT_FOLDER'], {}), "('', constants.ResultsPath.\n SAVE_LOAD_DATA_REFERENCE, c... |
'''
Created on May 5, 2017
@author: kashefy
'''
import os
import random
import string
import shutil
import tempfile
from nose.tools import assert_equals, assert_false, \
assert_raises, assert_true, assert_is_instance
import numpy as np
import lmdb
import h5py
import dataSource as ds
def create_empty_lmdb(p):
... | [
"dataSource.DataSourceH5",
"h5py.File",
"random.SystemRandom",
"dataSource.DataSourceLMDB",
"os.path.isdir",
"os.path.exists",
"tempfile.mkdtemp",
"dataSource.CreateDatasource.from_path",
"dataSource.DataSourceH5List",
"nose.tools.assert_raises",
"numpy.random.rand",
"shutil.rmtree",
"os.pat... | [((507, 525), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (523, 525), False, 'import tempfile\n'), ((559, 586), 'shutil.rmtree', 'shutil.rmtree', (['self.dir_tmp'], {}), '(self.dir_tmp)\n', (572, 586), False, 'import shutil\n'), ((1861, 1879), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (187... |
import os
import gc
import json
import shutil
import torch
import argparse
from tqdm import tqdm
import pandas as pd
import numpy as np
from config import config
from evaluation import evaluate
from utils import *
import pytorch_lightning as pl
from transformers import AutoTokenizer
from Trainer import LightningModel
f... | [
"pandas.DataFrame",
"tqdm.tqdm",
"argparse.ArgumentParser",
"os.makedirs",
"warnings.filterwarnings",
"os.getcwd",
"numpy.std",
"evaluation.evaluate",
"dataset.loader.get_loaders",
"gc.collect",
"transformers.AutoTokenizer.from_pretrained",
"numpy.mean",
"torch.cuda.is_available",
"Trainer... | [((376, 409), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (399, 409), False, 'import warnings\n'), ((474, 569), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""main.py"""'], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "('main.py', formatt... |
#!/usr/bin/env python
#
# Copyright 2016-present <NAME>.
#
# Licensed under the MIT License.
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://opensource.org/licenses/mit-license.html
#
# Unless required by applicable law or agreed to in writing, sof... | [
"unittest.main",
"npcore.initializers.GlorotRandomNormal",
"numpy.random.seed",
"npcore.initializers.RandomNormal",
"npcore.initializers.RandomOrthonormal",
"npcore.initializers.RandomUniform",
"npcore.initializers.Ones",
"npcore.initializers.Identity",
"npcore.initializers.Initializer",
"npcore.i... | [((1192, 1209), 'numpy.random.seed', 'np.random.seed', (['(2)'], {}), '(2)\n', (1206, 1209), True, 'import numpy as np\n'), ((2835, 2850), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2848, 2850), False, 'import unittest\n'), ((1461, 1474), 'npcore.initializers.Initializer', 'Initializer', ([], {}), '()\n', (14... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 12 11:26:41 2019
@author: omaier
"""
import pyqmri
try:
import unittest2 as unittest
except ImportError:
import unittest
from pyqmri._helper_fun import CLProgram as Program
from pyqmri._helper_fun import _goldcomp as goldcomp
from pkg_resou... | [
"pyqmri.operator.OperatorKspaceSMS",
"h5py.File",
"numpy.zeros_like",
"numpy.abs",
"numpy.random.randn",
"pyqmri.operator.OperatorKspace",
"pyqmri.operator.OperatorKspaceSMSStreamed",
"numpy.ones",
"pyopencl.array.to_device",
"pkg_resources.resource_filename",
"pyqmri._helper_fun._goldcomp.cmp",... | [((749, 765), 'numpy.array', 'np.array', (['[1, 1]'], {}), '([1, 1])\n', (757, 765), True, 'import numpy as np\n'), ((800, 837), 'h5py.File', 'h5py.File', (['"""./test/smalltest.h5"""', '"""r"""'], {}), "('./test/smalltest.h5', 'r')\n", (809, 837), False, 'import h5py\n'), ((1094, 1112), 'numpy.abs', 'np.abs', (["par['... |
#!/usr/bin/env python3
"""Module dedicated to the time simulation of reaction models.
Here are functions that calculate reaction rates as well, which is needed for
the time simulations.
"""
from __future__ import annotations
__all__ = ["get_y", "get_dydt", "get_fixed_scheme"]
import logging
import numpy as np
f... | [
"overreact.get_k",
"overreact.get_dydt",
"jax.jit",
"jax.numpy.where",
"overreact.core._check_scheme",
"scipy.integrate.solve_ivp",
"overreact.get_y",
"numpy.max",
"jax.config.config.update",
"overreact.core._parse_reactions",
"numpy.asarray",
"overreact.core.Scheme",
"jax.numpy.asarray",
... | [((528, 555), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (545, 555), False, 'import logging\n'), ((672, 709), 'jax.config.config.update', 'config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (685, 709), False, 'from jax.config import config\n'), ((3... |
"""Test dependent distributions with 1-D components."""
from pytest import raises
import numpy
import chaospy
DIST1 = chaospy.Uniform(1, 2)
DIST2 = chaospy.Gamma(DIST1)
JOINT1 = chaospy.J(DIST1, DIST2)
JOINT2 = chaospy.J(DIST2, DIST1)
def test_1d_stochastic_dependencies():
"""Ensure ``stochastic_dependencies`` b... | [
"chaospy.Gamma",
"chaospy.J",
"numpy.allclose",
"chaospy.Uniform",
"numpy.isclose",
"numpy.array"
] | [((119, 140), 'chaospy.Uniform', 'chaospy.Uniform', (['(1)', '(2)'], {}), '(1, 2)\n', (134, 140), False, 'import chaospy\n'), ((149, 169), 'chaospy.Gamma', 'chaospy.Gamma', (['DIST1'], {}), '(DIST1)\n', (162, 169), False, 'import chaospy\n'), ((179, 202), 'chaospy.J', 'chaospy.J', (['DIST1', 'DIST2'], {}), '(DIST1, DIS... |
import sys
sys.path.append("../../")
import warnings
import os
import numpy as np
from scipy.stats import norm
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import WhiteKernel, RBF, ConstantKernel as C
from joblib import Parallel, delayed
from core import VHGPR, Ga... | [
"numpy.random.seed",
"sklearn.gaussian_process.kernels.ConstantKernel",
"numpy.ones",
"core.SeqDesign",
"sys.path.append",
"fourbranches.r",
"core.GaussianInputs",
"fourbranches.f",
"core.compute_lh_results",
"sklearn.gaussian_process.GaussianProcessRegressor",
"core.VHGPR",
"sklearn.gaussian_... | [((11, 36), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (26, 36), False, 'import sys\n'), ((651, 676), 'numpy.array', 'np.array', (['([[-5, 5]] * dim)'], {}), '([[-5, 5]] * dim)\n', (659, 676), True, 'import numpy as np\n'), ((688, 726), 'core.GaussianInputs', 'GaussianInputs', (['mean... |
#!/usr/bin/python3.7
# coding=utf-8
import os
import time
import torch
import numpy as np
import logging
import hashlib
from datetime import datetime
from sklearn.metrics import precision_recall_fscore_support, classification_report
class NNHistory:
def __init__(self):
"""包含 loss, acc, & n... | [
"numpy.sum",
"torch.sum",
"logging.warning",
"sklearn.metrics.classification_report",
"time.time",
"datetime.datetime.now",
"numpy.array",
"os.path.join",
"sklearn.metrics.precision_recall_fscore_support"
] | [((1175, 1202), 'numpy.array', 'np.array', (["self.data['loss']"], {}), "(self.data['loss'])\n", (1183, 1202), True, 'import numpy as np\n'), ((1218, 1244), 'numpy.array', 'np.array', (["self.data['acc']"], {}), "(self.data['acc'])\n", (1226, 1244), True, 'import numpy as np\n'), ((1263, 1292), 'numpy.array', 'np.array... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from numpy.testing import assert_array_almost_equal
from mmaction.models import (BCELossWithLogits, BinaryLogisticRegressionLoss,
BMNLoss, CrossEntropyLoss, NLLLoss)
def test_cross_entropy_loss():
c... | [
"mmaction.models.BMNLoss",
"torch.LongTensor",
"torch.manual_seed",
"mmaction.models.NLLLoss",
"torch.cuda.manual_seed",
"torch.randn",
"torch.nn.functional.cross_entropy",
"torch.nn.functional.binary_cross_entropy_with_logits",
"torch.cuda.manual_seed_all",
"torch.nn.Softmax",
"torch.nn.functio... | [((332, 350), 'torch.rand', 'torch.rand', (['(3, 4)'], {}), '((3, 4))\n', (342, 350), False, 'import torch\n'), ((429, 447), 'mmaction.models.CrossEntropyLoss', 'CrossEntropyLoss', ([], {}), '()\n', (445, 447), False, 'from mmaction.models import BCELossWithLogits, BinaryLogisticRegressionLoss, BMNLoss, CrossEntropyLos... |
import argparse
import logging
import numpy as np
from collections import OrderedDict
from datetime import datetime as dt
from recpy.utils.data_utils import read_dataset, df_to_csr
from recpy.utils.split import k_fold_cv
from recpy.metrics import roc_auc, precision, recall, map, ndcg, rr
from recpy.recommenders.item_... | [
"argparse.ArgumentParser",
"logging.basicConfig",
"recpy.metrics.rr",
"recpy.metrics.recall",
"recpy.metrics.precision",
"recpy.utils.split.k_fold_cv",
"recpy.metrics.ndcg",
"numpy.zeros",
"recpy.metrics.roc_auc",
"recpy.metrics.map",
"recpy.utils.data_utils.read_dataset",
"collections.Ordered... | [((616, 643), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (633, 643), False, 'import logging\n'), ((644, 748), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s: %(name)s: %(levelname)s: %(message)s"""'}), "(level=logging.INFO, forma... |
import collections
import json
import os
import copy
import numpy as np
from skopt import Optimizer as SkOptimizer
from skopt.learning import RandomForestRegressor
from deephyper.core.logs.logging import JsonMessage as jm
from deephyper.core.parser import add_arguments_from_signature
from deephyper.evaluator.evaluate... | [
"copy.deepcopy",
"numpy.random.binomial",
"deephyper.core.logs.logging.JsonMessage",
"deephyper.core.parser.add_arguments_from_signature",
"numpy.random.choice",
"deephyper.search.util.conf_logger",
"deephyper.search.nas.regevo.RegularizedEvolution._extend_parser",
"collections.deque"
] | [((443, 494), 'deephyper.search.util.conf_logger', 'util.conf_logger', (['"""deephyper.search.nas.ae_hpo_nas"""'], {}), "('deephyper.search.nas.ae_hpo_nas')\n", (459, 494), False, 'from deephyper.search import util\n'), ((2637, 2680), 'deephyper.search.nas.regevo.RegularizedEvolution._extend_parser', 'RegularizedEvolut... |
try:
import numpy as np
import wave
from scipy.io import wavfile
from pyaudio import PyAudio, paInt16
except ImportError as e: # most likely a ModuleNotFoundError
raise Exception(f'Could not import a module: {e}.')
class SoundData:
def __init__(self, chunk=1024, rate=44100):
'... | [
"wave.open",
"numpy.fft.rfft",
"numpy.log",
"numpy.hamming",
"numpy.argmax",
"numpy.zeros",
"numpy.transpose",
"scipy.io.wavfile.read",
"numpy.append",
"numpy.where",
"numpy.arange",
"pyaudio.PyAudio",
"numpy.round",
"numpy.unique"
] | [((1320, 1363), 'wave.open', 'wave.open', (['f"""./assets/{filename}.wav"""', '"""wb"""'], {}), "(f'./assets/{filename}.wav', 'wb')\n", (1329, 1363), False, 'import wave\n'), ((3029, 3050), 'numpy.transpose', 'np.transpose', (['index_b'], {}), '(index_b)\n', (3041, 3050), True, 'import numpy as np\n'), ((3357, 3397), '... |
import os
import numpy as np
import torch
import torch.nn as nn
from sklearn.utils.linear_assignment_ import linear_assignment
from modules import fpn
from utils import *
import warnings
warnings.filterwarnings('ignore')
def get_model_and_optimizer(args, logger):
# Init model
model = fpn.PanopticFPN(ar... | [
"warnings.filterwarnings",
"torch.load",
"numpy.unique",
"numpy.zeros",
"torch.cat",
"os.path.isfile",
"numpy.where",
"modules.fpn.PanopticFPN",
"torch.zeros",
"torch.nn.DataParallel",
"torch.no_grad",
"os.path.join",
"torch.tensor"
] | [((194, 227), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (217, 227), False, 'import warnings\n'), ((302, 323), 'modules.fpn.PanopticFPN', 'fpn.PanopticFPN', (['args'], {}), '(args)\n', (317, 323), False, 'from modules import fpn\n'), ((336, 358), 'torch.nn.DataParallel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.