code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import argparse
import numpy as np
import torch
import os
from aux import make_environment, MLP, mean_nll, mean_accuracy, pretty_print
from torchvision import datasets
from torch import optim
import pickle
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Colored MNIST')
parser.add_argum... | [
"aux.MLP",
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.sqrt",
"torch.autograd.grad",
"numpy.random.set_state",
"aux.mean_nll",
"os.path.join",
"torch.square",
"os.path.exists",
"numpy.int32",
"aux.make_environment",
"aux.mean_accuracy",
"torch.manual_seed",
"torch.cuda.manual_... | [((247, 299), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Colored MNIST"""'}), "(description='Colored MNIST')\n", (270, 299), False, 'import argparse\n'), ((1217, 1285), 'os.path.join', 'os.path.join', (['flags.path', 'f"""mnist_{flags.method}_{flags.rex_weight}"""'], {}), "(flags.pat... |
import numpy
import pandas
from gensim.models import KeyedVectors
import lawa
from tqdm import tqdm
model = KeyedVectors.load_word2vec_format('model/word2vec.txt', binary=False)
df = pandas.read_csv("dataset/total_documents.csv", sep=',', names=['id','document'], skiprows=[0])
adf = df[df.document.notnull()]
total = l... | [
"pandas.read_csv",
"numpy.array2string",
"numpy.mean",
"numpy.array",
"gensim.models.KeyedVectors.load_word2vec_format",
"lawa.lcut"
] | [((109, 178), 'gensim.models.KeyedVectors.load_word2vec_format', 'KeyedVectors.load_word2vec_format', (['"""model/word2vec.txt"""'], {'binary': '(False)'}), "('model/word2vec.txt', binary=False)\n", (142, 178), False, 'from gensim.models import KeyedVectors\n'), ((184, 283), 'pandas.read_csv', 'pandas.read_csv', (['"""... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Example program to simulate a simple prism spectrometer. The system is set to min
deviation at Mercury e line, then output angle are calcualted between Mercury i line
and Helium r line by ray tracing
"""
import poptics.ray as r
from poptics.spectrometer import Prism... | [
"matplotlib.pyplot.title",
"poptics.ray.IntensityRay",
"poptics.vector.Angle",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.zeros",
"matplotlib.pyplot.ylabel",
"math.degrees",
"poptics.wavelength.MaterialIndex",
"numpy.linspace",
"poptics.vector.Unit3d",
"poptics.spectrometer.Pri... | [((640, 655), 'poptics.wavelength.MaterialIndex', 'MaterialIndex', ([], {}), '()\n', (653, 655), False, 'from poptics.wavelength import MaterialIndex, Mercury_e, Mercury_i, Helium_r\n'), ((668, 682), 'poptics.spectrometer.Prism', 'Prism', ([], {'index': 'n'}), '(index=n)\n', (673, 682), False, 'from poptics.spectromete... |
"""Test correction of Multiple Comparison Problem (MCP)."""
import numpy as np
from frites.stats import testwise_correction_mcp as fcn_correction_mcp
from frites.stats import cluster_correction_mcp, cluster_threshold
rnd = np.random.RandomState(0)
class TestMCP(object):
@staticmethod
def assert_equals(tai... | [
"numpy.testing.assert_array_equal",
"frites.stats.cluster_threshold",
"numpy.zeros",
"numpy.random.RandomState",
"frites.stats.testwise_correction_mcp",
"numpy.random.rand",
"frites.stats.cluster_correction_mcp"
] | [((226, 250), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (247, 250), True, 'import numpy as np\n'), ((727, 751), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (748, 751), True, 'import numpy as np\n'), ((1062, 1091), 'numpy.zeros', 'np.zeros', (['(8, 20)'... |
import cv2
import numpy as np
import math
full=cv2.imread('Final_stitch.PNG')
(i,j,k)=np.shape(full)
print(i,j)
col = j/179
#img1 = i*col-col*(90-i)
img0=np.delete(full,slice(math.floor(col*90),j),axis=1)
img89=np.delete(full,slice(0,math.floor(j-90*col)),axis=1)
#cv2.imshow('i1',img1)
#cv2.imshow('i90',img9... | [
"numpy.shape",
"cv2.imread",
"cv2.imshow",
"math.floor"
] | [((50, 80), 'cv2.imread', 'cv2.imread', (['"""Final_stitch.PNG"""'], {}), "('Final_stitch.PNG')\n", (60, 80), False, 'import cv2\n'), ((90, 104), 'numpy.shape', 'np.shape', (['full'], {}), '(full)\n', (98, 104), True, 'import numpy as np\n'), ((326, 350), 'cv2.imshow', 'cv2.imshow', (['"""imgy"""', 'imgy'], {}), "('img... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 10 12:17:34 2018
@author: tedoreve
"""
import numpy as np
b = np.fromfile("./a.bin",dtype = 'float64')
b.shape = [2,2,2,2]
print(b)
| [
"numpy.fromfile"
] | [((119, 158), 'numpy.fromfile', 'np.fromfile', (['"""./a.bin"""'], {'dtype': '"""float64"""'}), "('./a.bin', dtype='float64')\n", (130, 158), True, 'import numpy as np\n')] |
import argparse
import os
import os.path as osp
import numpy as np
import math
import itertools
import copy
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Sequential, Linear, ReLU, Sigmoid, Tanh, Dropout, LeakyReLU
from torch.autograd import Variable
from torch.di... | [
"torch_geometric.utils.to_dense_adj",
"pickle.dump",
"torch.load",
"numpy.zeros",
"sklearn.model_selection.KFold",
"torch.save",
"pickle.load",
"torch_geometric.data.Data",
"numpy.loadtxt",
"torch_geometric.utils.get_laplacian",
"torch.zeros",
"numpy.vstack"
] | [((9292, 9339), 'torch.zeros', 'torch.zeros', (['(2, rows * cols)'], {'dtype': 'torch.long'}), '((2, rows * cols), dtype=torch.long)\n', (9303, 9339), False, 'import torch\n'), ((9356, 9404), 'torch.zeros', 'torch.zeros', (['(rows * cols, 1)'], {'dtype': 'torch.float'}), '((rows * cols, 1), dtype=torch.float)\n', (9367... |
import numpy as np
import numpy.random as rd
import torch
import torch.nn as nn
class QNet(nn.Module): # nn.Module is a standard PyTorch Network
"""
Class for **Q-network**.
:param mid_dim[int]: the middle dimension of networks
:param state_dim[int]: the dimension of state (the number of state vecto... | [
"torch.randint",
"torch.nn.ReLU",
"torch.multinomial",
"torch.randn_like",
"torch.cat",
"torch.zeros",
"torch.normal",
"torch.nn.Softmax",
"torch.nn.Linear",
"numpy.random.rand",
"numpy.sqrt"
] | [((3583, 3626), 'torch.randn_like', 'torch.randn_like', (['a_avg'], {'requires_grad': '(True)'}), '(a_avg, requires_grad=True)\n', (3599, 3626), False, 'import torch\n'), ((5519, 5542), 'torch.randn_like', 'torch.randn_like', (['a_avg'], {}), '(a_avg)\n', (5535, 5542), False, 'import torch\n'), ((7428, 7446), 'torch.nn... |
'''
Created on Mar 11, 2013
@author: Max
TODO: Change basis definitions to enum or add exceptions for giberish labels
'''
import numpy as np
from core.wigner import Wigner
class Operator(object):
"""
Represents an operator in the Hilbert space of a single atomic electronic manifold.
"""
def __init_... | [
"core.wigner.Wigner.clebsch_gordan",
"numpy.zeros",
"numpy.linalg.inv",
"numpy.arange",
"numpy.dot"
] | [((1138, 1174), 'numpy.zeros', 'np.zeros', (['(self.length, self.length)'], {}), '((self.length, self.length))\n', (1146, 1174), True, 'import numpy as np\n'), ((1396, 1432), 'numpy.zeros', 'np.zeros', (['(self.length, self.length)'], {}), '((self.length, self.length))\n', (1404, 1432), True, 'import numpy as np\n'), (... |
import os
import random
import sys
import numpy as np
from PIL import Image
def shift(image):
width, height, d = image.shape
zero_image = np.zeros_like(image)
w = random.randint(0, 20) - 10
h = random.randint(0, 30) - 15
zero_image[max(0, w): min(w + width, width), max(h, 0): min(h + height, hei... | [
"numpy.zeros_like",
"random.randint",
"PIL.Image.open",
"random.random",
"numpy.array",
"PIL.Image.fromarray",
"os.path.join"
] | [((149, 169), 'numpy.zeros_like', 'np.zeros_like', (['image'], {}), '(image)\n', (162, 169), True, 'import numpy as np\n'), ((590, 610), 'numpy.zeros_like', 'np.zeros_like', (['image'], {}), '(image)\n', (603, 610), True, 'import numpy as np\n'), ((781, 817), 'random.randint', 'random.randint', (['(0)', '(width - new_w... |
from keras.layers import Input, Conv2D, Lambda, merge, Dense, Flatten,MaxPooling2D
from keras.models import Model, Sequential
from keras.regularizers import l2
from keras import backend as K
from keras.optimizers import SGD,Adam
from keras.losses import binary_crossentropy
import numpy.random as rng
import numpy as np
... | [
"keras.regularizers.l2",
"numpy.argmax",
"numpy.asarray",
"keras.optimizers.Adam",
"keras.layers.Flatten",
"keras.models.Model",
"keras.backend.abs",
"numpy.zeros",
"keras.layers.Dense",
"numpy.random.randint",
"numpy.random.normal",
"numpy.random.choice",
"keras.layers.Input",
"keras.mode... | [((1533, 1551), 'keras.layers.Input', 'Input', (['input_shape'], {}), '(input_shape)\n', (1538, 1551), False, 'from keras.layers import Input, Conv2D, Lambda, merge, Dense, Flatten, MaxPooling2D\n'), ((1566, 1584), 'keras.layers.Input', 'Input', (['input_shape'], {}), '(input_shape)\n', (1571, 1584), False, 'from keras... |
"""Tests for :func:`nilearn.plotting.plot_img`."""
import pytest
import numpy as np
import matplotlib.pyplot as plt
from nibabel import Nifti1Image
from nilearn.plotting import plot_img
from nilearn.image import get_data
from nilearn._utils.niimg import _is_binary_niimg
from .testing_utils import MNI_AFFINE, testdata_... | [
"nibabel.Nifti1Image",
"matplotlib.pyplot.subplot",
"numpy.eye",
"matplotlib.pyplot.close",
"numpy.zeros",
"nilearn.image.get_data",
"matplotlib.pyplot.figure",
"numpy.array",
"nilearn._utils.niimg._is_binary_niimg",
"pytest.mark.parametrize",
"nilearn.plotting.plot_img"
] | [((1699, 1755), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""display_mode"""', "['x', 'y', 'z']"], {}), "('display_mode', ['x', 'y', 'z'])\n", (1722, 1755), False, 'import pytest\n'), ((2099, 2151), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""binary_img"""', '[True, False]'], {}), "('bina... |
import os
import numpy as np
from PIL import Image
from feature_extractor import FeatureExtractor
import glob
import pickle
from datetime import datetime
from flask import Flask, request, render_template
from random import random
import torch
from flask_uploads import UploadSet, configure_uploads, ALL,DATA
import scipy... | [
"flask_uploads.UploadSet",
"flask.Flask",
"torch.mm",
"PIL.Image.open",
"feature_extractor.FeatureExtractor",
"numpy.argsort",
"random.random",
"flask.render_template",
"glob.glob",
"flask_uploads.configure_uploads"
] | [((331, 346), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (336, 346), False, 'from flask import Flask, request, render_template\n'), ((356, 379), 'flask_uploads.UploadSet', 'UploadSet', (['"""files"""', 'ALL'], {}), "('files', ALL)\n", (365, 379), False, 'from flask_uploads import UploadSet, configure_u... |
"""
autosat - Tools for making SAT instances
"""
import os
import time
import json
import hashlib
import functools
import itertools
import inspect
import warnings
import logging
import sqlite3
from typing import List, Dict, Union
from . import autosat_tseytin
PYSAT_IMPORT_WARNING = "\x1b[91m----> To install pysat: pi... | [
"os.path.abspath",
"json.loads",
"numpy.zeros",
"json.dumps",
"time.time",
"logging.info",
"hashlib.sha256",
"sqlite3.connect",
"inspect.signature",
"functools.wraps",
"itertools.product",
"numpy.array",
"warnings.warn"
] | [((11916, 11936), 'inspect.signature', 'inspect.signature', (['f'], {}), '(f)\n', (11933, 11936), False, 'import inspect\n'), ((12136, 12181), 'itertools.product', 'itertools.product', (['[0, 1]'], {'repeat': 'input_count'}), '([0, 1], repeat=input_count)\n', (12153, 12181), False, 'import itertools\n'), ((12545, 12563... |
import numpy as np
from scipy.linalg import hadamard
import cv2
import random
import cProfile
Tag_d22 = np.array([ list('wwwwwwwwwwwwwwwwwwwwwwwwww'),
list('wbbbbbbbbbbbbbbbbbbbbbbbbw'),
list('wbddddddddddddddddddddddbw'),
list('wbbbbbbbbbbbbbbbbbbbbbbbbw'),
list('wwwwwwwwwwwwwwwwwwwwwwwwww')])... | [
"cv2.GaussianBlur",
"numpy.argmax",
"numpy.argmin",
"numpy.mean",
"numpy.linalg.norm",
"numpy.tile",
"cv2.rectangle",
"cv2.warpPerspective",
"numpy.meshgrid",
"random.randint",
"numpy.logical_xor",
"numpy.linspace",
"numpy.dot",
"numpy.flip",
"cv2.threshold",
"numpy.zeros",
"numpy.di... | [((2250, 2283), 'numpy.zeros', 'np.zeros', (['(4, 2)'], {'dtype': '"""float32"""'}), "((4, 2), dtype='float32')\n", (2258, 2283), True, 'import numpy as np\n'), ((2681, 2701), 'numpy.diff', 'np.diff', (['pts'], {'axis': '(1)'}), '(pts, axis=1)\n', (2688, 2701), True, 'import numpy as np\n'), ((3200, 3252), 'numpy.sqrt'... |
import math, sys
import numpy as np
from scipy.spatial import distance
def find_closest_reference_point(x, obstacle_reference_points):
# Use reference point that is nearest; i.e. partition the space ala K-means clustering
distances = []
for oo in range(len(obstacle_reference_points)):
d = distance.... | [
"numpy.abs",
"numpy.sum",
"numpy.ones",
"numpy.argmin",
"numpy.shape",
"numpy.sin",
"numpy.linalg.norm",
"numpy.tile",
"numpy.copysign",
"scipy.spatial.distance.euclidean",
"numpy.copy",
"numpy.arccos",
"numpy.stack",
"numpy.cross",
"numpy.cos",
"numpy.dot",
"numpy.vstack",
"numpy.... | [((406, 426), 'numpy.argmin', 'np.argmin', (['distances'], {}), '(distances)\n', (415, 426), True, 'import numpy as np\n'), ((1137, 1172), 'numpy.linalg.norm', 'np.linalg.norm', (['reference_direction'], {}), '(reference_direction)\n', (1151, 1172), True, 'import numpy as np\n'), ((1343, 1382), 'numpy.dot', 'np.dot', (... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
# libraries
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import simps
import scipy.constants as cte
from scipy.sparse import diags
from scipy.linalg import inv
from scipy.fftpack import fft, ifft, fftfreq
import scipy.special as sp
from ... | [
"matplotlib.pyplot.title",
"numpy.abs",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.conjugate",
"scipy.special.legendre",
"numpy.linspace",
"scipy.integrate.simps",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"scipy.fftpack.fft",
"matplotlib.pyplot.ylabel",
"sci... | [((1598, 1632), 'scipy.constants.value', 'cte.value', (['"""atomic unit of length"""'], {}), "('atomic unit of length')\n", (1607, 1632), True, 'import scipy.constants as cte\n'), ((1640, 1672), 'scipy.constants.value', 'cte.value', (['"""atomic unit of time"""'], {}), "('atomic unit of time')\n", (1649, 1672), True, '... |
# Copyright 2020 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... | [
"numpy.divide",
"numpy.sum",
"akg.topi.divide",
"akg.topi.sum",
"numpy.subtract",
"numpy.shape",
"numpy.max",
"numpy.exp",
"akg.topi.exp",
"akg.utils.kernel_exec.op_build",
"comm_functions.test_single_out",
"akg.topi.max",
"akg.topi.subtract",
"gen_random.random_gaussian"
] | [((869, 907), 'akg.topi.max', 'topi.max', (['data'], {'axis': '(-1)', 'keepdims': '(True)'}), '(data, axis=-1, keepdims=True)\n', (877, 907), True, 'import akg.topi as topi\n'), ((922, 948), 'akg.topi.subtract', 'topi.subtract', (['data', 'max_1'], {}), '(data, max_1)\n', (935, 948), True, 'import akg.topi as topi\n'),... |
import os
import numpy as np
import tensorflow as tf
from autodist.const import ENV
from autodist.checkpoint.saver import Saver
from autodist.strategy import AllReduce, Parallax, PartitionedAR, RandomAxisPartitionAR
def main(autodist):
TRUE_W = 3.0
TRUE_b = 2.0
NUM_EXAMPLES = 1000
EPOCHS = 1
# ... | [
"os.mkdir",
"tensorflow.compat.v1.RunOptions",
"autodist.checkpoint.saver.Saver",
"numpy.random.seed",
"numpy.allclose",
"tensorflow.Variable",
"tensorflow.train.latest_checkpoint",
"numpy.random.randn",
"tensorflow.compat.v1.placeholder",
"os.path.exists",
"tensorflow.compat.v1.Session",
"ten... | [((460, 480), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (474, 480), True, 'import numpy as np\n'), ((495, 524), 'numpy.random.randn', 'np.random.randn', (['NUM_EXAMPLES'], {}), '(NUM_EXAMPLES)\n', (510, 524), True, 'import numpy as np\n'), ((538, 567), 'numpy.random.randn', 'np.random.randn', (... |
import numpy as np
import numpy.testing as npt
from statsmodels.tools import sequences
def test_discrepancy():
space_0 = [[0.1, 0.5], [0.2, 0.4], [0.3, 0.3], [0.4, 0.2], [0.5, 0.1]]
space_1 = [[1, 3], [2, 6], [3, 2], [4, 5], [5, 1], [6, 4]]
space_2 = [[1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 6]]
c... | [
"statsmodels.tools.sequences.primes_from_2_to",
"statsmodels.tools.sequences.halton",
"numpy.testing.assert_almost_equal",
"numpy.array",
"numpy.testing.assert_allclose",
"statsmodels.tools.sequences.discrepancy",
"statsmodels.tools.sequences.van_der_corput"
] | [((329, 363), 'numpy.array', 'np.array', (['[[0.5, 0.5], [6.5, 6.5]]'], {}), '([[0.5, 0.5], [6.5, 6.5]])\n', (337, 363), True, 'import numpy as np\n'), ((725, 753), 'statsmodels.tools.sequences.van_der_corput', 'sequences.van_der_corput', (['(10)'], {}), '(10)\n', (749, 753), False, 'from statsmodels.tools import seque... |
"""
* This file is part of PYSLAM
* adapted from https://github.com/cvlab-epfl/log-polar-descriptors/blob/aed70f882cddcfe0c27b65768b9248bf1f2c65cb/example.py, see licence therein.
*
* Copyright (C) 2016-present <NAME> <<EMAIL>>
*
* PYSLAM is free software: you can redistribute it and/or modify
* it under the terms... | [
"torch.nn.Dropout",
"modules.ptn.pytorch.models.Transformer",
"torch.std",
"torch.device",
"os.path.join",
"numpy.round",
"numpy.pad",
"torch.load",
"config.cfg.set_lib",
"torch.mean",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torch.cuda.is_available",
"torch.Size",
"torch.set_grad_ena... | [((993, 1023), 'config.cfg.set_lib', 'config.cfg.set_lib', (['"""logpolar"""'], {}), "('logpolar')\n", (1011, 1023), False, 'import config\n'), ((2249, 2340), 'modules.ptn.pytorch.models.Transformer', 'Transformer', ([], {'transform': 'transform', 'coords': 'coords', 'resolution': 'patch_size', 'SIFTscale': 'scale'}), ... |
# cython: language_level=3
# -*- coding: utf-8 -*-
# Note: docstring is flowed in documentation. Line breaks in the docstring will appear in the
# printed output, so be carful not to add then mid-sentence.
"""
Numeric Evaluation and Precision
Support for numeric evaluation with arbitrary precision is just a proof-of... | [
"mathics.core.expression.Complex",
"sympy.ntheory.continued_fraction_reduce",
"mathics.core.expression.Symbol",
"mpmath.log",
"mathics.core.expression.Rational",
"mathics.core.numbers.get_precision",
"numpy.isinf",
"sympy.ntheory.continued_fraction_iterator",
"mathics.core.expression.from_python",
... | [((1322, 1345), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(1024)'}), '(maxsize=1024)\n', (1331, 1345), False, 'from functools import lru_cache\n'), ((53436, 53486), 'collections.namedtuple', 'namedtuple', (['"""ComputationFunctions"""', "('sin', 'cos')"], {}), "('ComputationFunctions', ('sin', 'cos'))\n", (... |
import numpy as np
#
#
#
r = 30.0
theta_deg = 88.2
d0 = 1.0/800
E0 = 1600.0
m = -1
#
# inputs
#
theta = theta_deg * np.pi / 180
print("------------- INPUTS ----------------------")
print("theta = %f deg = %f rad"%(theta_deg,theta))
print("1/d0 = %f lines/mm"%(1/d0))
print("r = %f m"%(r))
print("order = %d m"%(m)... | [
"numpy.cos"
] | [((661, 679), 'numpy.cos', 'np.cos', (['alpha_1000'], {}), '(alpha_1000)\n', (667, 679), True, 'import numpy as np\n'), ((689, 706), 'numpy.cos', 'np.cos', (['beta_1000'], {}), '(beta_1000)\n', (695, 706), True, 'import numpy as np\n'), ((969, 981), 'numpy.cos', 'np.cos', (['beta'], {}), '(beta)\n', (975, 981), True, '... |
# +
from __future__ import absolute_import, division, print_function
import base64
import IPython
import numpy as np
import tensorflow as tf
from tf_agents.agents.dqn import dqn_agent
from tf_agents.drivers import dynamic_step_driver
from tf_agents.environments import suite_gym
from tf_agents.environments import tf_... | [
"numpy.sum",
"pandas.read_csv",
"numpy.floor",
"tf_agents.utils.common.function",
"time.strftime",
"mlflow.log_artifact",
"tensorflow.Variable",
"mlflow.start_run",
"mlflow.log_param",
"environment.MarketEnv",
"numpy.max",
"tf_agents.replay_buffers.tf_uniform_replay_buffer.TFUniformReplayBuffe... | [((843, 892), 'pandas.read_csv', 'pd.read_csv', (['"""../etl/train_dataset_after_pca.csv"""'], {}), "('../etl/train_dataset_after_pca.csv')\n", (854, 892), True, 'import pandas as pd\n'), ((903, 950), 'pandas.read_csv', 'pd.read_csv', (['"""../etl/val_dataset_after_pca.csv"""'], {}), "('../etl/val_dataset_after_pca.csv... |
import numpy as np
from typing import List, Tuple
def _proc_input(input: str):
return list(map(int, input.split("\n")))
def solve_day_1(input: str) -> Tuple[int, int]:
data = _proc_input(input)
ans_1 = (np.diff(data) > 0).sum()
window = np.convolve(
data,
np.ones(3),
'valid'... | [
"numpy.diff",
"numpy.ones"
] | [((293, 303), 'numpy.ones', 'np.ones', (['(3)'], {}), '(3)\n', (300, 303), True, 'import numpy as np\n'), ((220, 233), 'numpy.diff', 'np.diff', (['data'], {}), '(data)\n', (227, 233), True, 'import numpy as np\n'), ((341, 356), 'numpy.diff', 'np.diff', (['window'], {}), '(window)\n', (348, 356), True, 'import numpy as ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Self-Contained Code which allows for the
"""
import sys
import os
import numpy as np
import numpy.random as rand
sys.path.append('../otf_engine')
from math import sin, cos
from struc import Structure
from qe_util import run_espresso, parse_qe_input
def perturb_po... | [
"sys.path.append",
"numpy.random.uniform",
"struc.Structure",
"numpy.empty",
"numpy.zeros",
"qe_util.run_espresso",
"math.sin",
"os.environ.get",
"numpy.linalg.norm",
"math.cos",
"numpy.random.normal",
"numpy.arccos",
"qe_util.parse_qe_input"
] | [((167, 199), 'sys.path.append', 'sys.path.append', (['"""../otf_engine"""'], {}), "('../otf_engine')\n", (182, 199), False, 'import sys\n'), ((453, 476), 'numpy.random.uniform', 'rand.uniform', (['(-180)', '(180)'], {}), '(-180, 180)\n', (465, 476), True, 'import numpy.random as rand\n'), ((485, 503), 'numpy.random.un... |
import numpy as np
from perturbative_solver import solve_oscillon
from matplotlib import pyplot as plt
from progress.bar import Bar
############################################################################
# Edit these parameters:
############################################################################
# the v... | [
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"perturbative_solver.solve_oscillon",
"numpy.empty_like",
"numpy.diff",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"numpy.log10",
"matplotlib.pyplot.xlabel"
] | [((366, 391), 'numpy.linspace', 'np.linspace', (['(0.5)', '(0.6)', '(30)'], {}), '(0.5, 0.6, 30)\n', (377, 391), True, 'import numpy as np\n'), ((521, 536), 'numpy.array', 'np.array', (['[1.0]'], {}), '([1.0])\n', (529, 536), True, 'import numpy as np\n'), ((1074, 1096), 'numpy.empty_like', 'np.empty_like', (['w_range'... |
# ----------------------------------------------------------------------------
# Copyright (c) 2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------... | [
"pandas.DataFrame",
"qiime2.plugins.rescript.actions.evaluate_taxonomy",
"pandas.util.testing.assert_frame_equal",
"numpy.testing.assert_array_equal",
"rescript.evaluate._process_labels",
"rescript.evaluate._evaluate_taxonomy",
"numpy.array",
"pandas.Series",
"rescript.evaluate._evaluate_seqs",
"q... | [((1506, 1556), 'rescript.evaluate._process_labels', 'evaluate._process_labels', (['labels', 'dummy_taxonomies'], {}), '(labels, dummy_taxonomies)\n', (1530, 1556), False, 'from rescript import evaluate\n'), ((1711, 1759), 'rescript.evaluate._process_labels', 'evaluate._process_labels', (['None', 'dummy_taxonomies'], {... |
import matplotlib.pyplot as plt
import numpy as np
colors = [
[0.3, 0.3, 0.3],
[0.6, 0.6, 0.6],
[239/256.0, 74/256.0, 40/256.0],
]
WIDTH = 0.3
SHOW = False
FONT = {'fontname':'Times New Roman', 'size':22}
# figure 1
# BS = 32
# 1 GPU
# a. local pipeline fwd-bwd
# b. CPU RPC fwd-comm-bwd
# c. CUDA RPC f... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.yticks",
"numpy.asarray",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xlabel"
] | [((2176, 2202), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 4)'}), '(figsize=(8, 4))\n', (2186, 2202), True, 'import matplotlib.pyplot as plt\n'), ((3961, 4005), 'matplotlib.pyplot.xticks', 'plt.xticks', (['xs', "['1', '2', '4', '8']"], {}), "(xs, ['1', '2', '4', '8'], **FONT)\n", (3971, 4005), True... |
import logging
import numpy as np
import torch
import torch.nn as nn
from qsparse import (
auto_name_prune_quantize_layers,
get_qsparse_option,
prune,
quantize,
set_qsparse_options,
)
from qsparse.quantize import approx_quantile
def test_auto_name_prune_quantize_layers():
class TwoLayerNet(t... | [
"qsparse.set_qsparse_options",
"qsparse.prune",
"torch.quantile",
"qsparse.quantize",
"logging.StreamHandler",
"qsparse.auto_name_prune_quantize_layers",
"torch.nn.Linear",
"numpy.isclose",
"qsparse.quantize.approx_quantile",
"torch.rand",
"qsparse.get_qsparse_option"
] | [((761, 797), 'qsparse.auto_name_prune_quantize_layers', 'auto_name_prune_quantize_layers', (['net'], {}), '(net)\n', (792, 797), False, 'from qsparse import auto_name_prune_quantize_layers, get_qsparse_option, prune, quantize, set_qsparse_options\n'), ((1063, 1082), 'torch.rand', 'torch.rand', (['(1000,)'], {}), '((10... |
import copy
import warnings
import numpy as np
import pandas as pd
from scipy.io import savemat
from powersimdata import Grid
from powersimdata.input.transform_profile import TransformProfile
PYPSA_AVAILABLE = True
try:
import pypsa
except ImportError:
PYPSA_AVAILABLE = False
pypsa_const = {
"bus": {
... | [
"pandas.DataFrame",
"copy.deepcopy",
"powersimdata.input.transform_profile.TransformProfile",
"numpy.deg2rad",
"scipy.io.savemat",
"numpy.where",
"numpy.array",
"pandas.Series",
"warnings.warn",
"pypsa.Network",
"pandas.concat"
] | [((3743, 3762), 'copy.deepcopy', 'copy.deepcopy', (['grid'], {}), '(grid)\n', (3756, 3762), False, 'import copy\n'), ((7881, 7929), 'powersimdata.input.transform_profile.TransformProfile', 'TransformProfile', (['scenario_info', 'grid', 'ct', 'slice'], {}), '(scenario_info, grid, ct, slice)\n', (7897, 7929), False, 'fro... |
import Ooptimizer as opt
import numpy as np
from GraphLayer import *
from collections import OrderedDict
from Common import *
from TwoLayerNet_BackProp import *
from dataset.mnist import load_mnist
np.random.seed(1)
(x_train,y_train) , (x_test,y_test) = load_mnist(True,True,True)
epoch = 200
x_test = x_test[:100]... | [
"dataset.mnist.load_mnist",
"numpy.random.seed"
] | [((202, 219), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (216, 219), True, 'import numpy as np\n'), ((258, 286), 'dataset.mnist.load_mnist', 'load_mnist', (['(True)', '(True)', '(True)'], {}), '(True, True, True)\n', (268, 286), False, 'from dataset.mnist import load_mnist\n')] |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright 2019 The UFACTORY Inc. All Rights Reserved.
#
# Software License Agreement (BSD License)
#
# Author: <NAME> <<EMAIL>> <<EMAIL>>
# =============================================================================
import cv2
import numpy as np
import math
import time... | [
"cv2.bitwise_and",
"cv2.boxPoints",
"cv2.minAreaRect",
"cv2.erode",
"cv2.imshow",
"cv2.inRange",
"cv2.dilate",
"cv2.cvtColor",
"cv2.drawContours",
"cv2.boundingRect",
"cv2.destroyAllWindows",
"numpy.int0",
"math.sqrt",
"cv2.waitKey",
"cv2.morphologyEx",
"cv2.getStructuringElement",
"... | [((409, 437), 'cv2.VideoCapture', 'cv2.VideoCapture', (['video_port'], {}), '(video_port)\n', (425, 437), False, 'import cv2\n'), ((500, 523), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (521, 523), False, 'import cv2\n'), ((552, 566), 'cv2.waitKey', 'cv2.waitKey', (['(1)'], {}), '(1)\n', (563, ... |
# Author : <NAME>
# Date in : 04-13-2017
# Date curr : 08-10-2017
# -- AlcNet -- #
import numpy as np
import os
import re
import pickle
import gzip
import json
import io
import pandas as pd
from tqdm import tqdm
from collections import Counter
from scipy.spatial.distance import pdist, squareform
from Constants i... | [
"numpy.trace",
"numpy.sum",
"json.dumps",
"numpy.argsort",
"numpy.shape",
"scipy.spatial.distance.pdist",
"pandas.DataFrame",
"numpy.power",
"os.path.exists",
"io.open",
"collections.Counter",
"re.search",
"tqdm.tqdm",
"scipy.spatial.distance.squareform",
"numpy.triu_indices",
"numpy.d... | [((6311, 6352), 'numpy.array', 'np.array', (['molecule.positions'], {'dtype': 'float'}), '(molecule.positions, dtype=float)\n', (6319, 6352), True, 'import numpy as np\n'), ((6411, 6427), 'numpy.zeros', 'np.zeros', (['natoms'], {}), '(natoms)\n', (6419, 6427), True, 'import numpy as np\n'), ((7014, 7079), 'numpy.zeros'... |
#!/usr/bin/env python
# coding: utf-8
# # Predicting Student Admissions with Neural Networks in Keras
# In this notebook, we predict student admissions to graduate school at UCLA based on three pieces of data:
# - GRE Scores (Test)
# - GPA Scores (Grades)
# - Class rank (1-4)
#
# The dataset originally came from here... | [
"matplotlib.pyplot.title",
"keras.layers.core.Dense",
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"pandas.get_dummies",
"matplotlib.pyplot.ylabel",
"numpy.array",
"keras.layers.core.Dropout",
"numpy.argwhere",
"keras.models.Sequential",
"matplotlib.pyplot.xlabel",... | [((729, 760), 'pandas.read_csv', 'pd.read_csv', (['"""student_data.csv"""'], {}), "('student_data.csv')\n", (740, 760), True, 'import pandas as pd\n'), ((1550, 1560), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1558, 1560), True, 'import matplotlib.pyplot as plt\n'), ((2068, 2087), 'matplotlib.pyplot.title... |
from immutable.immutable import update, assoc
from runner.render.draw import *
from runner.utils import findByIdentifier
import pybullet
import tensorflow as tf
import numpy as np
import math
c = 0.30
force = 1075
lateral_friction = 5.0
begin = 25
nr_steps_per_game = 8
nr_games_per_update = 12
n_inputs = 4
n_hidde... | [
"tensorflow.cond",
"immutable.immutable.update",
"tensorflow.nn.sigmoid_cross_entropy_with_logits",
"tensorflow.train.AdamOptimizer",
"runner.utils.findByIdentifier",
"math.radians",
"tensorflow.placeholder",
"immutable.immutable.assoc",
"pybullet.getJointState",
"pybullet.resetJointState",
"ten... | [((787, 859), 'tensorflow.nn.sigmoid_cross_entropy_with_logits', 'tf.nn.sigmoid_cross_entropy_with_logits', ([], {'labels': '[actions]', 'logits': 'logits'}), '(labels=[actions], logits=logits)\n', (826, 859), True, 'import tensorflow as tf\n'), ((876, 913), 'tensorflow.train.AdamOptimizer', 'tf.train.AdamOptimizer', (... |
import skimage.morphology as morphology
import numpy as np
def apply_brightness_contrast(input_img, brightness=0, contrast=0):
if brightness != 0:
if brightness > 0:
shadow = brightness
highlight = 255
else:
shadow = 0
highlight = 255 + brightness
... | [
"numpy.float32",
"numpy.uint8",
"skimage.morphology.disk"
] | [((840, 862), 'numpy.float32', 'np.float32', (['vectorized'], {}), '(vectorized)\n', (850, 862), True, 'import numpy as np\n'), ((1080, 1096), 'numpy.uint8', 'np.uint8', (['center'], {}), '(center)\n', (1088, 1096), True, 'import numpy as np\n'), ((1454, 1472), 'skimage.morphology.disk', 'morphology.disk', (['(3)'], {}... |
"""Tests for the cython implementation of direct_naive."""
import pytest
import numpy as np
from cayenne.simulation import Simulation
from cayenne.utils import get_kstoc
from cayenne.utils import py_roulette_selection as roulette_selection
@pytest.mark.usefixtures("setup_basic", "setup_large")
class TestCython:
... | [
"cayenne.simulation.Simulation",
"cayenne.utils.get_kstoc",
"numpy.array",
"cayenne.utils.py_roulette_selection",
"pytest.mark.usefixtures"
] | [((244, 297), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""setup_basic"""', '"""setup_large"""'], {}), "('setup_basic', 'setup_large')\n", (267, 297), False, 'import pytest\n'), ((431, 484), 'cayenne.simulation.Simulation', 'Simulation', (['species_names', 'rxn_names', 'V_r', 'V_p', 'X0', 'k'], {}), '(sp... |
from warnings import warn
import numpy as np
import scipy as sp
from .tools import gridmake, Options_Container
import matplotlib.pyplot as plt
from functools import reduce
from scipy.sparse import csc_matrix
import copy
__author__ = 'Randall'
class Basis(object):
""" A class for function interpolation.
The ... | [
"numpy.sum",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.asscalar",
"numpy.ndarray",
"numpy.linalg.pinv",
"numpy.prod",
"numpy.atleast_2d",
"numpy.full",
"numpy.identity",
"numpy.linspace",
"numpy.log2",
"numpy.asarray",
"numpy.sort",
"numpy.indices",
"numpy.sque... | [((36220, 36236), 'numpy.atleast_1d', 'np.atleast_1d', (['n'], {}), '(n)\n', (36233, 36236), True, 'import numpy as np\n'), ((36246, 36263), 'numpy.atleast_1d', 'np.atleast_1d', (['qn'], {}), '(qn)\n', (36259, 36263), True, 'import numpy as np\n'), ((36710, 36737), 'numpy.arange', 'np.arange', (['(2 ** (N - 1) + 1)'], ... |
import unittest
import numpy as np
from mmstructlib.crystal.lattice import construct_space_group_operators
class TestCrystalLattice(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def comp_matrix(self, mat1, mat2):
self.assertTrue((mat1==mat2).all())
def test_... | [
"mmstructlib.crystal.lattice.construct_space_group_operators",
"numpy.array"
] | [((353, 399), 'mmstructlib.crystal.lattice.construct_space_group_operators', 'construct_space_group_operators', (["b'P 21 21 21'"], {}), "(b'P 21 21 21')\n", (384, 399), False, 'from mmstructlib.crystal.lattice import construct_space_group_operators\n'), ((481, 542), 'numpy.array', 'np.array', (['[[1.0, 0.0, 0.0], [0.0... |
# -*- coding: utf-8 -*-
import numpy as np
import pygmsh
from helpers import compute_volume
def test():
geom = pygmsh.built_in.Geometry()
X0 = np.array(
[[+0.0, +0.0, 0.0], [+0.5, +0.3, 0.1], [-0.5, +0.3, 0.1], [+0.5, -0.3, 0.1]]
)
R = np.array([0.1, 0.2, 0.1, 0.14])
holes = [
... | [
"pygmsh.generate_mesh",
"numpy.array",
"pygmsh.built_in.Geometry",
"helpers.compute_volume"
] | [((119, 145), 'pygmsh.built_in.Geometry', 'pygmsh.built_in.Geometry', ([], {}), '()\n', (143, 145), False, 'import pygmsh\n'), ((156, 247), 'numpy.array', 'np.array', (['[[+0.0, +0.0, 0.0], [+0.5, +0.3, 0.1], [-0.5, +0.3, 0.1], [+0.5, -0.3, 0.1]]'], {}), '([[+0.0, +0.0, 0.0], [+0.5, +0.3, 0.1], [-0.5, +0.3, 0.1], [+0.5... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 24 16:17:07 2017
@author: rwilson
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import stats
from matplotlib.widgets import Slider
import matplotlib.patches as patches
import itertools
class post_utilities:
... | [
"numpy.polyfit",
"numpy.isnan",
"numpy.argsort",
"matplotlib.pyplot.figure",
"numpy.mean",
"pandas.DataFrame",
"matplotlib.patches.Rectangle",
"numpy.polyval",
"pandas.merge",
"numpy.isfinite",
"scipy.stats.linregress",
"itertools.product",
"numpy.log10",
"matplotlib.pyplot.pause",
"pand... | [((1408, 1420), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1418, 1420), True, 'import matplotlib.pyplot as plt\n'), ((1429, 1443), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (1437, 1443), True, 'import matplotlib.pyplot as plt\n'), ((2201, 2223), 'matplotlib.pyplot.plot', 'plt... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"numpy.array"
] | [((5232, 5263), 'numpy.array', 'np.array', (['data'], {'dtype': '"""float32"""'}), "(data, dtype='float32')\n", (5240, 5263), True, 'import numpy as np\n')] |
"""
Script that trains Sklearn multitask models on PCBA dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import numpy as np
import shutil
from deepchem.molnet import load_pcba
from sklearn.ensemble import RandomForestClassifier
from de... | [
"sklearn.ensemble.RandomForestClassifier",
"numpy.random.seed",
"os.makedirs",
"deepchem.utils.evaluate.Evaluator",
"os.path.exists",
"deepchem.models.sklearn_models.SklearnModel",
"deepchem.molnet.load_pcba",
"shutil.rmtree",
"deepchem.models.multitask.SingletaskToMultitask",
"os.path.join",
"d... | [((541, 560), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (555, 560), True, 'import numpy as np\n'), ((674, 705), 'os.path.join', 'os.path.join', (['base_dir', '"""model"""'], {}), "(base_dir, 'model')\n", (686, 705), False, 'import os\n'), ((709, 733), 'os.path.exists', 'os.path.exists', (['base... |
from enum import Enum
import numpy as np
from scipy.special import lambertw
class Algorithm_Names(Enum):
GREEDY1 = 0
GREEDY2 = 1
GREEDY3 = 2
GREEDY1S = 3
HILL1 = 4
HILL1S = 5
HILL2 = 6
HILL2S = 7
SA = 8
SAS = 9
CASANOVA = 10
CASANOVAS = 11
CPLEX = 12
RLPS = 13
... | [
"scipy.special.lambertw",
"numpy.exp",
"numpy.log",
"numpy.sqrt"
] | [((6589, 6599), 'numpy.sqrt', 'np.sqrt', (['x'], {}), '(x)\n', (6596, 6599), True, 'import numpy as np\n'), ((6653, 6662), 'numpy.log', 'np.log', (['x'], {}), '(x)\n', (6659, 6662), True, 'import numpy as np\n'), ((6776, 6785), 'numpy.log', 'np.log', (['x'], {}), '(x)\n', (6782, 6785), True, 'import numpy as np\n'), ((... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
utilities.py
Author: <NAME>
Last Edited: 30.11.2018
Python Version: 3.6.5
Static methods supproting the TRMOKE_V20 and other applications.
Structure of this module:
1) Imports
2) Static Methods - calculate Vectors from given Inputs
3) Message method
4) Math methods... | [
"os.stat",
"os.path.isfile",
"numpy.fromstring",
"smtplib.SMTP"
] | [((4498, 4533), 'smtplib.SMTP', 'smtplib.SMTP', (['"""smtp.gmail.com"""', '(587)'], {}), "('smtp.gmail.com', 587)\n", (4510, 4533), False, 'import smtplib\n'), ((7897, 7921), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), '(filename)\n', (7911, 7921), False, 'import os\n'), ((8069, 8120), 'numpy.fromstring', '... |
"""
Display functions.
<NAME>
"""
import numpy as np
import tensorflow as tf
from PIL import ImageDraw, Image, ImageFont
def draw_boxes(image: tf.Tensor,
original_shape: tuple,
resized_shape: tuple,
bboxes: list,
labels: list,
scores: list,
... | [
"PIL.Image.fromarray",
"PIL.ImageDraw.Draw",
"numpy.array"
] | [((1660, 1682), 'PIL.Image.fromarray', 'Image.fromarray', (['image'], {}), '(image)\n', (1675, 1682), False, 'from PIL import ImageDraw, Image, ImageFont\n'), ((1791, 1812), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['image'], {}), '(image)\n', (1805, 1812), False, 'from PIL import ImageDraw, Image, ImageFont\n'), ((112... |
import os
import sys
import numpy as np
import torch
import torch.nn as nn
import argparse
from easydict import EasyDict as edict
from tqdm import trange
YOUR_PATH = os.environ['YOUR_PATH']
sys.path.insert(0, os.path.join(YOUR_PATH, 'fNIRS-mental-workload-classifiers/helpers'))
import models
import brain_data
from u... | [
"argparse.ArgumentParser",
"brain_data.brain_dataset",
"utils.save_training_curves_FixedTrainValSplit_overlaid",
"torch.nn.NLLLoss",
"numpy.arange",
"torch.device",
"os.path.join",
"utils.makedir_if_not_exist",
"utils.plot_confusion_matrix",
"utils.generic_GetTrainValTestSubjects",
"torch.utils.... | [((686, 711), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (709, 711), False, 'import argparse\n'), ((212, 280), 'os.path.join', 'os.path.join', (['YOUR_PATH', '"""fNIRS-mental-workload-classifiers/helpers"""'], {}), "(YOUR_PATH, 'fNIRS-mental-workload-classifiers/helpers')\n", (224, 280), Fa... |
#!/usr/bin/env python3
import sys
sys.path.append("../")
import plotlib
import numpy
import pylab
import networkx
import pickle
import sys
start_node=int(sys.argv[1])
G,pos=pickle.load(open("graph.pickle","rb"))
e=numpy.loadtxt("eigenval.csv", delimiter=",")
v=numpy.loadtxt("eigenvec.csv", delimiter=",")
group_id=n... | [
"sys.path.append",
"numpy.argsort",
"numpy.around",
"numpy.loadtxt"
] | [((35, 57), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (50, 57), False, 'import sys\n'), ((218, 262), 'numpy.loadtxt', 'numpy.loadtxt', (['"""eigenval.csv"""'], {'delimiter': '""","""'}), "('eigenval.csv', delimiter=',')\n", (231, 262), False, 'import numpy\n'), ((265, 309), 'numpy.loadtxt'... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 12 15:18:57 2018
@author: Denny.Lehman
"""
import pandas as pd
import numpy as np
import datetime
import time
from pandas.tseries.offsets import MonthEnd
def npv(rate, df):
value = 0
for i in range(0, df.size):
value += df.iloc[i] / (1 + rate) ** (i + 1... | [
"pandas.tseries.offsets.MonthEnd",
"pandas.read_csv",
"numpy.zeros",
"numpy.ones",
"time.time",
"pandas.read_excel",
"numpy.timedelta64",
"pandas.to_datetime",
"numpy.array",
"datetime.time",
"pandas.DateOffset",
"pandas.concat",
"numpy.concatenate"
] | [((1303, 1355), 'pandas.read_csv', 'pd.read_csv', (['filepath'], {'sep': '""","""', 'skiprows': '(0)', 'header': '(2)'}), "(filepath, sep=',', skiprows=0, header=2)\n", (1314, 1355), True, 'import pandas as pd\n'), ((1559, 1570), 'time.time', 'time.time', ([], {}), '()\n', (1568, 1570), False, 'import time\n'), ((1631,... |
#
# Turn per residue
#
from ..parser import parse
from ..axis import principal_axis
from ..dssp import dssp as dssp_mod
import numpy as np
import matplotlib.pyplot as plt
from ..common import normal
from ..common import angle
from .fit import fit
def tpr_algo(alpha_carbons, axis_direction, axis_center):
"""
... | [
"matplotlib.pyplot.savefig",
"numpy.arange",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.clf"
] | [((1917, 1941), 'numpy.arange', 'np.arange', (['(0)', '(1)', '(1 / 100)'], {}), '(0, 1, 1 / 100)\n', (1926, 1941), True, 'import numpy as np\n'), ((1955, 2003), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'subplot_kw': "{'projection': 'polar'}"}), "(subplot_kw={'projection': 'polar'})\n", (1967, 2003), True, 'i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author : <NAME>
# E-mail : <EMAIL>
# Description:
# Date : 08/09/2018 12:00 AM
# File Name : get_ur5_robot_state.py
import rospy
import numpy as np
import moveit_commander
def get_robot_state_moveit():
# moveit_commander.roscpp_initialize(sys.argv)
... | [
"numpy.sum",
"rospy.set_param",
"moveit_commander.MoveGroupCommander",
"rospy.Rate",
"rospy.loginfo",
"rospy.is_shutdown",
"numpy.array",
"rospy.init_node"
] | [((845, 911), 'rospy.init_node', 'rospy.init_node', (['"""ur5_state_checker_if_it_at_home"""'], {'anonymous': '(True)'}), "('ur5_state_checker_if_it_at_home', anonymous=True)\n", (860, 911), False, 'import rospy\n'), ((923, 937), 'rospy.Rate', 'rospy.Rate', (['(10)'], {}), '(10)\n', (933, 937), False, 'import rospy\n')... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import re
import heapq
from nltk.corpus import stopwords
from nltk import word_tokenize
STOPWORDS = set(stopwords.words('english'))
from nltk.stem.lancaster import LancasterStemmer
stemmer = LancasterStemmer()
from keras.preprocessing.text import ... | [
"numpy.argmax",
"keras.preprocessing.sequence.pad_sequences",
"sklearn.model_selection.train_test_split",
"nltk.stem.lancaster.LancasterStemmer",
"nltk.word_tokenize",
"pandas.DataFrame",
"heapq.nlargest",
"keras.preprocessing.text.Tokenizer",
"tensorflow.keras.optimizers.Adam",
"keras.Model",
"... | [((264, 282), 'nltk.stem.lancaster.LancasterStemmer', 'LancasterStemmer', ([], {}), '()\n', (280, 282), False, 'from nltk.stem.lancaster import LancasterStemmer\n'), ((177, 203), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (192, 203), False, 'from nltk.corpus import stopw... |
import numpy as np
import pandas as pd
#Código em Python desenvolvido por <NAME> para o primeiro Trabalho de Economia,
#Em Conjunto e parceria de <NAME> e <NAME>
colunas = [20 ,22 ,24 ,26 ,27 ,28 ,30 ]#columns
linhas = [70,72,74,76,78,80,81,82]#index
matriz = [
[22.71 ,23.444 ,24.133... | [
"pandas.DataFrame",
"numpy.array"
] | [((836, 852), 'numpy.array', 'np.array', (['matriz'], {}), '(matriz)\n', (844, 852), True, 'import numpy as np\n'), ((861, 915), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'data', 'index': 'linhas', 'columns': 'colunas'}), '(data=data, index=linhas, columns=colunas)\n', (873, 915), True, 'import pandas as pd\n')... |
import numpy as np
from numpy import pi
# define some global constants
mu0 = 4 * pi * 1e-7
rho = 2.0e19 * 2 * 1.67 * 1e-27
mion = 2 * 1.67 * 1e-27
def load_data(start, end, skip, path_plus_prefix, is_incompressible):
"""
Loads in the incompressible MHD simulations
Parameters
----------
start: in... | [
"numpy.asarray",
"numpy.mean",
"numpy.array",
"numpy.sqrt"
] | [((5700, 5716), 'numpy.array', 'np.array', (['Bx_mat'], {}), '(Bx_mat)\n', (5708, 5716), True, 'import numpy as np\n'), ((5730, 5746), 'numpy.array', 'np.array', (['By_mat'], {}), '(By_mat)\n', (5738, 5746), True, 'import numpy as np\n'), ((5760, 5776), 'numpy.array', 'np.array', (['Bz_mat'], {}), '(Bz_mat)\n', (5768, ... |
# -*- coding: utf-8 -*-
import tempfile
import pandas as pd
import numpy as np
def follow(id1, edges, visited=None, weak=True):
if visited is None:
visited = set()
visited.add(id1)
for row in edges[edges['id1'] == id1].values:
if(row[1] not in visited):
follow(row[1], edges,... | [
"pandas.DataFrame",
"numpy.empty",
"numpy.append",
"tempfile.TemporaryFile",
"pandas.concat"
] | [((1025, 1052), 'numpy.empty', 'np.empty', (['(0, 2)'], {'dtype': 'int'}), '((0, 2), dtype=int)\n', (1033, 1052), True, 'import numpy as np\n'), ((1182, 1227), 'pandas.DataFrame', 'pd.DataFrame', (['deduped'], {'columns': "['id1', 'id2']"}), "(deduped, columns=['id1', 'id2'])\n", (1194, 1227), True, 'import pandas as p... |
import pickle
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from cycler import cycler
import pystorm
from pystorm.hal.calibrator import Calibrator, PoolSpec
import utils
TAU_READOUT = 0.1
DATA_DIR = "data/test_accumulator_decodes/"
FIG_DIR = "figures/test_accumulator_decodes/"
DATA_FNA... | [
"matplotlib.pyplot.get_cmap",
"matplotlib.cm.get_cmap",
"matplotlib.pyplot.style.use",
"pickle.load",
"matplotlib.pyplot.rc",
"numpy.linspace",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.subplots"
] | [((674, 760), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""/Users/samfok/Code/accumulator_decode/figures/ieee_tran.mplstyle"""'], {}), "(\n '/Users/samfok/Code/accumulator_decode/figures/ieee_tran.mplstyle')\n", (687, 760), True, 'import matplotlib.pyplot as plt\n'), ((806, 837), 'matplotlib.pyplot.rc', 'pl... |
import numpy as np
def get_binary_multi_label_accuracy(target: np.ndarray, pred: np.ndarray, threshold: float = 0.5):
pred_masked = pred.copy()
pred_masked[pred > threshold] = 1
pred_masked[pred <= threshold] = 0
corrects = pred_masked == target
corrects_per_joint = corrects.sum(axis=0)
accura... | [
"numpy.array",
"numpy.sum"
] | [((1236, 1264), 'numpy.array', 'np.array', (['corrects_per_joint'], {}), '(corrects_per_joint)\n', (1244, 1264), True, 'import numpy as np\n'), ((387, 413), 'numpy.sum', 'np.sum', (['accuracy_per_joint'], {}), '(accuracy_per_joint)\n', (393, 413), True, 'import numpy as np\n'), ((1342, 1368), 'numpy.sum', 'np.sum', (['... |
import numpy as np
from hexrd import imageseries
from hexrd.imageseries import stats
from .common import ImageSeriesTest, make_array, make_array_ims
class TestImageSeriesStats(ImageSeriesTest):
def test_stats_average(self):
"""Processed imageseries: median"""
a = make_array()
is_a = im... | [
"hexrd.imageseries.stats.percentile",
"hexrd.imageseries.stats.max",
"numpy.average",
"numpy.median",
"numpy.zeros",
"hexrd.imageseries.open",
"hexrd.imageseries.stats.median",
"hexrd.imageseries.stats.average_iter",
"numpy.percentile",
"numpy.max",
"numpy.min",
"numpy.linalg.norm",
"hexrd.i... | [((318, 357), 'hexrd.imageseries.open', 'imageseries.open', (['None', '"""array"""'], {'data': 'a'}), "(None, 'array', data=a)\n", (334, 357), False, 'from hexrd import imageseries\n'), ((375, 394), 'hexrd.imageseries.stats.average', 'stats.average', (['is_a'], {}), '(is_a)\n', (388, 394), False, 'from hexrd.imageserie... |
import pandas as pd, joblib, os, math, numpy as np
from ast import literal_eval
matches_data = pd.read_csv('Matches.csv')
playing_11_data = pd.read_csv('playing_11.csv')
rows = matches_data.shape[0]
for i in range(0, rows):
match_id = matches_data['ID']
######## HOME WEIGHT ##################... | [
"pandas.DataFrame",
"pandas.read_csv",
"numpy.isnan",
"os.path.isfile",
"ast.literal_eval",
"joblib.load"
] | [((96, 122), 'pandas.read_csv', 'pd.read_csv', (['"""Matches.csv"""'], {}), "('Matches.csv')\n", (107, 122), True, 'import pandas as pd, joblib, os, math, numpy as np\n'), ((141, 170), 'pandas.read_csv', 'pd.read_csv', (['"""playing_11.csv"""'], {}), "('playing_11.csv')\n", (152, 170), True, 'import pandas as pd, jobli... |
import pandas as pd
import numpy as np
import os
from utils.utils import *
from pathlib import Path
base_path = os.path.dirname(os.path.realpath(__file__))
base_path = str(Path(base_path).parent.absolute())
with open(base_path + '/datasets/TS1_ids') as f:
TS1_ids = f.read().splitlines()
with open(base_path + '/da... | [
"pandas.read_csv",
"os.path.realpath",
"numpy.triu_indices",
"pathlib.Path",
"numpy.where",
"numpy.mean",
"numpy.loadtxt"
] | [((129, 155), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (145, 155), False, 'import os\n'), ((1488, 1558), 'numpy.loadtxt', 'np.loadtxt', (["(base_path + '/datasets/ss_base_pairs_labels/' + k + '.bps')"], {}), "(base_path + '/datasets/ss_base_pairs_labels/' + k + '.bps')\n", (1498, 1558... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Coordinates interpolation
=========================
This example illustrates how OMAS can automatically interpolate data
defined on coordinates that were already present in the data structure.
This feature is extremely useful when different codes that have different
com... | [
"numpy.linspace"
] | [((579, 603), 'numpy.linspace', 'numpy.linspace', (['(0)', '(1)', '(10)'], {}), '(0, 1, 10)\n', (593, 603), False, 'import numpy\n'), ((768, 791), 'numpy.linspace', 'numpy.linspace', (['(0)', '(1)', '(5)'], {}), '(0, 1, 5)\n', (782, 791), False, 'import numpy\n'), ((1241, 1264), 'numpy.linspace', 'numpy.linspace', (['(... |
import os
import json
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
from collections import Counter
import bert_tokenization
class LearningRateLogCallback(tf.keras.callbacks.Callback):
def __init__(self, log_dir):
super(LearningRateLogCallback, self).__init__()
file_wri... | [
"tensorflow.random.set_seed",
"bert_tokenization.FullSentencePieceTokenizer",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.callbacks.ModelCheckpoint",
"os.path.join",
"tensorflow.keras.optimizers.schedules.PolynomialDecay",
"tensorflow.keras.layers.Concatenate",
"bert_tokenization.FullTokenizer"... | [((326, 377), 'tensorflow.summary.create_file_writer', 'tf.summary.create_file_writer', (["(log_dir + '/metrics')"], {}), "(log_dir + '/metrics')\n", (355, 377), True, 'import tensorflow as tf\n'), ((693, 755), 'tensorflow.keras.backend.get_value', 'tf.keras.backend.get_value', (['self.model.optimizer.learning_rate'], ... |
from __future__ import print_function, division
import os
import io
import numpy as np
from sklearn.metrics import f1_score
import torch
import torchtext
import seq2seq
from seq2seq.loss import NLLLoss
class Evaluator(object):
""" Class to evaluate models with given datasets.
Args:
loss (seq2seq.lo... | [
"seq2seq.loss.NLLLoss",
"numpy.zeros",
"os.system",
"numpy.random.randint",
"torch.cuda.is_available",
"io.open",
"os.path.join"
] | [((498, 507), 'seq2seq.loss.NLLLoss', 'NLLLoss', ([], {}), '()\n', (505, 507), False, 'from seq2seq.loss import NLLLoss\n'), ((2427, 2462), 'numpy.random.randint', 'np.random.randint', (['(1000000)', '(2000000)'], {}), '(1000000, 2000000)\n', (2444, 2462), True, 'import numpy as np\n'), ((2485, 2540), 'os.path.join', '... |
import tensorflow as tf
import cv2
from PIL import Image
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
import math
from utils.misc import CaptionData, TopN, ImageLoader
import skimage
def load_image_into_numpy_array(filename):
try:
image = I... | [
"utils.misc.CaptionData",
"tensorflow.ConfigProto",
"matplotlib.pyplot.figure",
"numpy.tile",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.set_cmap",
"tensorflow.GraphDef",
"numpy.log2",
"tensorflow.Session",
"matplotlib.pyplot.text",
"matplotlib.use",
"tensorflow.gfile.GFile",
"tensorflow... | [((82, 96), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (89, 96), True, 'import matplotlib as mpl\n'), ((319, 339), 'PIL.Image.open', 'Image.open', (['filename'], {}), '(filename)\n', (329, 339), False, 'from PIL import Image\n'), ((705, 715), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (713, 7... |
import sys
import numpy as np
import scipy.io as si
import scipy.signal as ss
# import sounddevice as sd
import matplotlib.pyplot as plt
import matplotlib.image as image
def nextpow2(i):
n = 1
while n < i: n *= 2
return n
def unitseq(x):
x = x - np.mean(x)
x = x / np.std(x, ddof=1)
return x
... | [
"matplotlib.pyplot.title",
"numpy.isreal",
"numpy.abs",
"numpy.maximum",
"numpy.sum",
"numpy.argmax",
"scipy.io.loadmat",
"numpy.angle",
"numpy.floor",
"numpy.amin",
"numpy.ones",
"numpy.shape",
"numpy.imag",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"numpy.sin",
"numpy.round",
... | [((4053, 4069), 'numpy.shape', 'np.shape', (['COCHBA'], {}), '(COCHBA)\n', (4061, 4069), True, 'import numpy as np\n'), ((4822, 4842), 'numpy.zeros', 'np.zeros', (['(N, M - 1)'], {}), '((N, M - 1))\n', (4830, 4842), True, 'import numpy as np\n'), ((5050, 5081), 'numpy.real', 'np.real', (['COCHBA[1:p + 2, M - 1]'], {}),... |
from sklearn import decomposition
from sklearn import datasets
from sklearn.cross_validation import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import classification_report, accuracy_score
import numpy as np
np.random.seed(5)
centers = [[1, 1], [-1, -1], [1, -... | [
"sklearn.datasets.load_digits",
"sklearn.cross_validation.train_test_split",
"numpy.random.seed",
"sklearn.metrics.accuracy_score",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.decomposition.PCA"
] | [((265, 282), 'numpy.random.seed', 'np.random.seed', (['(5)'], {}), '(5)\n', (279, 282), True, 'import numpy as np\n'), ((334, 356), 'sklearn.datasets.load_digits', 'datasets.load_digits', ([], {}), '()\n', (354, 356), False, 'from sklearn import datasets\n'), ((418, 452), 'sklearn.decomposition.PCA', 'decomposition.PC... |
import pytest
import numpy as np
from tqdm.auto import tqdm
from covidxpert.utils import get_projected_points
from covidxpert.utils.test_utils import static_test
def test_static_get_projected_points():
l_tests = [{'Input': (0, 0, 0, 0), 'Output': ZeroDivisionError},
{'Input': (1, 0, 0, 0), 'Output'... | [
"numpy.random.uniform",
"covidxpert.utils.get_projected_points",
"numpy.isinf",
"pytest.raises",
"numpy.isclose",
"covidxpert.utils.test_utils.static_test"
] | [((735, 777), 'covidxpert.utils.test_utils.static_test', 'static_test', (['get_projected_points', 'l_tests'], {}), '(get_projected_points, l_tests)\n', (746, 777), False, 'from covidxpert.utils.test_utils import static_test\n'), ((921, 982), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': 'min_val', 'high': '... |
import argparse
import logging
import os
import pprint
import sys
import time
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy
from astropy.coordinates import SkyCoord, EarthLocation
import astropy.units as u
from rascil.data_models import ReceptorFrame, PolarisationFrame
from r... | [
"rascil.workflows.rsexecute.execution_support.rsexecute.rsexecute.set_client",
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"rascil.workflows.weight_list_rsexecute_workflow",
"numpy.arange",
"rascil.processing_components.convert_blockvisibility_to_stokesI",
"rascil.data_models.PolarisationFra... | [((105, 119), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (112, 119), True, 'import matplotlib as mpl\n'), ((1018, 1040), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {}), '()\n', (1038, 1040), False, 'import pprint\n'), ((1047, 1058), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1056, 1058),... |
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Email: <EMAIL>
# @Date: 2020-03-30 21:40:57
# @Last Modified by: <NAME>
# @Last Modified time: 2021-06-22 15:18:44
import numpy as np
from PySONIC.core import PointNeuron, NeuronalBilayerSonophore, AcousticDrive, ElectricDrive
from PySONIC.utils import logger, isWithin... | [
"PySONIC.core.NeuronalBilayerSonophore",
"PySONIC.utils.logger.debug",
"numpy.printoptions",
"PySONIC.utils.logger.info",
"PySONIC.utils.isWithin"
] | [((3853, 3886), 'PySONIC.utils.isWithin', 'isWithin', (['"""fs"""', 'value', '(0.0, 1.0)'], {}), "('fs', value, (0.0, 1.0))\n", (3861, 3886), False, 'from PySONIC.utils import logger, isWithin\n'), ((8304, 8343), 'PySONIC.utils.isWithin', 'isWithin', (['"""inter_fs"""', 'value', '(0.0, 1.0)'], {}), "('inter_fs', value,... |
import os
import backbones
import argparse
import pickle
import pandas as pd
import sklearn
from sklearn.metrics import roc_curve, auc
import sys
from tqdm import tqdm
import torch.nn as nn
import mxnet as mx
import numpy as np
import torch
from torch.utils.data import DataLoader, Dataset
from torchvision import transf... | [
"numpy.load",
"mxnet.recordio.MXIndexedRecordIO",
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.sum",
"os.remove",
"torch.cuda.device_count",
"numpy.argsort",
"mxnet.image.imdecode",
"numpy.mean",
"numpy.arange",
"torchvision.transforms.Normalize",
"torch.no_grad",
"os.path.join",... | [((574, 600), 'numpy.random.seed', 'np.random.seed', (['seed_value'], {}), '(seed_value)\n', (588, 600), True, 'import numpy as np\n'), ((616, 645), 'torch.manual_seed', 'torch.manual_seed', (['seed_value'], {}), '(seed_value)\n', (633, 645), False, 'import torch\n'), ((662, 685), 'random.seed', 'random.seed', (['seed_... |
# Copyright (c) 2020. <NAME>, <EMAIL>
import os, torch, time, numpy as np
class Inference_Timer:
def __init__(self, args):
self.args = args
self.est_total = []
self.use_cpu = True if (self.args.gpu == 'None') else False
self.device = 'CPU' if self.use_cpu else 'GPU'
if sel... | [
"torch.cuda.synchronize",
"numpy.mean",
"time.time"
] | [((1053, 1064), 'time.time', 'time.time', ([], {}), '()\n', (1062, 1064), False, 'import os, torch, time, numpy as np\n'), ((1174, 1185), 'time.time', 'time.time', ([], {}), '()\n', (1183, 1185), False, 'import os, torch, time, numpy as np\n'), ((1012, 1036), 'torch.cuda.synchronize', 'torch.cuda.synchronize', ([], {})... |
import json as j
import pandas as pd
import re
import numpy as np
from nltk.corpus import stopwords
from nltk.stem.snowball import FrenchStemmer
from nltk.stem import SnowballStemmer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.svm import LinearSVC
from sklearn.pipeline import Pipel... | [
"pandas.DataFrame",
"json.dump",
"cltk.tokenize.word.WordTokenizer",
"nltk.stem.snowball.FrenchStemmer",
"sklearn.model_selection.train_test_split",
"numpy.asarray",
"sklearn.feature_extraction.text.TfidfVectorizer",
"openpyxl.load_workbook",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.tree.ex... | [((1187, 1210), 'cltk.tokenize.word.WordTokenizer', 'WordTokenizer', (['"""french"""'], {}), "('french')\n", (1200, 1210), False, 'from cltk.tokenize.word import WordTokenizer\n'), ((1217, 1265), 'openpyxl.load_workbook', 'load_workbook', ([], {'filename': '"""classif_questions.xlsx"""'}), "(filename='classif_questions... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import torch, torchvision
import cv2
import os
import random
import wandb
import face_recognition
from tqdm import tqdm
from torch.nn import *
from torch.optim import *
from PIL import Image
os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
torch.manual_se... | [
"torch.manual_seed",
"random.seed",
"numpy.random.seed",
"torchvision.transforms.ToTensor"
] | [((305, 326), 'torch.manual_seed', 'torch.manual_seed', (['(42)'], {}), '(42)\n', (322, 326), False, 'import torch, torchvision\n'), ((327, 345), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (341, 345), True, 'import numpy as np\n'), ((346, 361), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n... |
# Standardized testing interface.
def test():
import os
dir_name = os.path.dirname(os.path.abspath(__file__))
test_name = os.path.basename(dir_name)
fort_file = os.path.join(dir_name, f"test_{test_name}.f03")
build_dir = os.path.join(dir_name, f"fmodpy_{test_name}")
print(f" {test_name}..", end... | [
"os.path.abspath",
"os.path.basename",
"numpy.array",
"os.path.join",
"fmodpy.fimport"
] | [((134, 160), 'os.path.basename', 'os.path.basename', (['dir_name'], {}), '(dir_name)\n', (150, 160), False, 'import os\n'), ((177, 224), 'os.path.join', 'os.path.join', (['dir_name', 'f"""test_{test_name}.f03"""'], {}), "(dir_name, f'test_{test_name}.f03')\n", (189, 224), False, 'import os\n'), ((241, 286), 'os.path.j... |
import os
import numpy as np
import pandas as pd
from scipy import signal as sg
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import ticker
from nltk.stem import PorterStemmer
ps = PorterStemmer()
# constants for parameter normalization
xmax = np.array([ 12.0, 1000.0, 12.0, ... | [
"matplotlib.pyplot.title",
"numpy.abs",
"nltk.stem.PorterStemmer",
"numpy.ones",
"numpy.argsort",
"matplotlib.pyplot.figure",
"numpy.sin",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.tight_layout",
"scipy.signal.sosfreqz",
"numpy.power",
"matplotlib.pyplot.close",
"numpy.max",
"numpy.linsp... | [((224, 239), 'nltk.stem.PorterStemmer', 'PorterStemmer', ([], {}), '()\n', (237, 239), False, 'from nltk.stem import PorterStemmer\n'), ((288, 393), 'numpy.array', 'np.array', (['[12.0, 1000.0, 12.0, 3900.0, 10.0, 12.0, 4700.0, 10.0, 12.0, 10000.0, 10.0,\n 12.0, 20000.0]'], {}), '([12.0, 1000.0, 12.0, 3900.0, 10.0,... |
#! /usr/bin/python3
# coding: utf8
""" Ce module permet de calculer num|é|riquement l'incertitude
d'une fonction par rapport |à| l'incertitude de ces param|è|tres
En th|é|orie |ç|a marche, mais aucune garantie.
(c)<NAME>, 2016. Fa|î|tes-en ce que vous-voulez."""
import numpy as np
from scipy import mi... | [
"numpy.around",
"numpy.log10",
"scipy.misc.derivative"
] | [((592, 612), 'numpy.around', 'np.around', (['n', '(-ordre)'], {}), '(n, -ordre)\n', (601, 612), True, 'import numpy as np\n'), ((407, 418), 'numpy.log10', 'np.log10', (['e'], {}), '(e)\n', (415, 418), True, 'import numpy as np\n'), ((572, 583), 'numpy.log10', 'np.log10', (['e'], {}), '(e)\n', (580, 583), True, 'import... |
# these are some general tools, to be used in multiple parts of mosasaurus
import astropy.io.fits, os, numpy as np
def readFitsData(filename, verbose=False):
'''Read in data from a FITS image (ignoring the header).'''
hdu = astropy.io.fits.open(filename)
if verbose:
print(" read ", filename)
... | [
"numpy.median",
"os.mkdir",
"numpy.abs"
] | [((1026, 1038), 'numpy.median', 'np.median', (['x'], {}), '(x)\n', (1035, 1038), True, 'import astropy.io.fits, os, numpy as np\n'), ((925, 939), 'os.mkdir', 'os.mkdir', (['path'], {}), '(path)\n', (933, 939), False, 'import astropy.io.fits, os, numpy as np\n'), ((1057, 1072), 'numpy.abs', 'np.abs', (['(x - med)'], {})... |
import torchvision
import numpy as np
from torchvision.transforms import ToTensor
from sklearn.cluster import KMeans
cifar10 = torchvision.datasets.CIFAR10('data/', train=True, download=True, transform=ToTensor())
cifar10_np = np.stack([x.numpy() for x, _ in cifar10])
cifar10_np = cifar10_np.transpose((0, 2, 3, 1))
... | [
"sklearn.cluster.KMeans",
"numpy.save",
"torchvision.transforms.ToTensor"
] | [((560, 625), 'numpy.save', 'np.save', (['"""clusters/cifar10_clusters.npy"""', 'kmeans.cluster_centers_'], {}), "('clusters/cifar10_clusters.npy', kmeans.cluster_centers_)\n", (567, 625), True, 'import numpy as np\n'), ((204, 214), 'torchvision.transforms.ToTensor', 'ToTensor', ([], {}), '()\n', (212, 214), False, 'fr... |
import numpy as np
import random
class Game:
def __init__(self, exps=None, stds=None, rounds=100, window=0) -> None:
if exps is None or stds is None:
if exps is None:
print(f'error: argument exps not found!')
if stds is None:
print(f'error: argument ... | [
"random.choice",
"numpy.random.normal"
] | [((992, 1021), 'random.choice', 'random.choice', (['window_indices'], {}), '(window_indices)\n', (1005, 1021), False, 'import random\n'), ((1041, 1095), 'numpy.random.normal', 'np.random.normal', (['self.exps[choice]', 'self.stds[choice]'], {}), '(self.exps[choice], self.stds[choice])\n', (1057, 1095), True, 'import nu... |
import torch
import math
from collections import Counter
import numpy as np
import torch.nn as nn
from tqdm import tqdm
from simplediff import diff
from pytorch_pretrained_bert.optimization import BertAdam
import torch.optim as optim
import sys; sys.path.append('.')
from shared.args import ARGS
from shared.constants i... | [
"sys.path.append",
"torch.ones",
"tqdm.tqdm",
"pytorch_pretrained_bert.optimization.BertAdam",
"torch.nn.CrossEntropyLoss",
"torch.nonzero",
"torch.nn.NLLLoss",
"torch.optim.Adam",
"numpy.array",
"simplediff.diff",
"torch.no_grad",
"torch.min"
] | [((247, 267), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (262, 267), False, 'import sys\n'), ((1397, 1457), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]'], {}), '([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])\n', (1405, 1457), True, 'import numpy as np\... |
# -*- coding: utf8
from __future__ import division, print_function
from scripts.learn_base import create_input_table, hstack_if_possible
import numpy as np
import plac
import sys
@plac.annotations(features_fpath=plac.Annotation('Partial Features',
type=str),... | [
"numpy.savetxt",
"numpy.genfromtxt",
"plac.call",
"scripts.learn_base.create_input_table",
"numpy.column_stack",
"plac.Annotation"
] | [((721, 782), 'scripts.learn_base.create_input_table', 'create_input_table', (['features_fpath', 'None', 'tag_categ_fpath', '(-1)'], {}), '(features_fpath, None, tag_categ_fpath, -1)\n', (739, 782), False, 'from scripts.learn_base import create_input_table, hstack_if_possible\n'), ((798, 825), 'numpy.genfromtxt', 'np.g... |
from keras.layers import Input
from yolo import YOLO
from PIL import Image
import numpy as np
import cv2
import time
yolo_net = YOLO()
capture_frame=cv2.VideoCapture(0)
frames_per_second = 0.0
while(True):
time1 = time.time()
ref, frame = capture_frame.read()
frame = cv2.cvtColor(frame,cv2.COLOR_BGR2RGB)
... | [
"numpy.uint8",
"cv2.putText",
"cv2.cvtColor",
"cv2.waitKey",
"numpy.asarray",
"time.time",
"cv2.VideoCapture",
"cv2.imshow",
"yolo.YOLO"
] | [((128, 134), 'yolo.YOLO', 'YOLO', ([], {}), '()\n', (132, 134), False, 'from yolo import YOLO\n'), ((150, 169), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (166, 169), False, 'import cv2\n'), ((220, 231), 'time.time', 'time.time', ([], {}), '()\n', (229, 231), False, 'import time\n'), ((282, 320), ... |
import anndata as ad
import logging
import numpy as np
import os
import time
import pandas as pd
import yaml
from pathlib import Path
from collections import namedtuple
from const import PATH, OUT_PATH
#logging.basicConfig(level=logging.INFO)
try:
import git
except:
pass
def get_tasks(phase):
assert phase... | [
"pandas.DataFrame",
"anndata.read_h5ad",
"numpy.multiply",
"numpy.abs",
"os.path.exists",
"git.Repo",
"time.time",
"logging.info",
"pathlib.Path",
"numpy.mean",
"numpy.array",
"yaml.safe_load",
"logging.critical",
"pandas.concat"
] | [((2669, 2706), 'logging.info', 'logging.info', (['"""Reading solution file"""'], {}), "('Reading solution file')\n", (2681, 2706), False, 'import logging\n'), ((2720, 2736), 'anndata.read_h5ad', 'ad.read_h5ad', (['gt'], {}), '(gt)\n', (2732, 2736), True, 'import anndata as ad\n'), ((2746, 2785), 'logging.info', 'loggi... |
import numpy as np
import numpy.random as npr
from sds import Ensemble
if __name__ == "__main__":
from hips.plotting.colormaps import gradient_cmap
import seaborn as sns
sns.set_style("white")
sns.set_context("talk")
color_names = ["windows blue", "red", "amber",
"faded gree... | [
"seaborn.set_style",
"numpy.random.seed",
"scipy.signal.filtfilt",
"torch.manual_seed",
"seaborn.xkcd_palette",
"numpy.zeros",
"numpy.ones",
"sds.Ensemble",
"numpy.hstack",
"hips.plotting.colormaps.gradient_cmap",
"random.seed",
"torch.set_num_threads",
"sklearn.decomposition.PCA",
"seabor... | [((187, 209), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (200, 209), True, 'import seaborn as sns\n'), ((214, 237), 'seaborn.set_context', 'sns.set_context', (['"""talk"""'], {}), "('talk')\n", (229, 237), True, 'import seaborn as sns\n'), ((560, 589), 'seaborn.xkcd_palette', 'sns.xkcd_... |
r"""Analyze Traffic Images
This executable is used to annotate traffic images to highlight vehicle types and to produce stats
and graphs for the amount of time bicycle lanes and bus stops are blocked by vehicles:
Example usage:
./analyzeimages \
-path_images /tmp/preprocessed
-path_labels_map dat... | [
"sys.path.append",
"argparse.ArgumentParser",
"random.randint",
"tensorflow.device",
"object_detection.utils.label_map_util.create_category_index",
"object_detection.utils.label_map_util.convert_label_map_to_categories",
"tensorflow.Session",
"numpy.expand_dims",
"PIL.Image.open",
"PIL.Image.froma... | [((613, 657), 'sys.path.append', 'sys.path.append', (['"""./models-master/research/"""'], {}), "('./models-master/research/')\n", (628, 657), False, 'import sys\n'), ((8604, 8770), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Analyze traffic images to determine rate of blocking bike an... |
import numpy as np
import gym
from gym.spaces import Box, MultiDiscrete, Tuple
from gym import error, spaces, utils
from ..example_problems.doubleintegrator import DoubleIntegratorVisualizer
from ..spaces.controlspace import vectorops
from ..visualizer import runVisualizer, PlanVisualizationProgram
from OpenGL.GL imp... | [
"gym.spaces.MultiDiscrete",
"numpy.array",
"numpy.sqrt"
] | [((2113, 2140), 'numpy.array', 'np.array', (['[1.0, -1.0, -1.0]'], {}), '([1.0, -1.0, -1.0])\n', (2121, 2140), True, 'import numpy as np\n'), ((2142, 2168), 'numpy.array', 'np.array', (['[10.0, 1.0, 1.0]'], {}), '([10.0, 1.0, 1.0])\n', (2150, 2168), True, 'import numpy as np\n'), ((2724, 2814), 'numpy.sqrt', 'np.sqrt',... |
"""
Fish Growth model and parameters
Author: <NAME> | <EMAIL> | <EMAIL>
"""
import numpy as np
import pandas as pd
import time
#%% List of Input parameter of the ODE
# Feeding level
Fmin=0.01;
Fmax=1;
# Feed_Q=rand_vec(N,0, 1); # feeding qunatity
# Water temperature
Tmin= 27.64;
Tmax=... | [
"pandas.read_csv",
"numpy.random.uniform",
"numpy.diff",
"numpy.mean"
] | [((2123, 2144), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (2134, 2144), True, 'import pandas as pd\n'), ((1863, 1909), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': 'Tmin', 'high': 'Tmax', 'size': 'N'}), '(low=Tmin, high=Tmax, size=N)\n', (1880, 1909), True, 'import numpy as np\n... |
"""Probabiltity density functions supported over the surface of the earth. Coordinates are output as (lat, lon) tuples (EPSG:4326)"""
import numpy as np
from shapely.geometry import Point
class UniformSpherePDF:
"""A PDF that uniformly samples over a sphere."""
def __call__(self, n=1):
lon = np.random... | [
"numpy.random.uniform",
"shapely.geometry.Point",
"numpy.array",
"numpy.concatenate"
] | [((311, 347), 'numpy.random.uniform', 'np.random.uniform', (['(-180)', '(180)', '(n, 1)'], {}), '(-180, 180, (n, 1))\n', (328, 347), True, 'import numpy as np\n'), ((466, 495), 'numpy.concatenate', 'np.concatenate', (['[lat, lon]', '(1)'], {}), '([lat, lon], 1)\n', (480, 495), True, 'import numpy as np\n'), ((1180, 119... |
import numpy as np
from sklearn import preprocessing
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import classification_report, accuracy_score
import matplotlib.pyplot as plt
from mlxtend.plotting import plot_decision_regions
d... | [
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.scatter",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"numpy.loadtxt"
] | [((326, 366), 'numpy.loadtxt', 'np.loadtxt', (['"""spiral3.csv"""'], {'delimiter': '""","""'}), "('spiral3.csv', delimiter=',')\n", (336, 366), True, 'import numpy as np\n'), ((391, 445), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data'], {'test_size': '(0.25)', 'random_state': '(0)'}), '(data, ... |
import warnings
warnings.filterwarnings('ignore')
import time
import pandas as pd
import numpy as np
EPSILON = 0.6 # greedy
ALPHA = 0.1
GAMMA = 0.3
ACTIONS = ['left', 'right']
N_STATES = 8
FRESH_TIME = 0.3
MAX_EPISODES = 13
class RL:
def __init__(self, action_space, learning_rate=0.1, reward_decay=0.9, e_gree... | [
"pandas.DataFrame",
"warnings.filterwarnings",
"time.sleep",
"numpy.random.permutation",
"numpy.random.choice",
"numpy.random.rand"
] | [((17, 50), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (40, 50), False, 'import warnings\n'), ((486, 538), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'self.actions', 'dtype': 'np.float64'}), '(columns=self.actions, dtype=np.float64)\n', (498, 538), True, 'imp... |
#!/usr/bin/env python
import argparse
import json
import os
import sys
from pathlib import Path
import numpy as np
GOLDEN_ROOT = Path('ci/golden')
DEFAULT_BUILD_URL = 'https://buildkite.com/plaidml'
DEFAULT_PERF_THRESHOLD = 0.7
class RawResult:
def __init__(self, path):
self.path = path
data =... | [
"json.dump",
"numpy.absolute",
"numpy.load",
"traceback.print_exc",
"argparse.ArgumentParser",
"json.load",
"numpy.allclose",
"numpy.nditer",
"numpy.amax",
"pathlib.Path",
"os.getenv",
"sys.exit"
] | [((131, 148), 'pathlib.Path', 'Path', (['"""ci/golden"""'], {}), "('ci/golden')\n", (135, 148), False, 'from pathlib import Path\n'), ((7166, 7191), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (7189, 7191), False, 'import argparse\n'), ((7737, 7769), 'os.getenv', 'os.getenv', (['"""BUILDKITE... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2020 <NAME>
#
# 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 lim... | [
"numpy.size",
"numpy.zeros_like",
"numpy.sum",
"numpy.outer",
"numpy.array_str",
"os.path.dirname",
"numpy.zeros",
"numpy.genfromtxt",
"numpy.where",
"numpy.array",
"tabulate.tabulate",
"numpy.interp",
"warnings.warn"
] | [((8582, 8678), 'numpy.interp', 'np.interp', (['energy', 'self.atomic_form_factor_coeff[:, 0]', 'self.atomic_form_factor_coeff[:, 1]'], {}), '(energy, self.atomic_form_factor_coeff[:, 0], self.\n atomic_form_factor_coeff[:, 1])\n', (8591, 8678), True, 'import numpy as np\n'), ((8710, 8806), 'numpy.interp', 'np.inter... |
import numpy as np
import pandas as pd
import pkg_resources
import seaborn as sns
from crispy import logger as LOG
import matplotlib.pyplot as plt
from dualguide import read_gi_library
from crispy.CrispyPlot import CrispyPlot
from crispy.LibRepresentationReport import LibraryRepresentaion
DPATH = pkg_resources.resourc... | [
"dualguide.read_gi_library",
"matplotlib.pyplot.axvline",
"crispy.LibRepresentationReport.LibraryRepresentaion",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"seaborn.barplot",
"pkg_resources.resource_filename",
"pandas.read_excel",
"crispy.logger.info",
"matplotlib.pyplot.figure",
"nu... | [((299, 352), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""data"""', '"""dualguide/"""'], {}), "('data', 'dualguide/')\n", (330, 352), False, 'import pkg_resources\n'), ((361, 427), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""notebooks"""', '"""dualguide/re... |
from __future__ import print_function, division
import matplotlib.pyplot as plt
plt.interactive(False)
import tensorflow as tf
import h5py
from scipy.stats import pearsonr
from keras.models import Sequential
from keras.layers import Convolution2D
from keras.layers import Dense, Dropout, Flatten
from keras.layers.advanc... | [
"keras.regularizers.l2",
"keras.initializers.he_uniform",
"numpy.divide",
"numpy.random.uniform",
"keras.optimizers.SGD",
"keras.layers.Convolution2D",
"scipy.io.loadmat",
"matplotlib.pyplot.interactive",
"keras.layers.Dropout",
"numpy.asarray",
"keras.layers.Flatten",
"numpy.zeros",
"numpy.... | [((80, 102), 'matplotlib.pyplot.interactive', 'plt.interactive', (['(False)'], {}), '(False)\n', (95, 102), True, 'import matplotlib.pyplot as plt\n'), ((600, 622), 'keras.regularizers.l2', 'regularizers.l2', (['decay'], {}), '(decay)\n', (615, 622), False, 'from keras import optimizers, callbacks, regularizers, initia... |
import cv2
import numpy as np
from openVO.utils.rot2RPY import rot2RPY
def drawPoseOnImage(T, img):
roll, pitch, yaw = rot2RPY(T)
# pick RPY representation with smaller magnitude rotations
rep1, rep2 = [np.linalg.norm([roll[i], pitch[i], yaw[i]]) for i in [0, 1]]
if rep1 > rep2:
r = roll[1]
... | [
"openVO.utils.rot2RPY.rot2RPY",
"numpy.round",
"cv2.putText",
"numpy.linalg.norm"
] | [((124, 134), 'openVO.utils.rot2RPY.rot2RPY', 'rot2RPY', (['T'], {}), '(T)\n', (131, 134), False, 'from openVO.utils.rot2RPY import rot2RPY\n'), ((1002, 1151), 'cv2.putText', 'cv2.putText', (['img'], {'text': 'pose_text1', 'org': '(0, image_height - 180)', 'fontFace': 'cv2.FONT_HERSHEY_SIMPLEX', 'fontScale': '(2.0)', '... |
import cv2
import os
import glob
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
#plt.ion()
class PerspectiveTransform:
def __init__(self, image, image_name):
self.image_name = image_name
self.image = image
self.warped_image = 0
self.output_image... | [
"matplotlib.image.imread",
"cv2.warpPerspective",
"os.makedirs",
"matplotlib.pyplot.plot",
"cv2.getPerspectiveTransform",
"matplotlib.pyplot.imshow",
"numpy.float32",
"os.path.exists",
"glob.glob"
] | [((2739, 2813), 'matplotlib.image.imread', 'mpimg.imread', (['"""output_images\\\\undistored_test_images\\\\straight_lines1.jpg"""'], {}), "('output_images\\\\undistored_test_images\\\\straight_lines1.jpg')\n", (2751, 2813), True, 'import matplotlib.image as mpimg\n'), ((2818, 2833), 'matplotlib.pyplot.imshow', 'plt.im... |
# Imports
import tensorflow as tf
from plotting import *
from neural_network import *
import numpy as np
import os
# Path and Dataset
dir_path = os.path.dirname(os.path.realpath(__file__))
# Variables
hidden_layer_1_nodes = 500
hidden_layer_2_nodes = 500
output_layer_nodes = 500
# Graph reset
loaded_graph = tf.Grap... | [
"tensorflow.nn.relu",
"random.randint",
"tensorflow.train.Saver",
"tensorflow.train.import_meta_graph",
"tensorflow.argmax",
"os.path.realpath",
"tensorflow.Session",
"tensorflow.placeholder",
"tensorflow.matmul",
"numpy.reshape",
"tensorflow.Graph",
"tensorflow.examples.tutorials.mnist.input_... | [((313, 323), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (321, 323), True, 'import tensorflow as tf\n'), ((163, 189), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (179, 189), False, 'import os\n'), ((388, 436), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[None, 78... |
"""
Sparse Blocks Network
Copyright (c) 2017, Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless re... | [
"sparse_conv_lib.sparse_conv2d",
"sparse_conv_lib.calc_block_params",
"sparse_conv_lib.cuda_timer_end_op",
"sparse_conv_lib.sparse_res_block_bottleneck",
"sparse_conv_lib.sparse_conv2d_custom",
"tensorflow.Variable",
"tensorflow.nn.conv2d",
"sparse_conv_lib.convert_mask_to_block_indices",
"tensorflo... | [((2053, 2163), 'collections.namedtuple', 'namedtuple', (['"""TestConfig"""', "['xsize', 'ksize', 'bsize', 'strides', 'padding', 'is_sparse', 'tol', 'avgpool'\n ]"], {}), "('TestConfig', ['xsize', 'ksize', 'bsize', 'strides', 'padding',\n 'is_sparse', 'tol', 'avgpool'])\n", (2063, 2163), False, 'from collections ... |
"""PyTorch implementation of center/carrier frequency offset.
"""
__author__ = "<NAME> <<EMAIL>>"
# PyTorch Includes
import torch
import torch.nn as nn
# External Includes
import numpy as np
class CFO(nn.Module):
"""Center Frequency Offset Channel model implemented in PyTorch.
A center frequency offset rec... | [
"torch.cos",
"torch.cat",
"numpy.abs",
"torch.sin"
] | [((2842, 2854), 'torch.cos', 'torch.cos', (['t'], {}), '(t)\n', (2851, 2854), False, 'import torch\n'), ((2869, 2881), 'torch.sin', 'torch.sin', (['t'], {}), '(t)\n', (2878, 2881), False, 'import torch\n'), ((3021, 3050), 'torch.cat', 'torch.cat', (['(r, c)'], {'dim': 'iq_dim'}), '((r, c), dim=iq_dim)\n', (3030, 3050),... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.