code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/env python
#
# Copyright (C) 2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import absolute_import, division, print_function
import argparse
import os
import glog as log
import numpy as np
import cv2
from lxml import etree
from tqdm import tqdm
def parse_args():
"""Parse argu... | [
"cv2.imwrite",
"cv2.fillPoly",
"argparse.ArgumentParser",
"os.makedirs",
"tqdm.tqdm",
"lxml.etree.parse",
"os.path.splitext",
"os.path.dirname",
"numpy.zeros"
] | [((358, 466), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'fromfile_prefix_chars': '"""@"""', 'description': '"""Convert CVAT XML annotations to masks"""'}), "(fromfile_prefix_chars='@', description=\n 'Convert CVAT XML annotations to masks')\n", (381, 466), False, 'import argparse\n'), ((2382, 2437)... |
# -*- coding: utf-8 -*-
"""Tests of GLSAR and diagnostics against Gretl
Created on Thu Feb 02 21:15:47 2012
Author: <NAME>
License: BSD-3
"""
import os
import numpy as np
from numpy.testing import (assert_almost_equal, assert_equal,
assert_allclose, assert_array_less)
from statsmodels.r... | [
"numpy.sqrt",
"numpy.testing.assert_equal",
"numpy.log",
"statsmodels.stats.diagnostic.het_white",
"numpy.array",
"numpy.genfromtxt",
"statsmodels.stats.diagnostic.het_breuschpagan",
"numpy.testing.assert_array_less",
"statsmodels.stats.outliers_influence.OLSInfluence",
"numpy.testing.assert_allcl... | [((662, 732), 'numpy.testing.assert_almost_equal', 'assert_almost_equal', (['contrast_res.fvalue', 'other[0]'], {'decimal': 'decimal[0]'}), '(contrast_res.fvalue, other[0], decimal=decimal[0])\n', (681, 732), False, 'from numpy.testing import assert_almost_equal, assert_equal, assert_allclose, assert_array_less\n'), ((... |
import warnings
import numba
import numpy as np
import strax
import straxen
DEFAULT_MAX_SAMPLES = 20_000
@straxen.mini_analysis(requires=('records',),
warn_beyond_sec=10,
default_time_selection='touching')
def records_matrix(records, time_range, seconds_range, config, ... | [
"strax.raw_to_records",
"numpy.errstate",
"numpy.zeros",
"strax.baseline",
"strax.zero_out_of_bounds",
"straxen.mini_analysis",
"warnings.warn",
"numpy.arange"
] | [((111, 214), 'straxen.mini_analysis', 'straxen.mini_analysis', ([], {'requires': "('records',)", 'warn_beyond_sec': '(10)', 'default_time_selection': '"""touching"""'}), "(requires=('records',), warn_beyond_sec=10,\n default_time_selection='touching')\n", (132, 214), False, 'import straxen\n'), ((2754, 2864), 'stra... |
import numpy as np
from openpnm.algorithms import ReactiveTransport
from openpnm.models.physics import generic_source_term as gst
from openpnm.utils import logging
logger = logging.getLogger(__name__)
class ChargeConservation(ReactiveTransport):
r"""
A class to enforce charge conservation in ionic transport s... | [
"numpy.isnan",
"openpnm.utils.logging.getLogger"
] | [((173, 200), 'openpnm.utils.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (190, 200), False, 'from openpnm.utils import logging\n'), ((3600, 3630), 'numpy.isnan', 'np.isnan', (["self['pore.bc_rate']"], {}), "(self['pore.bc_rate'])\n", (3608, 3630), True, 'import numpy as np\n'), ((3552, ... |
# -*- coding: utf-8 -*-
# Copyright 2019 <NAME>. All Rights Reserved.
#
# 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
#
# https://opensource.org/licenses/MIT
#
# Unless required by applicable law or agreed to in writing... | [
"torch.utils.data.ConcatDataset",
"deepNormalize.factories.customTrainerFactory.TrainerFactory",
"deepNormalize.utils.image_slicer.ImageReconstructor",
"multiprocessing.cpu_count",
"kerosene.configs.configs.DatasetConfiguration",
"kerosene.loggers.visdom.visdom.VisdomLogger",
"deepNormalize.inputs.datas... | [((1889, 1907), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (1903, 1907), True, 'import numpy as np\n'), ((1908, 1923), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (1919, 1923), False, 'import random\n'), ((1977, 2016), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'loggi... |
import sys
import unittest
import os
import tempfile
from netCDF4 import Dataset
import numpy as np
from numpy.testing import assert_array_equal
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
VL_NAME = 'vlen_type'
VL_BASETYPE = np.int16
DIM1_NAME = 'lon'
DIM2_NAME = 'lat'
nlons = 5; nlats = 5... | [
"numpy.abs",
"numpy.reshape",
"numpy.testing.assert_array_equal",
"netCDF4.Dataset",
"numpy.int32",
"numpy.array",
"numpy.random.randint",
"numpy.random.uniform",
"numpy.empty",
"numpy.around",
"tempfile.NamedTemporaryFile",
"unittest.main",
"numpy.arange",
"os.remove"
] | [((451, 482), 'numpy.empty', 'np.empty', (['(nlats * nlons)', 'object'], {}), '(nlats * nlons, object)\n', (459, 482), True, 'import numpy as np\n'), ((488, 519), 'numpy.empty', 'np.empty', (['(nlats * nlons)', 'object'], {}), '(nlats * nlons, object)\n', (496, 519), True, 'import numpy as np\n'), ((682, 714), 'numpy.r... |
import numpy as np
if __name__ == '__main__':
h, w = map( int, input().split() )
row_list = []
for i in range(h):
single_row = list( map(int, input().split() ) )
np_row = np.array( single_row )
row_list.append( np_row )
min_of_each_row = np.min( row_list, axis = 1)
... | [
"numpy.max",
"numpy.array",
"numpy.min"
] | [((288, 312), 'numpy.min', 'np.min', (['row_list'], {'axis': '(1)'}), '(row_list, axis=1)\n', (294, 312), True, 'import numpy as np\n'), ((334, 357), 'numpy.max', 'np.max', (['min_of_each_row'], {}), '(min_of_each_row)\n', (340, 357), True, 'import numpy as np\n'), ((206, 226), 'numpy.array', 'np.array', (['single_row'... |
from .._BlackJack import BlackJackCPP
import gym
import ctypes
import numpy as np
from gym import spaces
class BlackJack(gym.Env):
def __init__(self, natural=False):
self.env = BlackJackCPP(natural)
self.action_space = spaces.Discrete(2)
self.observation_space = spaces.Tuple((
... | [
"numpy.array",
"ctypes.c_uint32",
"gym.spaces.Discrete"
] | [((242, 260), 'gym.spaces.Discrete', 'spaces.Discrete', (['(2)'], {}), '(2)\n', (257, 260), False, 'from gym import spaces\n'), ((905, 920), 'numpy.array', 'np.array', (['state'], {}), '(state)\n', (913, 920), True, 'import numpy as np\n'), ((321, 340), 'gym.spaces.Discrete', 'spaces.Discrete', (['(32)'], {}), '(32)\n'... |
import numpy as np
from . import _version
__version__ = _version.get_versions()['version']
HXR_COLORS = ("#000000", "#02004a", "#030069", "#04008f", "#0500b3", "#0700ff")
SXR_COLORS = ("#000000", "#330000", "#520000", "#850000", "#ad0000", "#ff0000")
HXR_AREAS = {
"GUN" : [2017.911, 2018.712],
"L0" : [2018.... | [
"numpy.mean"
] | [((903, 917), 'numpy.mean', 'np.mean', (['value'], {}), '(value)\n', (910, 917), True, 'import numpy as np\n'), ((1569, 1583), 'numpy.mean', 'np.mean', (['value'], {}), '(value)\n', (1576, 1583), True, 'import numpy as np\n')] |
import os
import tempfile
import numpy as np
import tensorflow as tf
from time import time
from termcolor import cprint
from unittest import TestCase
from .. import K
from .. import Input, Dense, GRU, Bidirectional, Embedding
from .. import Model, load_model
from .. import l2
from .. import maxnorm
from .. import Ada... | [
"numpy.allclose",
"numpy.random.random",
"numpy.max",
"tensorflow.compat.v1.disable_eager_execution",
"numpy.random.randint",
"numpy.random.randn",
"tempfile.gettempdir",
"numpy.array",
"numpy.cos",
"time.time",
"termcolor.cprint"
] | [((591, 629), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (627, 629), True, 'import tensorflow as tf\n'), ((2744, 2796), 'termcolor.cprint', 'cprint', (['"""\n<< ALL MAIN TESTS PASSED >>\n"""', '"""green"""'], {}), '("""\n<< ALL MAIN TESTS PASSED >>\n""", \'... |
import os
import sys
import time
import random
import string
import argparse
import torch
import torch.backends.cudnn as cudnn
import torch.nn.init as init
import torch.optim as optim
import torch.utils.data
import numpy as np
from utils import CTCLabelConverter, CTCLabelConverterForBaiduWarpctc, AttnLabelConverter, ... | [
"imgaug.augmenters.PiecewiseAffine",
"torch.nn.init.constant_",
"imgaug.augmenters.GaussianBlur",
"simclr_dataset.AlignCollate",
"torch.cuda.device_count",
"simclr_dataset.Batch_Balanced_Dataset",
"torch.cuda.is_available",
"sys.exit",
"argparse.ArgumentParser",
"imgaug.augmenters.Crop",
"torch.... | [((1220, 1247), 'simclr_dataset.Batch_Balanced_Dataset', 'Batch_Balanced_Dataset', (['opt'], {}), '(opt)\n', (1242, 1247), False, 'from simclr_dataset import hierarchical_dataset, AlignCollate, Batch_Balanced_Dataset\n'), ((1328, 1338), 'imgaug.seed', 'ia.seed', (['(1)'], {}), '(1)\n', (1335, 1338), True, 'import imgau... |
import sys
sys.path.append('../../')
import constants as cnst
import os
os.environ['PYTHONHASHSEED'] = '2'
import tqdm
from model.stg2_generator import StyledGenerator
import numpy as np
from my_utils.visualize_flame_overlay import OverLayViz
from my_utils.flm_dynamic_fit_overlay import camera_ringnetpp
from my_utils.g... | [
"my_utils.visualize_flame_overlay.OverLayViz",
"torch.load",
"os.path.join",
"my_utils.generic_utils.save_set_of_images",
"my_utils.flm_dynamic_fit_overlay.camera_ringnetpp",
"dataset_loaders.fast_image_reshape",
"numpy.array",
"numpy.zeros",
"torch.randint",
"my_utils.eye_centering.position_to_gi... | [((11, 36), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (26, 36), False, 'import sys\n'), ((1244, 1267), 'numpy.array', 'np.array', (['[0.0, 0.0, 0]'], {}), '([0.0, 0.0, 0])\n', (1252, 1267), True, 'import numpy as np\n'), ((1282, 1338), 'my_utils.flm_dynamic_fit_overlay.camera_ringnet... |
import unittest
import numpy as np
from numpy.testing import assert_almost_equal
from dymos.utils.hermite import hermite_matrices
class TestHermiteMatrices(unittest.TestCase):
def test_quadratic(self):
# Interpolate with values and rates provided at [-1, 1] in tau space
tau_given = [-1.0, 1.0]... | [
"numpy.testing.assert_almost_equal",
"numpy.linspace",
"dymos.utils.hermite.hermite_matrices",
"numpy.dot",
"unittest.main"
] | [((2209, 2224), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2222, 2224), False, 'import unittest\n'), ((340, 363), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(100)'], {}), '(-1, 1, 100)\n', (351, 363), True, 'import numpy as np\n'), ((631, 668), 'dymos.utils.hermite.hermite_matrices', 'hermite_matrices... |
# ******************************************************************************
# Copyright 2018 Intel Corporation
#
# 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.o... | [
"numpy.finfo",
"numpy.dtype",
"numpy.iinfo"
] | [((2119, 2134), 'numpy.dtype', 'np.dtype', (['dtype'], {}), '(dtype)\n', (2127, 2134), True, 'import numpy as np\n'), ((3240, 3264), 'numpy.finfo', 'np.finfo', (['self.data_type'], {}), '(self.data_type)\n', (3248, 3264), True, 'import numpy as np\n'), ((3456, 3480), 'numpy.finfo', 'np.finfo', (['self.data_type'], {}),... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"numpy.array",
"avod.datasets.kitti.kitti_aug.flip_boxes_3d",
"numpy.testing.assert_almost_equal"
] | [((1490, 1563), 'numpy.array', 'np.array', (['[[1, 2, 3, 4, 5, 6, np.pi / 4], [1, 2, 3, 4, 5, 6, -np.pi / 4]]'], {}), '([[1, 2, 3, 4, 5, 6, np.pi / 4], [1, 2, 3, 4, 5, 6, -np.pi / 4]])\n', (1498, 1563), True, 'import numpy as np\n'), ((1630, 1718), 'numpy.array', 'np.array', (['[[-1, 2, 3, 4, 5, 6, 3 * np.pi / 4], [-1,... |
import cv2
import numpy as np
from pycocotools.coco import COCO
import os
from ..dataloading import get_yolox_datadir
from .datasets_wrapper import Dataset
class MOTDataset(Dataset):
"""
COCO dataset class.
"""
def __init__( # This function is called in the exps yolox_x_mot17_half.py in this way: ... | [
"numpy.array",
"numpy.zeros",
"os.path.join",
"cv2.imread"
] | [((3616, 3639), 'numpy.zeros', 'np.zeros', (['(num_objs, 6)'], {}), '((num_objs, 6))\n', (3624, 3639), True, 'import numpy as np\n'), ((4439, 4488), 'os.path.join', 'os.path.join', (['self.data_dir', 'self.name', 'file_name'], {}), '(self.data_dir, self.name, file_name)\n', (4451, 4488), False, 'import os\n'), ((4525, ... |
import unittest
import dace
import numpy as np
from dace.transformation.dataflow import MapTiling, OutLocalStorage
N = dace.symbol('N')
@dace.program
def arange():
out = np.ndarray([N], np.int32)
for i in dace.map[0:N]:
with dace.tasklet:
o >> out[i]
o = i
return out
cla... | [
"numpy.ones",
"dace.propagate_memlets_sdfg",
"dace.symbol",
"numpy.ndarray",
"unittest.main",
"numpy.arange"
] | [((120, 136), 'dace.symbol', 'dace.symbol', (['"""N"""'], {}), "('N')\n", (131, 136), False, 'import dace\n'), ((177, 202), 'numpy.ndarray', 'np.ndarray', (['[N]', 'np.int32'], {}), '([N], np.int32)\n', (187, 202), True, 'import numpy as np\n'), ((1422, 1437), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1435, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of the SPORCO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
# with the package.
"""
Basis Pursuit DeNoising
=======================
This example demonstrates the use of class :class:`.admm.bpdn.... | [
"numpy.abs",
"builtins.input",
"sporco.util.grid_search",
"numpy.hstack",
"sporco.admm.bpdn.BPDN",
"numpy.zeros",
"numpy.random.seed",
"numpy.vstack",
"sporco.admm.bpdn.BPDN.Options",
"sporco.plot.figure",
"sporco.plot.subplot",
"numpy.logspace",
"numpy.random.randn",
"sporco.plot.plot"
] | [((1417, 1438), 'numpy.random.seed', 'np.random.seed', (['(12345)'], {}), '(12345)\n', (1431, 1438), True, 'import numpy as np\n'), ((1443, 1464), 'numpy.random.randn', 'np.random.randn', (['N', 'M'], {}), '(N, M)\n', (1458, 1464), True, 'import numpy as np\n'), ((1470, 1486), 'numpy.zeros', 'np.zeros', (['(M, 1)'], {}... |
""" A bar graph.
(c) September 2017 by <NAME>
"""
import argparse
from collections import defaultdict
from keras.models import Sequential
from keras.layers import Dense, Activation
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import sys
np.set_printoptions(suppress=True, ... | [
"numpy.mean",
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"matplotlib.pyplot.ylabel",
"matplotlib.use",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.style.use",
"numpy.array",
"matplotlib.pyplot.tight_layout",
"numpy.std",
"matplotlib.pyplot.title",
"numpy.load"... | [((201, 222), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (215, 222), False, 'import matplotlib\n'), ((285, 334), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)', 'linewidth': '(200)'}), '(suppress=True, linewidth=200)\n', (304, 334), True, 'import numpy as np\n'), ... |
# SPDX-License-Identifier: Apache-2.0
"""Unit Tests for custom rnns."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import init_ops
from backend_test_base import Tf2OnnxBackendTest... | [
"tensorflow.contrib.seq2seq.BahdanauAttention",
"tensorflow.contrib.seq2seq.AttentionWrapper",
"tf2onnx.tf_loader.is_tf2",
"numpy.array",
"numpy.stack",
"tensorflow.sigmoid",
"tensorflow.concat",
"tensorflow.matmul",
"tensorflow.identity",
"tensorflow.python.ops.init_ops.constant_initializer",
"... | [((584, 592), 'tf2onnx.tf_loader.is_tf2', 'is_tf2', ([], {}), '()\n', (590, 592), False, 'from tf2onnx.tf_loader import is_tf2\n'), ((1563, 1627), 'numpy.array', 'np.array', (['[[1.0, 1.0], [2.0, 2.0], [3.0, 3.0]]'], {'dtype': 'np.float32'}), '([[1.0, 1.0], [2.0, 2.0], [3.0, 3.0]], dtype=np.float32)\n', (1571, 1627), T... |
import unittest
from numpy.testing import assert_array_equal
import numpy as np
from libact.base.dataset import Dataset
from libact.models import LogisticRegression
from libact.query_strategies import VarianceReduction
from .utils import run_qs
class VarianceReductionTestCase(unittest.TestCase):
"""Variance red... | [
"unittest.main",
"numpy.array",
"libact.models.LogisticRegression"
] | [((936, 951), 'unittest.main', 'unittest.main', ([], {}), '()\n', (949, 951), False, 'import unittest\n'), ((879, 901), 'numpy.array', 'np.array', (['[4, 5, 2, 3]'], {}), '([4, 5, 2, 3])\n', (887, 901), True, 'import numpy as np\n'), ((759, 779), 'libact.models.LogisticRegression', 'LogisticRegression', ([], {}), '()\n... |
from manimlib.imports import *
from manimlib.utils import bezier
import numpy as np
class VectorInterpolator:
def __init__(self,points):
self.points = points
self.n = len(self.points)
self.dists = [0]
for i in range(len(self.points)):
self.dists += [np.linalg.norm(
... | [
"numpy.linalg.norm"
] | [((575, 641), 'numpy.linalg.norm', 'np.linalg.norm', (['(self.points[(idx + 1) % self.n] - self.points[idx])'], {}), '(self.points[(idx + 1) % self.n] - self.points[idx])\n', (589, 641), True, 'import numpy as np\n'), ((300, 362), 'numpy.linalg.norm', 'np.linalg.norm', (['(self.points[i] - self.points[(i + 1) % self.n]... |
from __future__ import division
from unittest import skipIf, TestCase
import os
from pandas import DataFrame
import numpy as np
from numpy.testing import assert_array_equal
BACKEND_AVAILABLE = os.environ.get("ETS_TOOLKIT", "qt4") != "null"
if BACKEND_AVAILABLE:
from app_common.apptools.testing_utils import asser... | [
"app_common.apptools.testing_utils.assert_obj_gui_works",
"unittest.skipIf",
"os.environ.get",
"numpy.array",
"numpy.random.randn",
"numpy.testing.assert_array_equal"
] | [((5646, 5702), 'unittest.skipIf', 'skipIf', (['(not BACKEND_AVAILABLE)', '"""No UI backend available"""'], {}), "(not BACKEND_AVAILABLE, 'No UI backend available')\n", (5652, 5702), False, 'from unittest import skipIf, TestCase\n'), ((8462, 8518), 'unittest.skipIf', 'skipIf', (['(not BACKEND_AVAILABLE)', '"""No UI bac... |
import numpy as np
import logging
import numbers
import torch
import math
import json
import sys
from torch.optim.lr_scheduler import LambdaLR
from torchvision.transforms.functional import pad
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
sel... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"numpy.max",
"torch.tensor",
"torch.cuda.is_available",
"json.load",
"json.dump"
] | [((3352, 3366), 'numpy.max', 'np.max', (['[w, h]'], {}), '([w, h])\n', (3358, 3366), True, 'import numpy as np\n'), ((4799, 4825), 'logging.getLogger', 'logging.getLogger', (['"""train"""'], {}), "('train')\n", (4816, 4825), False, 'import logging\n'), ((5465, 5500), 'torch.tensor', 'torch.tensor', (['[0.485, 0.456, 0.... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 03 11:06:37 2018
@author: vmg
"""
import sdf
import numpy as np
# Load 2006 LUT for interpolation
# 2006 Groeneveld Look-Up Table as presented in
# "2006 CHF Look-Up Table", Nuclear Engineering and Design 237, pp. 190-1922.
# This file requires the file 2006LUTdata.tx... | [
"sdf.Group",
"numpy.array",
"numpy.zeros",
"numpy.loadtxt",
"sdf.save",
"sdf.Dataset"
] | [((517, 695), 'numpy.array', 'np.array', (['(0.0, 50.0, 100.0, 300.0, 500.0, 750.0, 1000.0, 1500.0, 2000.0, 2500.0, \n 3000.0, 3500.0, 4000.0, 4500.0, 5000.0, 5500.0, 6000.0, 6500.0, 7000.0,\n 7500.0, 8000.0)'], {}), '((0.0, 50.0, 100.0, 300.0, 500.0, 750.0, 1000.0, 1500.0, 2000.0, \n 2500.0, 3000.0, 3500.0, 4... |
import copy
import json
import logging
import os
import sys
import time
from collections import defaultdict
import numpy as np
import tensorflow as tf
from sklearn import decomposition
from .. import dp_logging
from . import labeler_utils
from .base_model import AutoSubRegistrationMeta, BaseModel, BaseTrainableModel
... | [
"logging.getLogger",
"tensorflow.reduce_sum",
"tensorflow.math.divide_no_nan",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.load_model",
"copy.deepcopy",
"tensorflow.reduce_mean",
"tensorflow.cast",
"tensorflow.math.minimum",
"tensorflow... | [((775, 806), 'logging.getLogger', 'logging.getLogger', (['"""tensorflow"""'], {}), "('tensorflow')\n", (792, 806), False, 'import logging\n'), ((859, 903), 'tensorflow.keras.utils.register_keras_serializable', 'tf.keras.utils.register_keras_serializable', ([], {}), '()\n', (901, 903), True, 'import tensorflow as tf\n'... |
from PyQt5.QtWidgets import QLabel, QWidget, QGridLayout, QCheckBox, QGroupBox
from InftyDoubleSpinBox import InftyDoubleSpinBox
from PyQt5.QtCore import pyqtSignal, Qt
import helplib as hl
import numpy as np
class dataControlWidget(QGroupBox):
showErrorBars_changed = pyqtSignal(bool)
ignoreFirstPoint_changed ... | [
"PyQt5.QtCore.pyqtSignal",
"InftyDoubleSpinBox.InftyDoubleSpinBox",
"helplib.saveFilewithMetaData",
"numpy.float64",
"PyQt5.QtWidgets.QWidget.__init__",
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QLabel",
"helplib.readFileForFitsDataAndStdErrorAndMetaData",
"PyQt5.QtWidgets.QCheckBox"
] | [((274, 290), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['bool'], {}), '(bool)\n', (284, 290), False, 'from PyQt5.QtCore import pyqtSignal, Qt\n'), ((322, 338), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['bool'], {}), '(bool)\n', (332, 338), False, 'from PyQt5.QtCore import pyqtSignal, Qt\n'), ((358, 380), 'PyQt5.QtCor... |
# This notebook implements a proof-of-principle for
# Multi-Agent Common Knowledge Reinforcement Learning (MACKRL)
# The entire notebook can be executed online, no need to download anything
# http://pytorch.org/
from itertools import chain
import torch
import torch.nn.functional as F
from torch.multiprocessing import... | [
"torch.ger",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.fill_between",
"torch.min",
"torch.multiprocessing.freeze_support",
"torch.sum",
"torch.nn.functional.softmax",
"numpy.repeat",
"matplotlib.pyplot.xlabel",
"torch.multiprocessing.Pool",
"numpy.stack",
"matplotlib.pyplot.yticks",
"ma... | [((370, 395), 'torch.multiprocessing.set_start_method', 'set_start_method', (['"""spawn"""'], {}), "('spawn')\n", (386, 395), False, 'from torch.multiprocessing import Pool, set_start_method, freeze_support\n'), ((2125, 2156), 'torch.ger', 'torch.ger', (['pi_dec[0]', 'pi_dec[1]'], {}), '(pi_dec[0], pi_dec[1])\n', (2134... |
import time
import torch
import warnings
import numpy as np
from tianshou.env import BaseVectorEnv
from tianshou.data import Batch, ReplayBuffer,\
ListReplayBuffer
from tianshou.utils import MovAvg
class Collector(object):
"""docstring for Collector"""
def __init__(self, policy, env, buffer=None, stat_si... | [
"tianshou.utils.MovAvg",
"numpy.isscalar",
"numpy.where",
"tianshou.data.ReplayBuffer",
"time.sleep",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"tianshou.data.Batch",
"tianshou.data.ListReplayBuffer",
"warnings.warn",
"time.time"
] | [((1660, 1677), 'tianshou.utils.MovAvg', 'MovAvg', (['stat_size'], {}), '(stat_size)\n', (1666, 1677), False, 'from tianshou.utils import MovAvg\n'), ((1707, 1724), 'tianshou.utils.MovAvg', 'MovAvg', (['stat_size'], {}), '(stat_size)\n', (1713, 1724), False, 'from tianshou.utils import MovAvg\n'), ((2961, 2972), 'time.... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: CC-BY-4.0
import os
import cv2
from collections import namedtuple
import imageio
from PIL import Image
from random import randrange
import numpy as np
from sklearn.decomposition import PCA
from scipy.spatial.distance import... | [
"numpy.array",
"matplotlib.pyplot.imshow",
"os.path.exists",
"sklearn.decomposition.PCA",
"matplotlib.pyplot.close",
"cv2.addWeighted",
"numpy.take",
"matplotlib.pyplot.scatter",
"collections.namedtuple",
"scipy.spatial.distance.squareform",
"matplotlib.use",
"scipy.spatial.distance.pdist",
... | [((370, 391), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (384, 391), False, 'import matplotlib\n'), ((939, 966), 'matplotlib.pyplot.imread', 'plt.imread', (['self.image_path'], {}), '(self.image_path)\n', (949, 966), True, 'import matplotlib.pyplot as plt\n'), ((993, 1020), 'cv2.imread', 'cv2... |
import os
import numpy as np
save_stem='extra_vis_friday_harbor'
data_dir='../../data/sdk_new_100'
resolution=100
cre=False
source_acronyms=['VISal','VISam','VISl','VISp','VISpl','VISpm',
'VISli','VISpor','VISrl','VISa']
lambda_list = np.logspace(3,12,10)
scale_lambda=True
min_vox=0
# save_file_name='... | [
"os.path.abspath",
"numpy.logspace",
"os.path.join"
] | [((253, 275), 'numpy.logspace', 'np.logspace', (['(3)', '(12)', '(10)'], {}), '(3, 12, 10)\n', (264, 275), True, 'import numpy as np\n'), ((428, 480), 'os.path.join', 'os.path.join', (['"""../../data/connectivities"""', 'save_stem'], {}), "('../../data/connectivities', save_stem)\n", (440, 480), False, 'import os\n'), ... |
# encoding: utf-8
'''
@author: yangsen
@license:
@contact:
@software:
@file: numpy_mat.py
@time: 18-8-25 下午9:56
@desc:
'''
import numpy as np
a = np.arange(9).reshape(3,3)
# 行
a[1]
a[[1,2]]
a[np.array([1,2])]
# 列
a[:,1]
a[:,[1,2]]
a[:,np.array([1,2])] | [
"numpy.array",
"numpy.arange"
] | [((194, 210), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (202, 210), True, 'import numpy as np\n'), ((146, 158), 'numpy.arange', 'np.arange', (['(9)'], {}), '(9)\n', (155, 158), True, 'import numpy as np\n'), ((238, 254), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (246, 254), True, 'impo... |
from typing import Union, Iterable, List
import numpy as np
import pandas as pd
from ..models._transformer import _ArrayTransformer, _MultiArrayTransformer
class _DataFrameTransformer(_ArrayTransformer):
'''`_ArrayTransformer` wrapper for `pandas.DataFrame`.
'''
def __init__(self):
super().__in... | [
"pandas.DataFrame",
"numpy.cumsum"
] | [((1911, 1982), 'pandas.DataFrame', 'pd.DataFrame', (['df'], {'index': 'self.index_samples', 'columns': 'self.index_features'}), '(df, index=self.index_samples, columns=self.index_features)\n', (1923, 1982), True, 'import pandas as pd\n'), ((3153, 3204), 'numpy.cumsum', 'np.cumsum', (['[tf.n_valid_features for tf in se... |
# Neural Networks Demystified
# Part 1: Data + Architecture
#
# Supporting code for short YouTube series on artificial neural networks.
#
# <NAME>
# @stephencwelch
import numpy as np
# X = (hours sleeping, hours studying), y = Score on test
X = np.array(([3,5], [5,1], [10,2]), dtype=float)
y = np.array(([75], [82], [... | [
"numpy.array",
"numpy.amax"
] | [((247, 295), 'numpy.array', 'np.array', (['([3, 5], [5, 1], [10, 2])'], {'dtype': 'float'}), '(([3, 5], [5, 1], [10, 2]), dtype=float)\n', (255, 295), True, 'import numpy as np\n'), ((297, 338), 'numpy.array', 'np.array', (['([75], [82], [93])'], {'dtype': 'float'}), '(([75], [82], [93]), dtype=float)\n', (305, 338), ... |
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import histogram_module
import dist_module
def rgb2gray(rgb):
r, g, b = rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2]
gray = 0.2989 * r + 0.5870 * g + 0.1140 * b
return gray
# model_images - list of file names of model images
# query_... | [
"PIL.Image.open",
"histogram_module.is_grayvalue_hist",
"histogram_module.get_hist_by_name",
"numpy.argsort",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.argmin",
"matplotlib.pyplot.title",
"dist_module.get_dist_by_name",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((866, 911), 'histogram_module.is_grayvalue_hist', 'histogram_module.is_grayvalue_hist', (['hist_type'], {}), '(hist_type)\n', (900, 911), False, 'import histogram_module\n'), ((1708, 1728), 'numpy.array', 'np.array', (['best_match'], {}), '(best_match)\n', (1716, 1728), True, 'import numpy as np\n'), ((2953, 2965), '... |
################################################################################
# Copyright (c) 2015-2018 Skymind, Inc.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless... | [
"ctypes.POINTER",
"numpy.array",
"ctypes.cast",
"warnings.warn",
"numpy.dtype"
] | [((4456, 4486), 'ctypes.POINTER', 'ctypes.POINTER', (['mapping[dtype]'], {}), '(mapping[dtype])\n', (4470, 4486), False, 'import ctypes\n'), ((4501, 4530), 'ctypes.cast', 'ctypes.cast', (['address', 'Pointer'], {}), '(address, Pointer)\n', (4512, 4530), False, 'import ctypes\n'), ((2678, 2771), 'warnings.warn', 'warnin... |
#! /usr/bin/Python
from gensim.models.keyedvectors import KeyedVectors
from scipy import spatial
from numpy import linalg
import argparse
import sys
vector_file = sys.argv[1]
if len(sys.argv) != 6:
print('arguments wrong!')
print(len(sys.argv))
exit()
else:
words = [sys.argv[2], sys.argv[3], sys.arg... | [
"gensim.models.keyedvectors.KeyedVectors.load_word2vec_format",
"scipy.spatial.distance.cosine",
"numpy.linalg.norm"
] | [((366, 425), 'gensim.models.keyedvectors.KeyedVectors.load_word2vec_format', 'KeyedVectors.load_word2vec_format', (['vector_file'], {'binary': '(True)'}), '(vector_file, binary=True)\n', (399, 425), False, 'from gensim.models.keyedvectors import KeyedVectors\n'), ((709, 724), 'numpy.linalg.norm', 'linalg.norm', (['w1'... |
import numpy as np
import scipy as sp
import scipy.sparse.linalg as splinalg
def eig2_nL(g, tol_eigs = 1.0e-6, normalize:bool = True, dim:int=1):
"""
DESCRIPTION
-----------
Computes the eigenvector that corresponds to the second smallest eigenvalue
of the normalized Laplacian matrix ... | [
"numpy.real",
"scipy.sparse.identity",
"scipy.sparse.linalg.eigsh"
] | [((1613, 1667), 'scipy.sparse.linalg.eigsh', 'splinalg.eigsh', (['L'], {'which': '"""SM"""', 'k': '(1 + dim)', 'tol': 'tol_eigs'}), "(L, which='SM', k=1 + dim, tol=tol_eigs)\n", (1627, 1667), True, 'import scipy.sparse.linalg as splinalg\n'), ((1677, 1694), 'numpy.real', 'np.real', (['p[:, 1:]'], {}), '(p[:, 1:])\n', (... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import numpy as np
# Generic data augmentation
class Augmenter:
""" Generic data augmentation class with chained operations
"""
def __init__(self, ops=[]):
if not isinstance(ops, list):
print("Error: ops must be a list of fu... | [
"numpy.random.normal",
"random.random"
] | [((712, 727), 'random.random', 'random.random', ([], {}), '()\n', (725, 727), False, 'import random\n'), ((873, 888), 'random.random', 'random.random', ([], {}), '()\n', (886, 888), False, 'import random\n'), ((1058, 1073), 'random.random', 'random.random', ([], {}), '()\n', (1071, 1073), False, 'import random\n'), ((1... |
import numpy as np
def rot_to_angle(rot):
return np.arccos(0.5*np.trace(rot)-0.5)
def rot_to_heading(rot):
# This function calculates the heading angle of the rot matrix w.r.t. the y-axis
new_rot = rot[0:3:2, 0:3:2] # remove the mid row and column corresponding to the y-axis
new_rot = new_rot/np.li... | [
"numpy.trace",
"numpy.arctan2",
"numpy.linalg.det"
] | [((349, 389), 'numpy.arctan2', 'np.arctan2', (['new_rot[1, 0]', 'new_rot[0, 0]'], {}), '(new_rot[1, 0], new_rot[0, 0])\n', (359, 389), True, 'import numpy as np\n'), ((315, 337), 'numpy.linalg.det', 'np.linalg.det', (['new_rot'], {}), '(new_rot)\n', (328, 337), True, 'import numpy as np\n'), ((69, 82), 'numpy.trace', '... |
import logging
logger = logging.getLogger(__name__)
import random
import chainercv
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # NOQA
from pose.hand_dataset.geometry_utils import normalize_joint_zyx
from pose.hand_dataset.image_utils import normalize_depth
# Dec... | [
"logging.getLogger",
"chainercv.visualizations.vis_image",
"matplotlib.pyplot.savefig",
"numpy.asarray",
"matplotlib.pyplot.figure",
"pose.hand_dataset.geometry_utils.normalize_joint_zyx",
"numpy.expand_dims",
"matplotlib.pyplot.show"
] | [((25, 52), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (42, 52), False, 'import logging\n'), ((946, 963), 'numpy.asarray', 'np.asarray', (['point'], {}), '(point)\n', (956, 963), True, 'import numpy as np\n'), ((3562, 3588), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '... |
from typing import List, Tuple, Union
import numpy as np
import scipy.special
from PIL import Image, ImageFilter
class RandomBetaMorphology:
def __init__(
self, filter_size_min: int, filter_size_max: int, alpha: float, beta: float
) -> None:
assert filter_size_min % 2 != 0, "Filter size must ... | [
"argparse.FileType",
"PIL.Image.open",
"argparse.ArgumentParser",
"numpy.random.choice",
"PIL.Image.new",
"PIL.ImageFilter.MinFilter",
"numpy.asarray",
"PIL.ImageOps.invert",
"PIL.ImageFilter.MaxFilter"
] | [((2926, 2951), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2949, 2951), False, 'import argparse\n'), ((1328, 1370), 'numpy.asarray', 'np.asarray', (['filter_probs'], {'dtype': 'np.float32'}), '(filter_probs, dtype=np.float32)\n', (1338, 1370), True, 'import numpy as np\n'), ((1536, 1592), ... |
'''Analysis utility functions.
:Author: <NAME> <<EMAIL>>
:Date: 2016-03-26
:Copyright: 2016-2018, Karr Lab
:License: MIT
'''
# TODO(Arthur): IMPORTANT: refactor and replace
from matplotlib import pyplot
from matplotlib import ticker
from wc_lang import Model, Submodel
from scipy.constants import Avogadro
import nump... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"re.match",
"numpy.max",
"matplotlib.pyplot.close",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.ticker.ScalarFormatter",
"numpy.min",
"matplotlib.p... | [((362, 373), 'numpy.zeros', 'np.zeros', (['(0)'], {}), '(0)\n', (370, 373), True, 'import numpy as np\n'), ((411, 422), 'numpy.zeros', 'np.zeros', (['(0)'], {}), '(0)\n', (419, 422), True, 'import numpy as np\n'), ((447, 458), 'numpy.zeros', 'np.zeros', (['(0)'], {}), '(0)\n', (455, 458), True, 'import numpy as np\n')... |
# 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... | [
"tensorflow.python.ops.sparse_ops.serialize_many_sparse",
"numpy.testing.assert_equal",
"tensorflow.python.ops.variables.global_variables_initializer",
"tensorflow.python.framework.sparse_tensor.SparseTensorValue",
"numpy.array",
"tensorflow.python.ops.variables.Variable",
"numpy.arange",
"tensorflow.... | [((10045, 10056), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (10054, 10056), False, 'from tensorflow.python.platform import test\n'), ((2231, 2283), 'tensorflow.python.framework.sparse_tensor.SparseTensorValue', 'sparse_tensor_lib.SparseTensorValue', (['ind', 'val', 'shape'], {}), '(ind, val... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import pysam
import os
import pandas as pd
import numpy as np
import time
import argparse
import sys
from multiprocessing import Pool
# In[ ]:
# ##arguments for testing
# bam_file_path = '/fh/scratch/delete90/ha_g/realigned_bams/cfDNA_MBC_ULP_hg38/realign_bam_pa... | [
"pandas.Series",
"os.path.exists",
"argparse.ArgumentParser",
"pandas.read_csv",
"pysam.AlignmentFile",
"numpy.array_split",
"numpy.random.randint",
"multiprocessing.Pool",
"os.mkdir",
"pandas.DataFrame",
"sys.stdout.flush",
"time.time",
"pysam.FastaFile"
] | [((762, 787), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (785, 787), False, 'import argparse\n'), ((2901, 2949), 'pandas.read_csv', 'pd.read_csv', (['mapable_path'], {'sep': '"""\t"""', 'header': 'None'}), "(mapable_path, sep='\\t', header=None)\n", (2912, 2949), True, 'import pandas as pd\... |
import numpy as np
import network
def main():
x = np.array([2, 3])
nw = network.NeuralNetwork()
print(nw.feedforward(x))
if __name__ == "__main__":
main()
| [
"numpy.array",
"network.NeuralNetwork"
] | [((56, 72), 'numpy.array', 'np.array', (['[2, 3]'], {}), '([2, 3])\n', (64, 72), True, 'import numpy as np\n'), ((82, 105), 'network.NeuralNetwork', 'network.NeuralNetwork', ([], {}), '()\n', (103, 105), False, 'import network\n')] |
""" Generates Tisserand plots """
from enum import Enum
import numpy as np
from astropy import units as u
from matplotlib import pyplot as plt
from poliastro.plotting._base import BODY_COLORS
from poliastro.twobody.mean_elements import get_mean_elements
from poliastro.util import norm
class TisserandKind(Enum):
... | [
"poliastro.util.norm",
"numpy.sqrt",
"poliastro.twobody.mean_elements.get_mean_elements",
"numpy.linspace",
"numpy.cos",
"numpy.meshgrid",
"matplotlib.pyplot.subplots"
] | [((2191, 2245), 'numpy.linspace', 'np.linspace', (['vinf_span[0]', 'vinf_span[-1]', 'num_contours'], {}), '(vinf_span[0], vinf_span[-1], num_contours)\n', (2202, 2245), True, 'import numpy as np\n'), ((2268, 2311), 'numpy.linspace', 'np.linspace', (['alpha_lim[0]', 'alpha_lim[-1]', 'N'], {}), '(alpha_lim[0], alpha_lim[... |
from mars import main_loop
import numpy as np
from mars.settings import *
class Problem:
"""
Synopsis
--------
User class for the Kelvin-Helmholtz instability
Args
----
None
Methods
-------
initialise
Set all variables in each cell to initialise the simulation.
i... | [
"numpy.random.random",
"numpy.meshgrid",
"numpy.absolute"
] | [((1932, 1970), 'numpy.meshgrid', 'np.meshgrid', (['g.x1', 'g.x2'], {'indexing': '"""ij"""'}), "(g.x1, g.x2, indexing='ij')\n", (1943, 1970), True, 'import numpy as np\n'), ((2043, 2087), 'numpy.meshgrid', 'np.meshgrid', (['g.x1', 'g.x2', 'g.x3'], {'indexing': '"""ij"""'}), "(g.x1, g.x2, g.x3, indexing='ij')\n", (2054,... |
import numpy as np
from scipy.signal import savgol_filter
import matplotlib.pyplot as plt
import MadDog
x = []
y = []
def generate():
# Generate random data
base = np.linspace(0, 5, 11)
# base = np.random.randint(0, 10, 5)
outliers = np.random.randint(10, 20, 2)
data = np.concatenate((base, outli... | [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.linspace",
"numpy.random.randint",
"matplotlib.pyplot.figure",
"numpy.concatenate",... | [((175, 196), 'numpy.linspace', 'np.linspace', (['(0)', '(5)', '(11)'], {}), '(0, 5, 11)\n', (186, 196), True, 'import numpy as np\n'), ((253, 281), 'numpy.random.randint', 'np.random.randint', (['(10)', '(20)', '(2)'], {}), '(10, 20, 2)\n', (270, 281), True, 'import numpy as np\n'), ((293, 325), 'numpy.concatenate', '... |
import random as rn
import numpy as np
# open system dynamics of a qubit and compare numerical results with the analytical calculations
# NOTE these are also TUTORIALS of the library, so see the Tutorials for what these are doing and analytical
# calculations.
# currently includes 2 cases: (i) decay only, and (ii) un... | [
"numpy.exp",
"random.random"
] | [((587, 598), 'random.random', 'rn.random', ([], {}), '()\n', (596, 598), True, 'import random as rn\n'), ((634, 690), 'numpy.exp', 'np.exp', (['(-(1e-05 * (decayRateSM + 1) * 2 + 1.0j) * 50 * t)'], {}), '(-(1e-05 * (decayRateSM + 1) * 2 + 1.0j) * 50 * t)\n', (640, 690), True, 'import numpy as np\n')] |
#!/usr/bin/env python
#=============================================================================#
# #
# NAME: do_RMsynth_1D.py #
# ... | [
"math.sqrt",
"RMutils.util_misc.toscalar",
"numpy.isfinite",
"sys.exit",
"numpy.nanmin",
"os.path.exists",
"RMutils.util_misc.create_frac_spectra",
"argparse.ArgumentParser",
"numpy.diff",
"os.path.split",
"numpy.max",
"numpy.linspace",
"numpy.nanmax",
"numpy.min",
"RMutils.util_plotTk.p... | [((6474, 6508), 'os.path.splitext', 'os.path.splitext', (['args.dataFile[0]'], {}), '(args.dataFile[0])\n', (6490, 6508), False, 'import os\n'), ((7816, 7980), 'RMutils.util_misc.create_frac_spectra', 'create_frac_spectra', ([], {'freqArr': 'freqArr_GHz', 'IArr': 'IArr', 'QArr': 'QArr', 'UArr': 'UArr', 'dIArr': 'dIArr'... |
"""
Contains functions to generate and combine a clustering ensemble.
"""
import numpy as np
import pandas as pd
from sklearn.metrics import pairwise_distances
from sklearn.metrics import adjusted_rand_score as ari
from sklearn.metrics import adjusted_mutual_info_score as ami
from sklearn.metrics import normalized_mutu... | [
"numpy.mean",
"numpy.median",
"numpy.unique",
"clustering.utils.reset_estimator",
"sklearn.metrics.pairwise_distances",
"concurrent.futures.as_completed",
"numpy.array",
"numpy.isnan",
"concurrent.futures.ProcessPoolExecutor",
"numpy.std",
"pandas.DataFrame",
"clustering.utils.compare_arrays"
... | [((4500, 4596), 'sklearn.metrics.pairwise_distances', 'pairwise_distances', (['ensemble.T'], {'metric': '_compare', 'n_jobs': 'n_jobs', 'force_all_finite': '"""allow-nan"""'}), "(ensemble.T, metric=_compare, n_jobs=n_jobs,\n force_all_finite='allow-nan')\n", (4518, 4596), False, 'from sklearn.metrics import pairwise... |
"""
Provides a class that handles the fits metadata required by PypeIt.
.. include common links, assuming primary doc root is up one directory
.. include:: ../include/links.rst
"""
import os
import io
import string
from copy import deepcopy
import datetime
from IPython import embed
import numpy as np
import yaml
fr... | [
"pypeit.core.framematch.FrameTypeBitMask",
"astropy.table.Table",
"pypeit.io.dict_to_lines",
"pypeit.core.parse.str2list",
"numpy.logical_not",
"pypeit.msgs.newline",
"numpy.isin",
"numpy.argsort",
"numpy.array",
"pypeit.core.meta.convert_radec",
"copy.deepcopy",
"numpy.arange",
"pypeit.msgs... | [((78727, 78740), 'numpy.all', 'np.all', (['match'], {}), '(match)\n', (78733, 78740), True, 'import numpy as np\n'), ((4634, 4663), 'pypeit.core.framematch.FrameTypeBitMask', 'framematch.FrameTypeBitMask', ([], {}), '()\n', (4661, 4663), False, 'from pypeit.core import framematch\n'), ((11930, 11956), 'pypeit.core.met... |
import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import String
from cv_bridge import CvBridge
import cv2
import numpy as np
import tensorflow as tf
import classify_image
class RosTensorFlow():
def __init__(self):
classify_image.maybe_download_and_extract()
self._session = tf.Sessio... | [
"rospy.Publisher",
"rospy.Subscriber",
"cv2.imencode",
"rospy.init_node",
"tensorflow.Session",
"rospy.get_param",
"numpy.squeeze",
"cv_bridge.CvBridge",
"rospy.spin",
"classify_image.setup_args",
"classify_image.NodeLookup",
"classify_image.create_graph",
"classify_image.maybe_download_and_... | [((1726, 1753), 'classify_image.setup_args', 'classify_image.setup_args', ([], {}), '()\n', (1751, 1753), False, 'import classify_image\n'), ((1758, 1790), 'rospy.init_node', 'rospy.init_node', (['"""rostensorflow"""'], {}), "('rostensorflow')\n", (1773, 1790), False, 'import rospy\n'), ((243, 286), 'classify_image.may... |
import numpy as np
def segment_Y(Y, **params):
Y_segments = params.get("Y_segments")
Y_quantile = params.get("Y_quantile")
print("segmenting Y")
Y = Y.values.reshape(-1)
Y_quantile = np.quantile(Y, Y_quantile, axis = 0)
bigger_mask = (Y > Y_quantile).copy()
smaller_mask = (Y <= Y_quantile).copy()
Y[bigger_... | [
"numpy.quantile"
] | [((191, 225), 'numpy.quantile', 'np.quantile', (['Y', 'Y_quantile'], {'axis': '(0)'}), '(Y, Y_quantile, axis=0)\n', (202, 225), True, 'import numpy as np\n')] |
import numpy
def lax_friedrichs(cons_minus, cons_plus, simulation, tl):
alpha = tl.grid.dx / tl.dt
flux = numpy.zeros_like(cons_minus)
prim_minus, aux_minus = simulation.model.cons2all(cons_minus, tl.prim)
prim_plus, aux_plus = simulation.model.cons2all(cons_plus , tl.prim)
f_minus = simulation.m... | [
"numpy.zeros_like"
] | [((115, 143), 'numpy.zeros_like', 'numpy.zeros_like', (['cons_minus'], {}), '(cons_minus)\n', (131, 143), False, 'import numpy\n'), ((666, 694), 'numpy.zeros_like', 'numpy.zeros_like', (['cons_minus'], {}), '(cons_minus)\n', (682, 694), False, 'import numpy\n')] |
import numpy as np
import random
from collections import namedtuple
def generate_prob_matrix(n):
matrix = np.random.rand(n, n)
for i in range(n):
matrix[i][i] = 0
for i in range(n):
matrix[i] = (1/np.sum(matrix[i]))*matrix[i]
return matrix
def categorical(p):
return np.random... | [
"collections.namedtuple",
"numpy.random.rand",
"numpy.subtract",
"numpy.sum",
"numpy.zeros",
"numpy.linalg.norm",
"random.random"
] | [((357, 397), 'collections.namedtuple', 'namedtuple', (['"""Drone"""', '"""speed probability"""'], {}), "('Drone', 'speed probability')\n", (367, 397), False, 'from collections import namedtuple\n'), ((405, 435), 'collections.namedtuple', 'namedtuple', (['"""Site"""', '"""location"""'], {}), "('Site', 'location')\n", (... |
#-*- coding:utf-8 -*-
# &Author AnFany
# 引入方法
import Kmeans_AnFany as K_Af # AnFany
import Kmeans_Sklearn as K_Sk # Sklearn
import matplotlib.pyplot as plt
from pylab import mpl # 作图显示中文
mpl.rcParams['font.sans-serif'] = ['FangSong'] # 设置中文字体新宋体
mpl.rcParams['axes.unicode_minus'] = False
import numpy as... | [
"numpy.mean",
"matplotlib.pyplot.title",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"sklearn.datasets.make_blobs",
"numpy.array",
"numpy.sum",
"Kmeans_AnFany.op_kmeans",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.axis",
"Kmeans_Sklearn.KMeans",
"... | [((393, 443), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': '(600)', 'centers': '(6)', 'n_features': '(2)'}), '(n_samples=600, centers=6, n_features=2)\n', (403, 443), False, 'from sklearn.datasets import make_blobs\n'), ((964, 993), 'Kmeans_AnFany.op_kmeans', 'K_Af.op_kmeans', (['X'], {'countcen': '(... |
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation 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 sou... | [
"numba.np.numpy_support.from_dtype",
"numba.np.numpy_support.as_dtype",
"numba.core.errors.TypingError",
"numpy.find_common_type"
] | [((7400, 7457), 'numpy.find_common_type', 'numpy.find_common_type', (['np_array_dtypes', 'np_scalar_dtypes'], {}), '(np_array_dtypes, np_scalar_dtypes)\n', (7422, 7457), False, 'import numpy\n'), ((7483, 7524), 'numba.np.numpy_support.from_dtype', 'numpy_support.from_dtype', (['np_common_dtype'], {}), '(np_common_dtype... |
import argparse
import numpy as np
import os
import sys
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from saliency.visualizer.smiles_visualizer import SmilesVisualizer
def visualize(dir_path):
... | [
"matplotlib.pyplot.ylabel",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.max",
"matplotlib.pyplot.close",
"matplotlib.pyplot.scatter",
"numpy.min",
"numpy.concatenate",
"matplotlib.pyplot.ylim",
"numpy.abs",
"matplotlib.pyplot.savefig",
"matplotlib.... | [((76, 97), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (90, 97), False, 'import matplotlib\n'), ((336, 361), 'os.path.dirname', 'os.path.dirname', (['dir_path'], {}), '(dir_path)\n', (351, 361), False, 'import os\n'), ((611, 629), 'saliency.visualizer.smiles_visualizer.SmilesVisualizer', 'Smi... |
import numpy as np
from PySide2.QtCore import QSignalBlocker, Signal
from PySide2.QtWidgets import QGridLayout, QWidget
from hexrd.ui.scientificspinbox import ScientificDoubleSpinBox
DEFAULT_ENABLED_STYLE_SHEET = 'background-color: white'
DEFAULT_DISABLED_STYLE_SHEET = 'background-color: #F0F0F0'
INVALID_MATRIX_STY... | [
"hexrd.ui.scientificspinbox.ScientificDoubleSpinBox",
"PySide2.QtWidgets.QGridLayout",
"numpy.ones",
"PySide2.QtCore.QSignalBlocker",
"PySide2.QtCore.Signal",
"PySide2.QtWidgets.QApplication",
"numpy.array_equal",
"sys.exit",
"PySide2.QtWidgets.QVBoxLayout",
"PySide2.QtWidgets.QDialog"
] | [((407, 415), 'PySide2.QtCore.Signal', 'Signal', ([], {}), '()\n', (413, 415), False, 'from PySide2.QtCore import QSignalBlocker, Signal\n'), ((6248, 6269), 'numpy.ones', 'np.ones', (['(rows, cols)'], {}), '((rows, cols))\n', (6255, 6269), True, 'import numpy as np\n'), ((6281, 6303), 'PySide2.QtWidgets.QApplication', ... |
import sqlite3
from random import randint, choice
import numpy as np
conn = sqlite3.connect('ej.db')
c = conn.cursor()
#OBTENIENDO TAMAnOS MAXIMOS MINIMOS Y PROMEDIO#
c.execute('SELECT MAX(alto) FROM features')
resultado = c.fetchone()
if resultado:
altoMax = resultado[0]
c.execute('SELECT MIN(alto) FROM featu... | [
"numpy.random.randint",
"sqlite3.connect"
] | [((78, 102), 'sqlite3.connect', 'sqlite3.connect', (['"""ej.db"""'], {}), "('ej.db')\n", (93, 102), False, 'import sqlite3\n'), ((1413, 1448), 'numpy.random.randint', 'np.random.randint', (['(1)', 'rand_alto_min'], {}), '(1, rand_alto_min)\n', (1430, 1448), True, 'import numpy as np\n'), ((1450, 1486), 'numpy.random.ra... |
from itertools import count
import numpy as np
class Particle(object):
"""Object containing all the properties for a single particle"""
_ids = count(0)
def __init__(self, main_data=None, x=np.zeros(2)):
self.id = next(self._ids)
self.main_data = main_data
self.x = np.array(x)
... | [
"numpy.array",
"numpy.zeros",
"itertools.count"
] | [((154, 162), 'itertools.count', 'count', (['(0)'], {}), '(0)\n', (159, 162), False, 'from itertools import count\n'), ((205, 216), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (213, 216), True, 'import numpy as np\n'), ((305, 316), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (313, 316), True, 'import numpy ... |
import os
import glob
import cv2
import numpy as np
import torch
from torchvision.transforms import transforms
from natsort import natsorted
from models import resmasking_dropout1
from utils.datasets.fer2013dataset import EMOTION_DICT
from barez import show
transform = transforms.Compose(
[
transforms.ToPI... | [
"torchvision.transforms.transforms.ToPILImage",
"models.resmasking_dropout1",
"numpy.uint8",
"cv2.resize",
"torch.mean",
"torch.unsqueeze",
"torch.load",
"numpy.min",
"torch.flatten",
"numpy.max",
"torchvision.transforms.transforms.ToTensor",
"os.path.basename",
"numpy.concatenate",
"torch... | [((774, 799), 'models.resmasking_dropout1', 'resmasking_dropout1', (['(3)', '(7)'], {}), '(3, 7)\n', (793, 799), False, 'from models import resmasking_dropout1\n'), ((894, 971), 'torch.load', 'torch.load', (['"""./saved/checkpoints/Z_resmasking_dropout1_rot30_2019Nov30_13.32"""'], {}), "('./saved/checkpoints/Z_resmaski... |
import os
import numpy as np
import tensorflow as tf
from image_quality.utils import utils
class TrainDataGenerator(tf.keras.utils.Sequence):
'''inherits from Keras Sequence base object, allows to use multiprocessing in .fit_generator'''
def __init__(self, samples, img_dir, batch_size, n_classes, basenet_preproc... | [
"image_quality.utils.utils.random_crop",
"image_quality.utils.utils.load_image",
"image_quality.utils.utils.random_horizontal_flip",
"image_quality.utils.utils.normalize_labels",
"numpy.random.shuffle"
] | [((1440, 1471), 'numpy.random.shuffle', 'np.random.shuffle', (['self.indexes'], {}), '(self.indexes)\n', (1457, 1471), True, 'import numpy as np\n'), ((1878, 1924), 'image_quality.utils.utils.load_image', 'utils.load_image', (['img_file', 'self.img_load_dims'], {}), '(img_file, self.img_load_dims)\n', (1894, 1924), Fal... |
# -*- coding: utf-8 -*-
"""
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, Versi... | [
"qiskit.quantum_info.operators.channel.Chi",
"qiskit.quantum_info.operators.channel.Kraus",
"qiskit.quantum_info.operators.channel.Choi",
"qiskit.quantum_info.operators.channel.PTM",
"qat.comm.quops.ttypes.QuantumChannel",
"numpy.array",
"qiskit.quantum_info.operators.channel.SuperOp",
"numpy.real",
... | [((1512, 1556), 'qat.comm.datamodel.ttypes.Matrix', 'Matrix', (['array.shape[0]', 'array.shape[1]', 'data'], {}), '(array.shape[0], array.shape[1], data)\n', (1518, 1556), False, 'from qat.comm.datamodel.ttypes import Matrix, ComplexNumber\n'), ((2444, 2558), 'qat.comm.quops.ttypes.QuantumChannel', 'QuantumChannel', ([... |
#!/usr/bin/env python3
"""
Copyright (c) 2018-2021 Intel Corporation
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 applic... | [
"cv2.vconcat",
"model_api.performance_metrics.PerformanceMetrics",
"images_capture.open_images_capture",
"cv2.imshow",
"logging.info",
"argparse.ArgumentParser",
"pathlib.Path",
"time.perf_counter",
"cv2.VideoWriter",
"numpy.concatenate",
"cv2.VideoWriter_fourcc",
"cv2.waitKey",
"numpy.squee... | [((1125, 1220), 'logging.basicConfig', 'log.basicConfig', ([], {'format': '"""[ %(levelname)s ] %(message)s"""', 'level': 'log.DEBUG', 'stream': 'sys.stdout'}), "(format='[ %(levelname)s ] %(message)s', level=log.DEBUG,\n stream=sys.stdout)\n", (1140, 1220), True, 'import logging as log\n'), ((1249, 1279), 'argparse... |
import math
import imageio
import cv2 as cv
import numpy as np
import transformer
def fix_rotation(img):
img_copy = img.copy()
img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
rows, cols = img.shape
img = cv.adaptiveThreshold(img, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY_INV, 15, 9)
kernel = cv.g... | [
"cv2.imshow",
"cv2.warpPerspective",
"cv2.destroyAllWindows",
"cv2.approxPolyDP",
"math.hypot",
"imageio.get_writer",
"imageio.get_reader",
"cv2.arcLength",
"cv2.medianBlur",
"cv2.contourArea",
"cv2.waitKey",
"cv2.getPerspectiveTransform",
"cv2.minEnclosingCircle",
"cv2.morphologyEx",
"c... | [((142, 177), 'cv2.cvtColor', 'cv.cvtColor', (['img', 'cv.COLOR_BGR2GRAY'], {}), '(img, cv.COLOR_BGR2GRAY)\n', (153, 177), True, 'import cv2 as cv\n'), ((215, 306), 'cv2.adaptiveThreshold', 'cv.adaptiveThreshold', (['img', '(255)', 'cv.ADAPTIVE_THRESH_MEAN_C', 'cv.THRESH_BINARY_INV', '(15)', '(9)'], {}), '(img, 255, cv... |
# This is the code to train the xgboost model with cross-validation for each unique room in the dataset.
# Models are dumped into ./models and results are dumped into two csv files in the current work directory.
import argparse
import json
import math
import os
import pickle
import warnings
from typing import Tuple
i... | [
"pandas.read_csv",
"numpy.array",
"xgboost.DMatrix",
"sklearn.metrics.r2_score",
"numpy.random.RandomState",
"argparse.ArgumentParser",
"xgboost.train",
"json.dumps",
"pandas.set_option",
"xgboost.cv",
"pandas.DataFrame",
"sklearn.model_selection.train_test_split",
"hyperopt.hp.quniform",
... | [((792, 817), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (815, 817), False, 'import argparse\n'), ((1688, 1721), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1711, 1721), False, 'import warnings\n'), ((1722, 1764), 'pandas.set_option', 'pd.s... |
import numpy as np
from pyad.nn import NeuralNet
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
np.random.seed(0)
data = load_breast_cancer()
X_train, X_test, y_train, y_test = train_test_split(
data.data, data.target, train_size=0.8, random_state=0
)
nn = Ne... | [
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_breast_cancer",
"numpy.max",
"pyad.nn.NeuralNet",
"numpy.random.seed"
] | [((151, 168), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (165, 168), True, 'import numpy as np\n'), ((176, 196), 'sklearn.datasets.load_breast_cancer', 'load_breast_cancer', ([], {}), '()\n', (194, 196), False, 'from sklearn.datasets import load_breast_cancer\n'), ((233, 305), 'sklearn.model_selecti... |
# required modules
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib import cm
from matplotlib.colors import Normalize
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.animation import FuncAnimation
# two-dimesional version
def plot_mse_loss_surface_2d(fi... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"numpy.array",
"numpy.gradient",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.diff",
"numpy.linspace",
"matplotlib.gridspec.GridSpec",
"numpy.min",
"numpy.meshgrid",
"matplotlib.pyplot.cm.ScalarMappable",
"matplotlib... | [((434, 480), 'numpy.linspace', 'np.linspace', (['w1_range[0]', 'w1_range[1]'], {'num': 'n_w'}), '(w1_range[0], w1_range[1], num=n_w)\n', (445, 480), True, 'import numpy as np\n'), ((502, 548), 'numpy.linspace', 'np.linspace', (['w2_range[0]', 'w2_range[1]'], {'num': 'n_w'}), '(w2_range[0], w2_range[1], num=n_w)\n', (5... |
# Copyright 2019 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | [
"qkeras.quantized_bits",
"numpy.sqrt",
"numpy.random.rand",
"qkeras.utils.quantized_model_from_json",
"qkeras.QActivation",
"numpy.array",
"tensorflow.keras.backend.clear_session",
"qkeras.extract_model_operations",
"os.remove",
"tensorflow.keras.layers.Input",
"qkeras.binary",
"numpy.testing.... | [((1761, 1793), 'tensorflow.keras.layers.Input', 'Input', (['(28, 28, 1)'], {'name': '"""input"""'}), "((28, 28, 1), name='input')\n", (1766, 1793), False, 'from tensorflow.keras.layers import Input\n'), ((2913, 2946), 'tensorflow.keras.models.Model', 'Model', ([], {'inputs': '[x_in]', 'outputs': '[x]'}), '(inputs=[x_i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# License: BSD-3 (https://tldrlegal.com/license/bsd-3-clause-license-(revised))
# Copyright (c) 2016-2021, <NAME>; Luczywo, Nadia
# All rights reserved.
# =============================================================================
# DOCS
# ===============================... | [
"numpy.asarray",
"numpy.min"
] | [((2605, 2620), 'numpy.asarray', 'np.asarray', (['arr'], {}), '(arr)\n', (2615, 2620), True, 'import numpy as np\n'), ((2632, 2669), 'numpy.min', 'np.min', (['arr'], {'axis': 'axis', 'keepdims': '(True)'}), '(arr, axis=axis, keepdims=True)\n', (2638, 2669), True, 'import numpy as np\n')] |
import numpy as np
from treelas import post_order, TreeInstance
def test_demo_3x7_postord():
parent = np.array([0, 4, 5, 0, 3, 4, 7, 8, 5, 6, 7, 8,
9, 14, 17, 12, 15, 16, 19, 16, 17])
po = post_order(parent, include_root=True)
expect = np.array([12, 11, 19, 20, 21, 14, 15, 18, 17, 1... | [
"numpy.abs",
"numpy.unique",
"treelas.post_order",
"treelas.TreeInstance",
"numpy.array",
"numpy.fromstring"
] | [((108, 193), 'numpy.array', 'np.array', (['[0, 4, 5, 0, 3, 4, 7, 8, 5, 6, 7, 8, 9, 14, 17, 12, 15, 16, 19, 16, 17]'], {}), '([0, 4, 5, 0, 3, 4, 7, 8, 5, 6, 7, 8, 9, 14, 17, 12, 15, 16, 19, 16,\n 17])\n', (116, 193), True, 'import numpy as np\n'), ((222, 259), 'treelas.post_order', 'post_order', (['parent'], {'inclu... |
from tqdm import tqdm
import pandas as pd
import numpy as np, argparse, time, pickle, random, os, datetime
import torch
import torch.optim as optim
from model import MaskedNLLLoss, BC_LSTM
from dataloader import MELDDataLoader
from sklearn.metrics import f1_score, confusion_matrix, accuracy_score, classification_re... | [
"sklearn.metrics.classification_report",
"numpy.array",
"torch.cuda.is_available",
"argparse.ArgumentParser",
"model.BC_LSTM",
"dataloader.MELDDataLoader",
"numpy.random.seed",
"numpy.concatenate",
"numpy.argmin",
"torch.argmax",
"numpy.argmax",
"time.time",
"sklearn.metrics.accuracy_score",... | [((427, 450), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (444, 450), False, 'import torch\n'), ((455, 483), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['seed'], {}), '(seed)\n', (477, 483), False, 'import torch\n'), ((488, 520), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_... |
import logging
from typing import List, Callable
import numpy as np
from pyquaternion import Quaternion
from pyrep import PyRep
from pyrep.errors import IKError
from pyrep.objects import Dummy, Object
from rlbench import utils
from rlbench.action_modes import ArmActionMode, ActionMode
from rlbench.backend.exceptions ... | [
"numpy.flip",
"numpy.abs",
"numpy.allclose",
"numpy.random.get_state",
"numpy.linalg.pinv",
"numpy.minimum",
"pyquaternion.Quaternion",
"numpy.square",
"pyrep.objects.Dummy.create",
"numpy.array",
"numpy.append",
"numpy.dot",
"numpy.matmul",
"numpy.linalg.norm",
"numpy.shape",
"numpy.t... | [((1721, 1735), 'pyrep.objects.Dummy.create', 'Dummy.create', ([], {}), '()\n', (1733, 1735), False, 'from pyrep.objects import Dummy, Object\n'), ((8536, 8557), 'numpy.array', 'np.array', (['action[:-1]'], {}), '(action[:-1])\n', (8544, 8557), True, 'import numpy as np\n'), ((14997, 15012), 'numpy.transpose', 'np.tran... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 <NAME> <<EMAIL>>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import numpy as np
from gensim.corpora... | [
"logging.basicConfig",
"gensim.models.rpmodel.RpModel.load",
"gensim.matutils.sparse2full",
"numpy.allclose",
"gensim.test.utils.get_tmpfile",
"gensim.models.rpmodel.RpModel",
"numpy.array",
"numpy.random.seed",
"gensim.test.utils.datapath",
"unittest.main"
] | [((2218, 2314), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.DEBUG'}), "(format='%(asctime)s : %(levelname)s : %(message)s',\n level=logging.DEBUG)\n", (2237, 2314), False, 'import logging\n'), ((2315, 2330), 'unittest.main', 'unit... |
import os
import h5py
import nibabel as nb
import numpy as np
import torch
import torch.utils.data as data
from torchvision import transforms
import utils.preprocessor as preprocessor
# transform_train = transforms.Compose([
# transforms.RandomCrop(200, padding=56),
# transforms.ToTensor(),
# ])
class Imdb... | [
"os.listdir",
"nibabel.load",
"os.path.join",
"torch.from_numpy",
"utils.preprocessor.estimate_weights_mfb",
"utils.preprocessor.remap_labels",
"numpy.max",
"utils.preprocessor.rotate_orientation",
"numpy.min",
"utils.preprocessor.reduce_slices",
"utils.preprocessor.remove_black",
"numpy.round... | [((4062, 4083), 'nibabel.load', 'nb.load', (['file_path[0]'], {}), '(file_path[0])\n', (4069, 4083), True, 'import nibabel as nb\n'), ((4766, 4828), 'utils.preprocessor.rotate_orientation', 'preprocessor.rotate_orientation', (['volume', 'labelmap', 'orientation'], {}), '(volume, labelmap, orientation)\n', (4797, 4828),... |
import copy
import numpy as np
import open3d as o3d
from tqdm import tqdm
from scipy import stats
import utils_o3d as utils
def remove_ground_plane(pcd, z_thresh=-2.7):
cropped = copy.deepcopy(pcd)
cropped_points = np.array(cropped.points)
cropped_points = cropped_points[cropped_points[:, -1] > z_thresh... | [
"open3d.registration.TransformationEstimationPointToPlane",
"numpy.array",
"copy.deepcopy",
"numpy.linalg.norm",
"numpy.mean",
"numpy.where",
"numpy.asarray",
"numpy.max",
"open3d.registration.RANSACConvergenceCriteria",
"numpy.min",
"open3d.geometry.KDTreeFlann",
"open3d.registration.Correspo... | [((187, 205), 'copy.deepcopy', 'copy.deepcopy', (['pcd'], {}), '(pcd)\n', (200, 205), False, 'import copy\n'), ((227, 251), 'numpy.array', 'np.array', (['cropped.points'], {}), '(cropped.points)\n', (235, 251), True, 'import numpy as np\n'), ((338, 363), 'open3d.geometry.PointCloud', 'o3d.geometry.PointCloud', ([], {})... |
#!/usr/bin/env python
import os
import numpy as np
import pandas as pd
os.getcwd()
# Request for the filename
# Current version of this script works only with TSV type files
mainFilename = input('Input your file name (diabetes.tab.txt or housing.data.txt): ')
print()
# To create proper dataframe, transforming it wi... | [
"pandas.DataFrame",
"numpy.genfromtxt",
"pandas.to_numeric",
"os.getcwd"
] | [((73, 84), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (82, 84), False, 'import os\n'), ((375, 415), 'numpy.genfromtxt', 'np.genfromtxt', (['mainFilename'], {'dtype': '"""str"""'}), "(mainFilename, dtype='str')\n", (388, 415), True, 'import numpy as np\n'), ((432, 458), 'pandas.DataFrame', 'pd.DataFrame', (['filenameD... |
import numpy as np
from sklearn.utils.multiclass import type_of_target
from mindware.base_estimator import BaseEstimator
from mindware.components.utils.constants import type_dict, MULTILABEL_CLS, IMG_CLS, TEXT_CLS, OBJECT_DET
from mindware.components.feature_engineering.transformation_graph import DataNode
class Clas... | [
"numpy.mean",
"numpy.ones_like",
"lightgbm.LGBMClassifier",
"lightgbm.LGBMRegressor",
"sklearn.linear_model.LogisticRegression",
"numpy.sum",
"sklearn.utils.multiclass.type_of_target",
"numpy.std",
"pandas.DataFrame",
"sklearn.linear_model.LinearRegression"
] | [((591, 619), 'sklearn.utils.multiclass.type_of_target', 'type_of_target', (['data.data[1]'], {}), '(data.data[1])\n', (605, 619), False, 'from sklearn.utils.multiclass import type_of_target\n'), ((2957, 2987), 'lightgbm.LGBMClassifier', 'LGBMClassifier', ([], {'random_state': '(1)'}), '(random_state=1)\n', (2971, 2987... |
import time
import warnings
import matplotlib.pyplot as plt
import numpy as np
import sympy as sp
from .global_qbx import global_qbx_self
from .mesh import apply_interp_mat, gauss_rule, panelize_symbolic_surface, upsample
def find_dcutoff_refine(kernel, src, tol, plot=False):
# prep step 1: find d_cutoff and d_... | [
"sympy.cos",
"numpy.log10",
"matplotlib.pyplot.ylabel",
"numpy.array",
"sympy.var",
"numpy.linalg.norm",
"numpy.arange",
"numpy.repeat",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.max",
"numpy.stack",
"numpy.linspace",
"numpy.min",
"warnings.simplefilter",
"numpy.argm... | [((951, 978), 'numpy.ones_like', 'np.ones_like', (['src.pts[:, 0]'], {}), '(src.pts[:, 0])\n', (963, 978), True, 'import numpy as np\n'), ((1130, 1149), 'numpy.arange', 'np.arange', (['(1)', '(55)', '(3)'], {}), '(1, 55, 3)\n', (1139, 1149), True, 'import numpy as np\n'), ((6070, 6091), 'numpy.argmin', 'np.argmin', (['... |
from setuptools import setup, Extension, find_packages
import subprocess
import errno
import re
import os
import shutil
import sys
import zipfile
from urllib.request import urlretrieve
import numpy
from Cython.Build import cythonize
isWindows = os.name == 'nt'
isMac = sys.platform == 'darwin'
is64Bit = sys.maxsize... | [
"zipfile.ZipFile",
"sys.exit",
"os.path.exists",
"urllib.request.urlretrieve",
"subprocess.Popen",
"setuptools.find_packages",
"os.mkdir",
"numpy.get_include",
"glob.glob",
"shutil.copyfile",
"os.makedirs",
"os.environ.get",
"os.path.join",
"os.getcwd",
"os.chdir",
"os.path.basename",
... | [((9442, 9476), 'os.environ.get', 'os.environ.get', (['"""LINETRACE"""', '(False)'], {}), "('LINETRACE', False)\n", (9456, 9476), False, 'import os\n'), ((613, 655), 'os.environ.get', 'os.environ.get', (['"""PKG_CONFIG"""', '"""pkg-config"""'], {}), "('PKG_CONFIG', 'pkg-config')\n", (627, 655), False, 'import os\n'), (... |
# Copyright (c) 2008,2015,2016,2017,2018,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Contains a collection of basic calculations.
These include:
* wind components
* heat index
* windchill
"""
import warnings
import numpy as np
from scip... | [
"numpy.abs",
"numpy.sqrt",
"numpy.asarray",
"numpy.any",
"numpy.exp",
"numpy.array",
"numpy.arctan2",
"numpy.isnan",
"numpy.cos",
"numpy.sin",
"numpy.shape"
] | [((1176, 1198), 'numpy.sqrt', 'np.sqrt', (['(u * u + v * v)'], {}), '(u * u + v * v)\n', (1183, 1198), True, 'import numpy as np\n'), ((2865, 2882), 'numpy.any', 'np.any', (['calm_mask'], {}), '(calm_mask)\n', (2871, 2882), True, 'import numpy as np\n'), ((8772, 8783), 'numpy.any', 'np.any', (['sel'], {}), '(sel)\n', (... |
"""Objects representing regions in space."""
import math
import random
import itertools
import numpy
import scipy.spatial
import shapely.geometry
import shapely.ops
from scenic.core.distributions import Samplable, RejectionException, needsSampling
from scenic.core.lazy_eval import valueInContext
from scenic.core.vec... | [
"random.triangular",
"scenic.core.vectors.OrientedVector",
"numpy.array",
"random.choices",
"scenic.core.lazy_eval.valueInContext",
"math.hypot",
"scenic.core.geometry.findMinMax",
"scenic.core.geometry.triangulatePolygon",
"scenic.core.type_support.toVector",
"scenic.core.geometry.hypot",
"scen... | [((739, 759), 'scenic.core.distributions.needsSampling', 'needsSampling', (['thing'], {}), '(thing)\n', (752, 759), False, 'from scenic.core.distributions import Samplable, RejectionException, needsSampling\n'), ((3511, 3571), 'scenic.core.type_support.toVector', 'toVector', (['thing', '""""X in Y" with X not an Object... |
#!/usr/bin/env python
"""Distribution functions
This module provides functions for dealing with normal distributions
and generating error maps.
When called directly as main, it allows for converting a threshold map
into an error map.
```
$ python -m mlcsim.dist --help
usage: dist.py [-h] [-b {1,2,3,4}] -f F [-o O]... | [
"numpy.ma.masked_outside",
"argparse.ArgumentParser",
"scipy.stats.norm",
"numpy.log",
"numpy.roots",
"json.load",
"pprint.pprint",
"json.dump"
] | [((1404, 1423), 'numpy.roots', 'np.roots', (['[a, b, c]'], {}), '([a, b, c])\n', (1412, 1423), True, 'import numpy as np\n'), ((1437, 1480), 'numpy.ma.masked_outside', 'np.ma.masked_outside', (['roots', 'mean_a', 'mean_b'], {}), '(roots, mean_a, mean_b)\n', (1457, 1480), True, 'import numpy as np\n'), ((3098, 3123), 'a... |
import random
import argparse
import numpy as np
import pandas as pd
import os
import time
import string
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from tqdm import tqdm
from model import WideResnet
from cifar import get_train_loader, get_val_loader
from ... | [
"torch.nn.CrossEntropyLoss",
"torch.max",
"numpy.argsort",
"lr_scheduler.WarmupCosineLrScheduler",
"torch.softmax",
"torch.sum",
"utils.CIFAR10Pair",
"numpy.save",
"os.path.exists",
"numpy.mean",
"argparse.ArgumentParser",
"torch.mean",
"torch.eye",
"os.mkdir",
"numpy.concatenate",
"pa... | [((454, 511), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""" FixMatch Training"""'}), "(description=' FixMatch Training')\n", (477, 511), False, 'import argparse\n'), ((3352, 3363), 'time.time', 'time.time', ([], {}), '()\n', (3361, 3363), False, 'import time\n'), ((3430, 3456), 'os.pat... |
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
data = pd.read_csv("data.csv")
data.info()
"""
Data columns (total 33 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 id 569 no... | [
"numpy.abs",
"pandas.read_csv",
"matplotlib.pyplot.xticks",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.log",
"sklearn.linear_model.LogisticRegression",
"numpy.max",
"numpy.sum",
"numpy.zeros",
"numpy.do... | [((101, 124), 'pandas.read_csv', 'pd.read_csv', (['"""data.csv"""'], {}), "('data.csv')\n", (112, 124), True, 'import pandas as pd\n'), ((1836, 1902), 'sklearn.model_selection.train_test_split', 'train_test_split', (['x_normalized', 'y'], {'test_size': '(0.25)', 'random_state': '(42)'}), '(x_normalized, y, test_size=0.... |
import os
import numpy as np
import torch
import argparse
from hparams import create_hparams
from model import lcm
from train import load_model
from torch.utils.data import DataLoader
from reader import TextMelIDLoader, TextMelIDCollate, id2sp
from inference_utils import plot_data
parser = argparse.ArgumentParser()
p... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"train.load_model",
"torch.load",
"model.lcm",
"hparams.create_hparams",
"numpy.vstack",
"torch.utils.data.DataLoader",
"torch.no_grad",
"reader.TextMelIDLoader",
"inference_utils.plot_data",
"numpy.save"
] | [((293, 318), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (316, 318), False, 'import argparse\n'), ((638, 666), 'hparams.create_hparams', 'create_hparams', (['args.hparams'], {}), '(args.hparams)\n', (652, 666), False, 'from hparams import create_hparams\n'), ((676, 695), 'train.load_model',... |
# Author: <NAME> <<EMAIL>>
import numpy as np
from bolero.representation import BlackBoxBehavior
from bolero.representation import DMPBehavior as DMPBehaviorImpl
class DMPBehavior(BlackBoxBehavior):
"""Dynamical Movement Primitive.
Parameters
----------
execution_time : float, optional (default: 1)
... | [
"numpy.copy",
"numpy.empty",
"bolero.representation.DMPBehavior"
] | [((900, 967), 'bolero.representation.DMPBehavior', 'DMPBehaviorImpl', (['execution_time', 'dt', 'n_features', 'configuration_file'], {}), '(execution_time, dt, n_features, configuration_file)\n', (915, 967), True, 'from bolero.representation import DMPBehavior as DMPBehaviorImpl\n'), ((1340, 1367), 'numpy.empty', 'np.e... |
# Script for data augmentation functions
import numpy as np
from collections import deque
from PIL import Image
import cv2
from data.config import *
def imread_cv2(image_path):
"""
Read image_path with cv2 format (H, W, C)
if image is '.gif' outputs is a numpy array of {0,1}
"""
image_format = ima... | [
"numpy.clip",
"PIL.Image.open",
"numpy.roll",
"numpy.flipud",
"numpy.random.random",
"numpy.fliplr",
"numpy.where",
"cv2.cvtColor",
"numpy.percentile",
"cv2.resize",
"cv2.imread",
"numpy.arange"
] | [((538, 589), 'cv2.resize', 'cv2.resize', (['image', '(width, heigh)', 'cv2.INTER_LINEAR'], {}), '(image, (width, heigh), cv2.INTER_LINEAR)\n', (548, 589), False, 'import cv2\n'), ((379, 401), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (389, 401), False, 'import cv2\n'), ((1257, 1275), 'numpy.r... |
### Load necessary libraries ###
import numpy as np
from sklearn.model_selection import KFold
from sklearn.metrics import accuracy_score
import tensorflow as tf
from tensorflow import keras
from sklearn.metrics import ConfusionMatrixDisplay
model = get_network()
model.summary()
### Train and evaluate via 10-Folds ... | [
"numpy.mean",
"sklearn.metrics.ConfusionMatrixDisplay.from_predictions",
"tensorflow.keras.callbacks.TensorBoard",
"numpy.unique",
"numpy.array",
"numpy.concatenate",
"sklearn.model_selection.KFold",
"sklearn.metrics.accuracy_score"
] | [((365, 470), 'numpy.array', 'np.array', (["['fold1', 'fold2', 'fold3', 'fold4', 'fold5', 'fold6', 'fold7', 'fold8',\n 'fold9', 'fold10']"], {}), "(['fold1', 'fold2', 'fold3', 'fold4', 'fold5', 'fold6', 'fold7',\n 'fold8', 'fold9', 'fold10'])\n", (373, 470), True, 'import numpy as np\n'), ((539, 557), 'sklearn.mo... |
import os
# Restrict the script to run on CPU
os.environ ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = ""
# Import Keras Tensoflow Backend
# from keras import backend as K
import tensorflow as tf
# Configure it to use only specific CPU Cores
config = tf.ConfigProto(intra_op_parallelism_thre... | [
"tensorflow.local_variables_initializer",
"numpy.diagonal",
"os.path.exists",
"os.makedirs",
"tensorflow.Session",
"tensorflow.train.Saver",
"tensorflow.placeholder",
"tensorflow.global_variables_initializer",
"IEOMAP_dataset_AC.dataset",
"os.path.dirname",
"IEOMAP_dataset_AC.IeomapSentenceItera... | [((280, 425), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'intra_op_parallelism_threads': '(4)', 'inter_op_parallelism_threads': '(4)', 'device_count': "{'CPU': 1, 'GPU': 0}", 'allow_soft_placement': '(True)'}), "(intra_op_parallelism_threads=4, inter_op_parallelism_threads\n =4, device_count={'CPU': 1, 'GPU':... |
# Copyright 2017 ProjectQ-Framework (www.projectq.ch)
#
# 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 app... | [
"projectq.types.WeakQubitRef",
"math.acos",
"projectq.MainEngine",
"projectq.cengines.DummyEngine",
"math.sqrt",
"projectq.ops.All",
"pytest.fixture",
"projectq.libs.math.SubConstantModN",
"projectq.libs.math.AddConstantModN",
"projectq.ops.Rx",
"projectq.libs.math.SubConstant",
"numpy.eye",
... | [((2688, 2734), 'pytest.fixture', 'pytest.fixture', ([], {'params': "['mapper', 'no_mapper']"}), "(params=['mapper', 'no_mapper'])\n", (2702, 2734), False, 'import pytest\n'), ((18744, 18847), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""gate_classes"""', '[(Ry, UniformlyControlledRy), (Rz, UniformlyCont... |
"""
Remove Fragments not in Knowledgebase
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__copyright__ = "Copyright 2019, Hong Kong University of Science and Technology"
__license__ = "3-clause BSD"
from argparse import ArgumentParser
import numpy as np
import pickle
parser = ArgumentParser(description="Build Files... | [
"argparse.ArgumentParser",
"numpy.where",
"numpy.empty",
"numpy.full",
"numpy.loadtxt"
] | [((281, 322), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Build Files"""'}), "(description='Build Files')\n", (295, 322), False, 'from argparse import ArgumentParser\n'), ((572, 706), 'numpy.loadtxt', 'np.loadtxt', (["('../%s/%s/%s.Homogenised.boundfrags_zeros.txt' % (args.datadir, args.\n ... |
# -*- coding: utf-8 -*-
"""
Created on Sat May 25 13:17:49 2019
@author: Toonw
"""
import numpy as np
def vlen(a):
return (a[0]**2 + a[1]**2)**0.5
def add(v1,v2):
return (v1[0]+v2[0], v1[1]+v2[1])
def sub(v1,v2):
return (v1[0]-v2[0], v1[1]-v2[1])
def unit_vector(v):
vu = v / np.linalg.norm(v)
... | [
"numpy.dot",
"numpy.linalg.norm"
] | [((300, 317), 'numpy.linalg.norm', 'np.linalg.norm', (['v'], {}), '(v)\n', (314, 317), True, 'import numpy as np\n'), ((394, 408), 'numpy.dot', 'np.dot', (['v1', 'v2'], {}), '(v1, v2)\n', (400, 408), True, 'import numpy as np\n')] |
import numpy as np
import tensorflow as tf
import os
from scipy.io import savemat
from scipy.io import loadmat
from scipy.misc import imread
from scipy.misc import imsave
from alexnet_face_classifier import *
import matplotlib.pyplot as plt
plt.switch_backend('agg')
class backprop_graph:
def __init__(self, num_... | [
"tensorflow.tensordot",
"tensorflow.placeholder",
"matplotlib.pyplot.switch_backend",
"numpy.max",
"tensorflow.gradients",
"tensorflow.nn.softmax",
"numpy.expand_dims",
"tensorflow.log"
] | [((243, 268), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (261, 268), True, 'import matplotlib.pyplot as plt\n'), ((1967, 1991), 'numpy.expand_dims', 'np.expand_dims', (['image', '(0)'], {}), '(image, 0)\n', (1981, 1991), True, 'import numpy as np\n'), ((2006, 2032), 'num... |
import copy
import unittest
import networkx as nx
import numpy as np
from scipy.special import erf
from dfn import Fluid, FractureNetworkThermal
class TestFractureNetworkThermal(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestFractureNetworkThermal, self).__init__(*args, **kwargs)
... | [
"networkx.MultiDiGraph",
"networkx.is_isomorphic",
"numpy.sqrt",
"numpy.ones",
"dfn.FractureNetworkThermal",
"numpy.array",
"numpy.linspace",
"scipy.special.erf",
"dfn.Fluid",
"unittest.main",
"numpy.meshgrid",
"copy.copy"
] | [((10801, 10816), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10814, 10816), False, 'import unittest\n'), ((432, 488), 'dfn.Fluid', 'Fluid', ([], {'density': 'rho_w', 'viscosity': 'mu_w', 'heat_capacity': 'cp_w'}), '(density=rho_w, viscosity=mu_w, heat_capacity=cp_w)\n', (437, 488), False, 'from dfn import Flu... |
import numpy as np
import math
from scipy.optimize import curve_fit
def calc_lorentzian(CestCurveS, x_calcentires, mask, config):
(rows, colums, z_slices, entires) = CestCurveS.shape
lorenzian = {key: np.zeros((rows, colums, z_slices), dtype=float) for key in config.lorenzian_keys}
for k in range(z_slice... | [
"scipy.optimize.curve_fit",
"numpy.zeros"
] | [((212, 259), 'numpy.zeros', 'np.zeros', (['(rows, colums, z_slices)'], {'dtype': 'float'}), '((rows, colums, z_slices), dtype=float)\n', (220, 259), True, 'import numpy as np\n'), ((1741, 1886), 'scipy.optimize.curve_fit', 'curve_fit', (['fit', 'x_calcentires', 'values'], {'bounds': '([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,... |
import backend as F
import numpy as np
import scipy as sp
import dgl
from dgl import utils
import unittest
from numpy.testing import assert_array_equal
np.random.seed(42)
def generate_rand_graph(n):
arr = (sp.sparse.random(n, n, density=0.1, format='coo') != 0).astype(np.int64)
return dgl.DGLGraph(arr, readon... | [
"numpy.testing.assert_equal",
"numpy.hstack",
"unittest.skipIf",
"backend.array_equal",
"backend.sum",
"dgl.random.seed",
"numpy.sort",
"scipy.sparse.random",
"numpy.random.seed",
"dgl.DGLGraph",
"dgl.contrib.sampling.NeighborSampler",
"backend.tensor",
"dgl.contrib.sampling.sampler.create_f... | [((153, 171), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (167, 171), True, 'import numpy as np\n'), ((7157, 7264), 'unittest.skipIf', 'unittest.skipIf', (["(dgl.backend.backend_name == 'tensorflow')"], {'reason': '"""Error occured when multiprocessing"""'}), "(dgl.backend.backend_name == 'tensorfl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.