text
stringlengths
3.07k
22.1k
"""! @brief Attentive SuDO-RM-RF model @author <NAME> {<EMAIL>} @copyright University of Illinois at Urbana-Champaign """ import torch import torch.nn as nn import math class _LayerNorm(nn.Module): """Layer Normalization base class.""" def __init__(self, channel_size): super(_LayerNorm, self).__ini...
#!/usr/bin/env python3 """ Reconciliation functionality live here. """ import asyncio from typing import Dict, List from httpx import ConnectError from lm_agent.backend_utils import ( backend_client, get_bookings_from_backend, get_config_from_backend, get_config_id_from_backend, ) from lm_agent.except...
#!/usr/bin/env python3 import requests import argparse import sys import os import re import time import socket import threading from colors import * import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) #psmall = ["80", "81", "443", "591", "2082", "2087", "2095", "2096", "3000", "8000"...
from __future__ import division from __future__ import print_function import argparse import os import sys import time import chainer import matplotlib.pyplot as plt import matplotlib.ticker as tick import numpy as np from PIL import Image import six sys.path.append('..') from lib import iproc # NOQA from lib import...
import pandas as pd from PIL import Image import numpy as np import keras from math import floor import random from random import shuffle from sklearn.model_selection import train_test_split from keras import regularizers from keras.callbacks import ModelCheckpoint from keras.models import Sequential from keras.mode...
""" Contains potential usage examples of the library. """ import os import sys import json import requests import krdict try: # try to load environment variables from .env file from dotenv import load_dotenv load_dotenv() except ImportError: pass krdict.set_key(os.getenv('KRDICT_KEY')) def _display...
import os from datetime import datetime, timedelta, timezone import tempfile from django.db import transaction import boto3 import pytz from google.transit import gtfs_realtime_pb2 from busshaming.models import Trip, TripDate, TripStop, RealtimeEntry, Route, Stop from busshaming.enums import ScheduleRelationship S3...
import datetime import json from itertools import groupby from pprint import pprint from .shared import financial_statement_iterator, partition_consolidated from sqlalchemy import Table, Column, ForeignKey, MetaData from sqlalchemy import DateTime, String, Text from sqlalchemy import Sequence, UniqueConstraint from ...
from __future__ import print_function import argparse import torch.backends.cudnn as cudnn import torch.nn.functional as F import torch.optim as optim import torch.utils.data.distributed import byteps.torch as bps import timeit import numpy as np import os, sys from torch.profiler import profile, ProfilerActivity from...
from __future__ import print_function, division, absolute_import import json from collections import OrderedDict from functools import partial from os.path import basename from future import standard_library from littleutils import DecentJSONEncoder, withattrs, group_by_attr standard_library.install_aliases() impor...
""" Define an abstract solver and a greedy, a random, a simulated annealing solvers considering an uncertainty grid. """ import numpy as np import copy import operator import random import math from sys import path from simanneal import Annealer import matplotlib.pyplot as plt from matplotlib import colors from matplo...
""" size tupes are always (height, width) so that image.shape == (height, width, :) coordinates are always (row, column) so that `image[row, column]` where `0 < row < height` """ import warnings import time from skimage import img_as_float, io, transform # Plotting import matplotlib.pyplot as plt from mpl_toolkits.m...
import cv2 import numpy as np from matplotlib import pyplot as plt # https://docs.google.com/document/d/111AoZXtdh8aA2yi4HzprencKoS-pNsMQ4IZL3wqHZtw/edit?usp=sharing # 0. CV_CAP_PROP_POS_MSEC Current position of the video file in milliseconds. # 1. CV_CAP_PROP_POS_FRAMES 0-based index of the frame to be decoded/cap...
# -*- coding: utf-8 -*- import copy from django.core.exceptions import ImproperlyConfigured from django.db.models.base import ModelBase from django.db import models from django.utils import six from django.utils.functional import LazyObject, empty from polymorphic.models import PolymorphicModelBase from shop.conf impo...
import asyncio import logging import socket import time __version__ = "1.1.6" from .data import LIP_PROTOCOL_MODE_TO_LIPMODE, LIPMessage, LIPMode from .exceptions import LIPConnectionStateError, LIPProtocolError from .protocol import ( CONNECT_TIMEOUT, LIP_ACTION_CHAR, LIP_EMPTY_RE, LIP_ERROR_RE, ...
from __future__ import division import math import six import theano import theano.tensor as T import numpy as np import progressbar from neupy.core.config import Configurable from neupy.core.properties import Property, BoundedProperty from neupy.utils import as_tuple from neupy.algorithms.constructor import Constru...
#!/usr/bin/env python3 # noinspection PyPackageRequirements import re import netaddr import pan.xapi import yaml class Config: def __init__(self, filename): with open(filename, 'r') as stream: config = yaml.safe_load(stream) self.top_domain = config['top_domain'] self.firewa...
import os import re import time from itertools import chain from errbot import BotPlugin, re_botcmd from errbot.core import ErrBot from slack_sdk.errors import SlackApiError import config_template from lib import ApproveHelper, create_sdm_service, MSTeamsPlatform, PollerHelper, \ ShowResourcesHelper, ShowRolesHelp...
# (c) 2018, NetApp, Inc # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ''' unit tests ONTAP Ansible module: na_ontap_cifs_server ''' from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json import pytest from ansible_collections...
import ast import glob import xnet import numpy as np import matplotlib.pyplot as plt from igraph import * from textwrap import wrap from sklearn.cluster import KMeans from util import get_attr_pacs, get_pac_list from sklearn.cluster import AgglomerativeClustering from sklearn.feature_extraction.text import CountVecto...
# -*- coding: utf-8 -*- import httplib import logging from django.db import transaction, connection from django_bulk_update.helper import bulk_update from django.contrib.contenttypes.models import ContentType from framework.auth import get_or_create_user from framework.exceptions import HTTPError from framework.flas...
#------------------------------------------------------------------------------- # Name: rwfile.py # Purpose: テキストファイル入出力モジュール # # Author: shikano.takeki # # Created: 08/12/2017 # Copyright: (c) shikano.takeki 2017 # Licence: <your licence> #----------------------------------------------------...
''' This file include some functions for STED distance computation ''' import numpy as np import pickle import math import time import openmesh as om with open('edgelist.pkl', 'rb') as f: edge_list = pickle.load(f) with open('velist.pkl', 'rb') as f: vertex_edge_list = pickle.load(f) def sted_compute(src_point_arra...
import os.path import logging import typing from d3m import container, utils from d3m.container import DataFrame as d3m_DataFrame from d3m.metadata import hyperparams, params, base as metadata_base from d3m.exceptions import PrimitiveNotFittedError from d3m.primitive_interfaces.base import CallResult from d3m.primitiv...
""" GUI for Morse Code Trainer """ import threading import gettext import datetime import time import wx import wx.grid from morsecodetrainer.trainer import Trainer from morsecodetrainer import config from morsecodelib.config import config as morseConfig myEVT_NEWWORD = wx.NewEventType() EVT_NEWWORD = wx.PyEventBin...
from django.shortcuts import render, get_object_or_404, redirect from django.http import HttpResponse, Http404 from django.template import TemplateDoesNotExist from django.template.loader import get_template from django.contrib.auth.views import LoginView, LogoutView, PasswordChangeView from django.contrib.auth.de...
from __future__ import absolute_import, division, print_function import itertools import math import pytest import torch from torch.autograd import Variable import pyro import pyro.distributions as dist import pyro.optim from pyro.infer import SVI from pyro.infer.enum import iter_discrete_traces from pyro.infer.trac...
from __future__ import print_function, division from hscom import __common__ (print, print_, print_on, print_off, rrr, profile, printDBG) = __common__.init(__name__, '[encounter]', DEBUG=False) # Python from itertools import izip # Science import networkx as netx import numpy as np from scipy.cluster.hierarchy import ...
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import print_function import os import re from astropy.table import Table from astropy.tests.helper import pytest import astropy.coordinates as coord import astropy.units as u from ...utils.testing_tools import MockResponse from ... imp...
import os import argparse import requests import cv2 import numpy as np import tldextract import pytube import hashlib import tldextract import pytube import time import base64 from PIL import Image from flask import Flask, request, render_template, redirect, make_response, jsonify from pathlib import Path from werkze...
# Copyright (c) 2021 elParaguayo # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distrib...
import ast import hashlib import hmac import os import re import six import time from base64 import b64decode, b64encode from binascii import hexlify from six.moves.urllib import parse as urlparse from enum import Enum # ujson is not installable with pypy try: # pragma: no cover import ujson as json # NOQA ...
# GPLv3 License # # Copyright (C) 2020 Ubisoft # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This program is dis...
# -*- coding: utf-8 -*- """ TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the Lic...
# flake8: noqa # @TODO: code formatting issue for 20.07 release from typing import Any, Dict, List, Optional, Tuple import configparser import logging import os from catalyst.tools.frozen_class import FrozenClass logger = logging.getLogger(__name__) class Settings(FrozenClass): def __init__( self, ...
from colorfield.fields import ColorField from multiselectfield import MultiSelectField from django.conf import settings from django.contrib.gis.db import models from django.db.models import Q from django.utils.html import escape from django.utils.translation import gettext_lazy as _ from geotrek.authent.models import S...
# -*- coding: utf-8 -*- """ The MIT License (MIT) Copyright (c) 2015-2019 Rapptz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to u...
# -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import import logging import numpy as np import tensorflow as tf from tensorflow.python.ops import array_ops from tensorflow.python.ops.rnn import dynamic_rnn as _drnn, _rnn_step as _rnn_step, bidirectional_dynamic_rnn as _brnn, _infer_s...
# _*_coding: utf-8_*_ import datetime import json import os import sys from train import * import argparse def make_html_safe(s): s = s.replace("<", "&lt;") s = s.replace(">", "&gt;") return s def write_for_rouge(reference_sents, decoded_words, ex_index, _rouge_ref_dir, _rouge_dec_dir): decoded_se...
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP. from flask import current_app, Blueprint, json, request afc = Blueprint('afc', __name__) from datetime import datetime from flask import render_template import uuid import classes.classes as classes @afc.route("/afcfabrics", methods=['GET','POST']) de...
# -*- coding:utf-8 -*- # !/usr/bin/env python import argparse import json, os import matplotlib.pyplot as plt import skimage.io as io # import cv2, random import random from labelme import utils import numpy as np import glob from tqdm import tqdm import PIL.Image class MyEncoder(json.JSONEncoder): def default(s...
#!/usr/bin/env python2 # -*- coding: utf8 -*- from __future__ import print_function import os from collections import Counter import numpy as np import matplotlib.pyplot as plt try: from scipy.misc import imsave except: from imageio import imsave from PIL import Image from scipy import ndimage import cv2 from ...
# -*- coding: utf-8 -*- """ Project: Psychophysics_exps Creator: Miao Create time: 2021-02-01 15:03 IDE: PyCharm Introduction: exp1 ms Calculate partial corr between deviation score and number of discs' into others crowding zones. Plot the parr corr results Plot partical corrs against increasing ellipse sizes - invert...
# As this program takes a while to load - print a warning to the user print("Please be patient while the program loads......") # Section 1 - Import the required libraries for the project import time import numpy as np import pandas as pd import matplotlib.pyplot as plt # Section 2 - Define the 5 Sorting Algo...
import numpy as np from scipy.special import gammaln, psi # TODO: define distribution base class class Discrete(object): def __init__(self, p=0.5*np.ones(2)): assert np.all(p >= 0) and p.ndim == 1 and np.allclose(p.sum(), 1.0), \ "p must be a probability vector that sums to 1.0" self.p...
""" Interfaces with ``keyboard`` to provide mid-level input emulation routines """ import multiprocessing import time import keyboard import mouse # Python 3 compatibility try: basestring except NameError: basestring = str class Mouse(object): """ Mid-level mouse routines. """ def __init__(self): ...
#!/usr/bin/env python # Filename: rasterize_polygons """ introduction: rasterize polgyons into raster using rasterio difference from get_sub_label in "get_subImages.py", this script rasterizes the entire scene, not only the surrounding of a polygon A similar scrip is ../../DeeplabforRS/prepare_raster.py with gdal_r...
""" Arcade program that uses the classes in universe.py Inspired by the One Lone Coder's video on Procedurally Generated Universes """ # Imports import arcade from copy import deepcopy from universe import StarSystem from constants import SCREEN_HEIGHT, SCREEN_WIDTH # Constants SECTOR_SIZE = 50 SECTORS_X = SCREEN_WID...
""" Utility functions for the benchmarks ========================================== """ import importlib import os import time import matplotlib as mpl from matplotlib import pyplot as plt from si_prefix import si_format import numpy as np import torch import jax use_cuda = torch.cuda.is_available() #############...
import praw import datetime import re from collections import OrderedDict from WriteDatabase import write_databases # TODO: Keep refactoring. Use more descriptive variable names # Function which completely rebuilds the database def build_database(reddit, youtube): sub_dates = get_sub_threads(reddit) res_dates...
import torch import numpy as np from torch import Tensor _MEL_BREAK_FREQUENCY_HERTZ = 700.0 _MEL_HIGH_FREQUENCY_Q = 1127.0 def mel_to_hertz(mel_values): """Converts frequencies in `mel_values` from the mel scale to linear scale.""" return _MEL_BREAK_FREQUENCY_HERTZ * ( np.exp(np.array(mel_values) / _MEL_HI...
import typing import urllib.parse import requests import bs4 import princeton_scraper_seas_faculty.campus_directory import princeton_scraper_seas_faculty.constants import princeton_scraper_seas_faculty.helpers __author__ = "<NAME> <<EMAIL>>" __all__ = [ "SeasFacultyInformation", "fetch_seas_faculty_direct...
# Haybaler # <NAME>, Nov 2020 - April 2021 # Combine your Wochenende .bam.txt or reporting output from multiple samples into one matrix per stat. # Usage: bash run_haybaler.sh import pandas as pd import click import os import re version = "0.30 - April 2021" # changelog # 0.30 read all samples in one call. Filter...
from os import environ from flask import Flask, g, request, abort, jsonify, url_for, make_response from werkzeug.exceptions import HTTPException from uservice.core.users import User, auth, db from uservice.views.basic_views import ( ListProjects, CountJobs, FetchNextJob, BasicView, FetchJobPrio, AnalyzeFailed...
import json import math import os import shutil import torch from . import Callback __all__ = ['ModelCheckpoint'] class ModelCheckpoint(Callback): """ Model Checkpoint to save model weights during training. 'Best' is determined by minimizing (or maximizing) the value found under monitored_log_key in the l...
import time import json import config import logging import log import logging.config import services import sys from service_ha import ServiceHa from service_ovpn import ServiceOvpn import socket import ipaddress import hashlib import base64 import re import dns.resolver def timefmt(tme): return(time.strftime("%Y...
#!/usr/bin/env python3 import argparse import json import uuid import re import os import subprocess NAMESPACE = uuid.UUID('c6591d1d-27bc-4c94-bd54-1b51f8a2456c') def get_uuid5(value_to_hash): return str(uuid.uuid5(NAMESPACE, value_to_hash)) def get_analysis_workflow_id(analysis_output_path): """Parse the...
from datetime import datetime, timedelta from pdb import set_trace from django.test import TestCase from django.db import models from django.dispatch import Signal from django.contrib.auth.models import User from django.core.urlresolvers import reverse, NoReverseMatch from django.template import Context from django.te...
""" 主要包括去燥, 计算特征信号等 """ from preprocessOfApneaECG.fileIO import get_database from preprocessOfApneaECG.denoising import denoise_ecg from preprocessOfApneaECG.list2mat import list2mat import os import numpy as np import matlab.engine import scipy.io as sio from scipy import interpolate from preprocessOfApneaECG.mit2Seg...
"""Platform for Miele integration.""" from __future__ import annotations import logging from dataclasses import dataclass from typing import Any, Callable, Final from homeassistant.components.climate import ( ClimateEntity, ClimateEntityDescription, ClimateEntityFeature, ) from homeassistant.components.cl...
# Copyright 2017 Canonical Ltd. # Licensed under the LGPLv3, see LICENCE file for details. from collections import namedtuple from threading import Lock from ._authorizer import ClosedAuthorizer from ._identity import NoIdentities from ._error import ( AuthInitError, VerificationError, IdentityError, D...
"""Tests for metabolomics.py using pytest.""" from pathlib import Path import pymongo import pytest from pymongo.errors import ServerSelectionTimeoutError from minedatabase.metabolomics import ( MetabolomicsDataset, Peak, dot_product, jaccard, read_mgf, read_msp, read_mzxml, spectra_d...
#!/usr/bin/python '''Get details about installed methods <NAME> 3/15/2020 ''' import configparser from os.path import expanduser, join, isfile, isdir from os import mkdir import time try: import importlib.resources as pkg_resources except ImportError: # Try backported to PY<37 `importlib_resources`. impo...
"""Main Controller""" import tg from tg import expose, redirect, config, validate, override_template, response, render_template, tmpl_context from tg import cache, i18n, request from tg.decorators import paginate, use_custom_format, with_trailing_slash, Decoration, before_render from tg.controllers import TGController ...
import bpy from bpy_extras.io_utils import ExportHelper, ImportHelper import math from . import data from . import calc from . import create from . import delete from . import io from . import update from . test_camera_generator import test_main from typing import Any, List, Dict, Tuple # ---------------------------...
import re import MeCab TAGGER = None def get_word_and_tags_list(raw): global TAGGER if TAGGER is None: TAGGER = MeCab.Tagger() postags = list() for item in TAGGER.parse(raw).rstrip().split('\n')[:-1]: sp1 = item.split('\t') word = sp1[0] info = sp1[1].split(',') ...
#!/usr/bin/env python3 import argparse import requests import urllib3 import sys import json import re import time # The purpose of this script is to facilitate backup/restore of settings in RP4VMs # The script exclusively uses the new RESTful API in RP4VMs 5.3 # Author(s) - <NAME> <<EMAIL>> # Version 1 ...
import re import numpy as np from utensor_cgen.backend.utensor.snippets._base import Snippet, SnippetBase from utensor_cgen.backend.utensor.snippets._types import (NP_TYPES_MAP, UTENSOR_TYPES_MAP) __all__ = [ "OpConstructSnippet", "DeclareRomTensorSnippet...
#!/usr/bin/env python import os import sys import time import argparse import logging from dae.gpf_instance.gpf_instance import GPFInstance from dae.backends.impala.import_commons import ( construct_import_annotation_pipeline, save_study_config, ) from dae.backends.dae.loader import DenovoLoader, DaeTransmi...
import os import pytest import numpy as np from datetime import datetime import ezomero from ezomero import rois from omero.cli import CLI from omero.gateway import BlitzGateway from omero.gateway import ScreenWrapper, PlateWrapper from omero.model import ScreenI, PlateI, WellI, WellSampleI, ImageI from omero.model imp...
# coding:utf-8 # fork from https://github.com/adilmoujahid/deeplearning-cats-dogs-tutorial # alse ref: https://www.cnblogs.com/zhonghuasong/p/7469750.html # to python 3.6 # ----------------------------------- # 2018-2-28 test result: # Too many images, instance was killed due to low memroy. # need to divide the im...
import filecmp import os import pathlib import shutil import yaml import numpy as np import mc2client as mc2 import pytest from envyaml import EnvYAML # Note: to run this test, you'll need to start a gRPC orchestrator and an enclave running Secure XGBoost # Follow the demo here to do so: https://secure-xgboost.readt...
# -*- coding: utf-8 -*- """ pyvisa.resources.resource ~~~~~~~~~~~~~~~~~~~~~~~~~ High level wrapper for a Resource. This file is part of PyVISA. :copyright: 2014 by PyVISA Authors, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ from __future__ import division, ...
# -*- coding: utf-8 -*- # @Time 2021/8/19 14:19 import cv2 from PIL import Image import numpy from . import ImageCommonProcess # code from:https://blog.csdn.net/weixin_42194239/article/details/91975662 # erode process def erode_img(img, kernel_args=(2, 2), iterations=1): kernel = numpy.ones(kernel_args, numpy.ui...
# Copyright (c) OpenMMLab. All rights reserved. from copy import deepcopy from typing import Sequence import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import build_norm_layer from mmcv.cnn.bricks.transformer import FFN from mmcv.runner.base_module import BaseModule, M...
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © Her Majesty the Queen in Right of Canada, as represented # by the Minister of Statistics Canada, 2019. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # ...
###################################################################################################################### # Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # ...
import torch from fline.models.models.research.connected_components import ConnectedComponents class SelfAttention(torch.nn.Module): """ Self attention Layer""" def __init__(self, in_dim): super(SelfAttention, self).__init__() self.chanel_in = in_dim self.query_conv = torch.nn.Conv2...
import random import datetime import glog as log import json from multivitamin.data.response import config # from multivitamin.data.response.dtypes import Point def read_json(file_path): """Convenience method for reading jsons""" return json.load(open(file_path)) def write_json(json_str, file_path, indent...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ Dynamic Variabes a.k.a. dependencies and dynamic objects garbage collection. """ from __future__ import print_function import time import threading import sys import json import multiprocessing from multiprocessing.dummy import Pool as Thread...
""" Bayesian Block implementation ============================= Dynamic programming algorithm for finding the optimal adaptive-width histogram. Based on Scargle et al 2012 [1]_ References ---------- .. [1] http://adsabs.harvard.edu/abs/2012arXiv1207.5578S """ import numpy as np from astroML.utils import deprecated f...
import torch import torch.nn as nn import dlutil as dl class MultiHeadAttention(nn.Module): def __init__(self, q_in_features, k_in_features, v_in_features, num_heads, d_model): super(MultiHeadAttention, self).__init__() self.num_heads = num_heads self.d_model = d_model assert d_mod...
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp from typing import Iterable import cv2 import mmcv import numpy as np import torch from mmcv.parallel import collate from mmcv.tensorrt import is_tensorrt_plugin_loaded, onnx2trt, save_trt_engine from mmdet.datasets import ...
#!/usr/bin/env python3 from netCDF4 import Dataset from scipy.spatial import cKDTree from PIL import Image import copy import matplotlib matplotlib.use('TkAgg') import numpy import pyart.graph.cm # Just for the NWSRef colormap import pygrib import scipy.ndimage # Basically a singleton that all GriddedFields can use t...
from typing import Any, Union from boa3.builtin import NeoMetadata, metadata, public from boa3.builtin.contract import Nep17TransferEvent, abort from boa3.builtin.interop.blockchain import get_contract from boa3.builtin.interop.contract import GAS, NEO, call_contract from boa3.builtin.interop.runtime import calling_sc...
import sqlite3 import pandas as pd import pyarrow as pa import pyarrow.plasma as plasma import numpy as np import pickle start_project_time = 1541498400 # Init tz = "Europe/Oslo" date_format = "%Y-%m-%d %H:%M:%S" depth_tags = tuple( *[ list(range(10, 90, 2)) + list(range(97, 107)) + list(r...
import networkx as nx from utils import files,statistics import json # 将线的label数据进行处理,最后得到{'label':数值} def get_data_from_label_edge(network): # source target 其他label labels = files.get_labels_from_db(network, False) G = files.read_network_with_type(network) edges = G.edges() data = [] temp =...
# Copyright 2018 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
# Copyright 2022 The Balsa Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
import operator import numpy as np import torch from torch.nn import DataParallel from torchvision.utils import make_grid from trainer.trainer import Trainer from utils import map_fn, operator_on_dict # inherit from Trainer class MonoRecTrainer(Trainer): def __init__(self, model, loss, metrics, optimizer, confi...
import os from datetime import datetime import gym, copy import numpy as np import torch import torch.nn as nn import xlwt from torch.distributions import Categorical, MultivariateNormal def initial_excel(): global worksheet, workbook # xlwt 库将数据导入Excel并设置默认字符编码为ascii workbook = xlwt.Workbook(encoding='as...
import numpy as np import os import re from dataprocess.data_settings import DATADIR, RAWDATA_2014MEHTA, RAWDATA_2018SCMCA, PIPELINES_VALID """ Standardize: convert different formats of scRNA expression data into local standard - store row labels (genes), column labels (cell ID), and data (expression levels) in o...
#!/usr/bin/env python3 import base64 import errno import http.client import json import logging import os import pickle # nosec import socket import ssl import sys import threading from typing import Any, Type import ctf_gameserver.lib.flag from ctf_gameserver.lib.checkresult import CheckResult _TIMEOUT_SECONDS ...
# ------------------------------------------------------------ # Copyright (c) 2017-present, SeetaTech, Co.,Ltd. # # Licensed under the BSD 2-Clause License. # You should have received a copy of the BSD 2-Clause License # along with the software. If not, See, # # <https://opensource.org/licenses/BSD-2-Clause> # # ...
import sys from pretty_midi.utilities import program_to_instrument_class sys.path.append('./models') sys.path.append('../accomontage code/models') from model import DisentangleVAE from ptvae import PtvaeDecoder from EC2model import VAE sys.path.append('./util_tools') from format_converter import melody_matrix2data, ...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import random from torch.distributions import Normal from torch.optim import lr_scheduler import os class Actor(nn.Module): def __init__(self, input_size, hidden_size=400, output_size=1,seed=1): super(Actor, self).__init...
import logging import subprocess import uuid import boto3 import os import json import sys import time from botocore.exceptions import ClientError, DataNotFoundError s3 = boto3.client('s3') rek = boto3.client('rekognition') sqs = boto3.client('sqs') event = boto3.client('events') dynamodb = boto3.resource('dynamodb'...
import os import csv import shutil import requests import datetime import dateutil import traceback def obterUFEstadoPorNome(estado): """ Retorna o codigo UF do estado a partir do nome do estado :param estado: Nome do estado :return codigoDoEstado: Código UF do estado """ try: with ope...
from __future__ import (absolute_import, division, print_function, unicode_literals) from ast import literal_eval from builtins import * from future.utils import iteritems import os import json import logging from brave.palettes import * from brave.notebook_display import * ipython = try_imp...