text
stringlengths
3.07k
22.1k
# Copyright 2017, FBPIC contributors # Authors: <NAME>, <NAME>, <NAME> # License: 3-Clause-BSD-LBNL """ This file is part of the Fourier-Bessel Particle-In-Cell code (FB-PIC) It defines inline functions that are compiled for both GPU and CPU, and used in the gathering kernels. """ def add_linear_gather_for_mode( m, ...
import torch import argparse import numpy as np from torch import nn from torch import optim from torch.utils import data from torch.optim.lr_scheduler import StepLR from torch.nn import functional as F from collections import defaultdict import time import pickle import energy_estimator.analyse as simul class Net(n...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys, os import re import pysam from pyfaidx import Fasta import multiprocessing from ddtools.utilities import * def fecth_modif_site_wrapper(args): return fecth_modif_site(*args) def fecth_modif_site(contig, bases=None): bf = pysam.AlignmentF...
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
import logging import os import signal import time from pathlib import Path from urllib.parse import urlparse, parse_qs from pysimpledlna import Device from pysimpledlna.entity import PlayListWrapper from pysimpledlna.ui.terminal import Player, PlayerStatus from pysimpledlna.utils import wait_interval, format_time fro...
import ctypes import functools from ctypes import wintypes from dearpygui import dearpygui __all__ = [ "toggle_dpg_viewport_transparency", "toggle_process_dpi_awareness", ] # Wintypes _WINFUNCTYPE = ctypes.WINFUNCTYPE _HWND = wintypes.HWND _BOOL = wintypes.BOOL _COLORREF = wintypes.COLORREF _BYTE = wintypes...
import numpy as np import gym import copy import math from controller import get_robot_qpos_from_obs from policies.policy import DualAPolicy import sys, os sys.path.extend([ os.path.join('pybullet-planning'), os.path.join('..', '..', 'pybullet-planning') ]) from pybullet_tools.utils import load_pybullet, load_...
# Functions for handling Jupiter visualizations import panel as pn import param from mast_tap import run_tap_query, clean_up_results from target import get_path, convert_path_to_polygon from plotting import polygon_bokeh, mast_bokeh class MastQuery(param.Parameterized): # Global variables eph = param.Paramet...
import pandas as pd from tqdm import tqdm import numpy as np import matplotlib.pyplot as plt from .laplotter import LossAccPlotter from datetime import datetime from PIL import Image import math # plt.style.use('fivethirtyeight') class SignNames(object): def __init__(self, file_name): """ DataFra...
import sys sys.path.append('..') import os import torch import numpy as np import torch.nn as nn from torch.nn import functional as F import data import utils import metrics from main_bayesian import getModel as getBayesianModel from main_frequentist import getModel as getFrequentistModel import Mixtures.config_mixtu...
"""NICO Dataset.""" from enum import Enum, auto from pathlib import Path from typing import ClassVar, Dict, List, NamedTuple, Optional, Union, cast from PIL import Image, UnidentifiedImageError import numpy as np import pandas as pd from ranzen import parsable, str_to_enum from ranzen.decorators import enum_name_str i...
############################################################################# #Copyright 2016-2017, <NAME>, <NAME>, <NAME>, and <NAME> #The SOFTWARE provided in this page is provided "as is", without any guarantee #made as to its suitability or fitness for any particular use. It may contain #bugs, so use of this tool i...
# -*- coding: UTF-8 -*- """ Encapsulate the SQL to protect the server from injection """ import asyncio import logging import aiomysql import time logging.basicConfig(level=logging.INFO) def log(sql, args=()): logging.info('SQL & args: %s, %s' % (sql, args)) @asyncio.coroutine def create_pool(loop, **kwargs): ...
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # Copyright (c) 2017, SLAC National Laboratory / Kisensum Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # ...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Big Switch Networks, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.a...
import numpy as np import matplotlib.pyplot as plt from numpy.linalg import inv a = np.loadtxt('data1.txt') x = a[:,1] z = a[:,2] yaw = a[:,3] x_train = x[0:1000] z_train = z[0:1000] yaw_train = yaw[0:1000] x_valid = x[1001:] z_valid = z[1001:] yaw_valid = yaw[1001:] # Data overview f1, axes = plt.sub...
# -*- coding: utf-8 -*- import helpers as util import matrices import math import numpy as np from scipy.spatial.distance import cdist def dfs(M, fns, word): """Compute the Document Frequency Score of a word from a document-word count matrix. """ word_index = fns.index(word) # Word count over all ...
from typing import Any, Iterable, Optional, Union from collections import defaultdict, Counter from datetime import datetime, timedelta import pandas as pd import numpy as np from .game import GameRun, load_cities, PlaceToGuess from ..datasets import dataloader import amstramdam.game.status as status from amstramdam....
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import os import shlex import signal import subprocess import sys import time from pathlib import Path from typing import IO, Any, Dict, Lis...
# Copyright 2022 The TEMPO Collaboration # # 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...
# ---------------------------------------------------------------------------- # - Open3D: www.open3d.org - # ---------------------------------------------------------------------------- # The MIT License (MIT) # # Copyright (c) 2018-2021 www.open3d.org # # Permission i...
import inspect from copy import deepcopy from io import IOBase from tempfile import SpooledTemporaryFile as SpooledTemporaryFile from typing import ( Any, AnyStr, Dict, List, Mapping, Optional, Sequence, Tuple, Type, Union, ) from fastapi import params from fastapi.dependencies ...
""" Pseudo-random generator and registry Evennia contribution - <NAME> 2017 This contrib can be used to generate pseudo-random strings of information with specific criteria. You could, for instance, use it to generate phone numbers, license plate numbers, validation codes, non-sensivite passwords and so on. The str...
import sys if sys.version_info[0] == 2: import Queue as queue else: import queue import logging if sys.version_info[:2] <= (2, 6): logging.Logger.getChild = lambda self, suffix:\ self.manager.getLogger('.'.join((self.name, suffix)) if self.root is not self else suffix) import collections import re i...
#!/usr/bin/env python # Copyright 2014 The PDFium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Expands a hand-written PDF testcase (template) into a valid PDF file. There are several places in a PDF file where byte-offsets are r...
""" Open Orchestrator Cloud Radio Access Network 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...
"""Functions that create samples.""" import chaospy as cp import numpy as np import respy as rp import pandas as pd from pathlib import Path PROJECT_ROOT = Path(__file__).resolve().parents[1] DATA_PATH = PROJECT_ROOT / "data" CHAOSPY_SAMPLING_METHODS = { "random", "grid", "chebyshev", "korobov", ...
#!/usr/bin/env python # coding: utf-8 import os import subprocess import platform import numpy as np from astropy.io import fits import mccd from joblib import Parallel, delayed, parallel_backend, cpu_count import click @click.command() @click.option( "--base_repo_path", default="/Users/tliaudat/Documents/P...
""" Various utilities for neural networks. """ import math import torch as th import torch.nn as nn # # PyTorch 1.7 has SiLU, but we support PyTorch 1.5. # class SiLU(nn.Module): # def __init__(self, use_checkpoint=False): # super().__init__() # self.use_checkpoint = use_checkpoint # # def f...
import sys import os curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.append(rootPath) import HQChartPy2 import platform import datetime import requests # 网络数据下载 import json ############################################################## # 周期 # ...
from bs4 import BeautifulSoup as soup from flask import Blueprint, flash, redirect, url_for, render_template, abort, \ request from flask_login import login_required, current_user from bs4 import BeautifulSoup import requests from flaskblog import db from flaskblog.models import Post, User from flaskblog.posts.for...
import torch import torch.nn as nn from .darknet import BaseConv, CSPDarknet, CSPLayer, DWConv class YOLOXHead(nn.Module): def __init__(self, num_classes, width = 1.0, in_channels = [256, 512, 1024], act = "silu", depthwise = False,): super().__init__() Conv = DWConv if depthwise else ...
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
import argparse import json import logging import os import resource import shutil import subprocess import time from contextlib import ExitStack from pathlib import Path from signal import SIGUSR2 from tempfile import NamedTemporaryFile, TemporaryDirectory from types import FrameType from typing import IO, Any, Dict, ...
import json # Code for the creation of aries JSON objects # needed for aries protocols def build_schema(name, version, attributes): schema = { "schema_name": name, "schema_version": version, "attributes": attributes } return schema def build_cred_definition(schema_id, revocation=F...
import abc import asyncio import logging from contextlib import suppress from operator import attrgetter from typing import Any, Callable, List, NamedTuple, Set, Tuple, TypeVar, Union, cast, get_type_hints from quart import Request, request from . import index_scraper, languages from .anime import Anime, AnimeNotFoun...
""" A set of stateless functions that can be used to complete various steps of an OAuth handshake or to identify a MediaWiki user. :Example: .. code-block:: python from mwoauth import ConsumerToken, initiate, complete, identify from six.moves import input # For compatibility between python 2 and 3 ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function import os import sys from optparse import OptionParser import grpc import requests from concurrent import futures from google.protobuf import empty_pb2 from logging import getLevelName # Modify python path if in deve...
from .basetrain import BaseTrain import numpy as np import os from sklearn.model_selection import train_test_split # utilitiy libs import ntpath import json import pickle import keras from keras.optimizers import Adam from keras.callbacks import ModelCheckpoint, ReduceLROnPlateau from keras.callbacks import Callback ...
import pandas as pd import matplotlib.pyplot as plt import numpy as np from scipy import stats import random lambdas = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # lambdas = [6] milestone_start = 5 milestone_end = 9 UpperBound = [] # Given lambda, return a array of the mean values for specific range of milestones def cal_mean_...
""" CS131 - Computer Vision: Foundations and Applications Assignment 2 Author: <NAME> (<EMAIL>) Date created: 07/2017 Last modified: 10/18/2017 Python Version: 3.5+ """ import numpy as np def conv(image, kernel): """ An implementation of convolution filter. This function uses element-wise multiplication and ...
import sys,os,time,argparse import yaml from train import MIXEM import torch #from linear import * import socket #Naai imports import sys, os,argparse, pickle,time import torch torch.manual_seed(179510) import numpy as np np.random.seed(179510) import yaml from sklearn import preprocessing import importlib.util fr...
"""Forked from https://github.com/pytorch/text. BSD 3-Clause License Copyright (c) <NAME> and <NAME> 2016, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain ...
from collections import namedtuple import agenda import itertools import random import toml import os import sys from util import * def read_config(args): agenda.task("Reading config file: {}".format(args.config)) with open(args.config) as f: try: config = toml.loads(f.read()) c...
import numpy as np import torch import scipy.io import os import ipdb import pickle import h5py from utils import LLE_utils from utils import KNN_utils from torch.utils.data import Dataset, DataLoader class Dataset_setup(Dataset): def __init__(self,data, attrs, labels): self.data = data self.attrs ...
# Copyright (C) 2021-present University of Louisiana at Lafayette. # All rights reserved. Licensed under the GPLv3 License. See LICENSE.txt in the project root for license information. from dataclasses import dataclass, asdict from typing import List, Tuple from uuid import UUID from dataclasses_json import dataclass...
from htm_rl.common.image import ImageMovement from htm_rl.modules.htm.utils import get_receptive_field from htm_rl.modules.htm.spatial_pooler import TemporalDifferencePooler from htm_rl.modules.htm.temporal_memory import GeneralFeedbackTM from htm_rl.common.sdr_encoders import IntBucketEncoder from sklearn.datasets imp...
"""This module contains all Cupy specific kernel_tuner functions""" from __future__ import print_function import logging import time import numpy as np from kernel_tuner.observers import BenchmarkObserver #embedded in try block to be able to generate documentation #and run tests without cupy installed try: impo...
# Copyright 2022, The TensorFlow Federated 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 o...
import os import numpy as np import cv2 import xml.etree.ElementTree as ET import re from torchvision.datasets import VisionDataset intrinsic_camera_matrix_filenames = ['intr_CVLab1.xml', 'intr_CVLab2.xml', 'intr_CVLab3.xml', 'intr_CVLab4.xml', 'intr_IDIAP1.xml', 'intr_IDIAP2.xml',...
import glob import os import re import psycopg2 from pg_view.loggers import logger from pg_view.models.parsers import ProcNetParser from pg_view.utils import STAT_FIELD, dbversion_as_float def read_postmaster_pid(work_directory, dbname): """ Parses the postgres directory tree and extracts the pid of the postmas...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Contains functions for running camera capture (from either one or multiple cameras), and provides a commandline user interface. """ import os import sys import argparse import keyboard from FlyCaptureUtils import Camera, img2array, getAvailableCameras # OpenCV only n...
import numpy import sympy from ..helpers import plot_disks from ..nsimplex import NSimplexScheme, get_vol, transform class TriangleScheme(NSimplexScheme): def __init__(self, name, weights, points, degree, citation=None): self.name = name self.degree = degree self.citation = citation ...
# -*- coding: utf-8 -*- __author__ = '<NAME>' '''''' # import numpy as np import pandas as pd import os import base64 import pickle import sqlite3 import face_recognition as fr ''' Configurations ''' ORIGINAL_DATA_PATH = '../FaceImageCroppedWithoutAlignment.tsv' CHUNK_SIZE = int(1e3) TOP_DB_PATH = './encodi...
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
from __future__ import print_function import cv2 import numpy as np MAX_FEATURES = 500 GOOD_MATCH_PERCENT = 0.15 # -*- coding: utf-8 -*- """ Created on Tue May 14 17:17:29 2019 @author: BIEL """ import numpy as np import torch from torchvision import transforms from PIL import Image import cv2 TAG_CHAR = np.array...
""" Handles DELETE actions for the Resource """ import logging import re import time from typing import Optional, Mapping from botocore.exceptions import ClientError from cloudformation_cli_python_lib import SessionProxy, OperationStatus from .models import ResourceModel from .util import delete_contents_s3 log = log...
import pandas as pd import requests import numpy as np import os import logging resource_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'resources') #df_psite = pd.read_table(os.path.join(resource_path, # 'phosphosite_dataset_appended.t...
#!/usr/bin/env python3 import contextlib import enum import os import re import shlex import subprocess import sys from typing import (Dict, Iterator, Mapping, NamedTuple, Optional, Sequence, Tuple) class PartitionType(enum.Enum): LINUX_HOME = '8302' LINUX_X86_64_ROOT = '8304' EFI_SYS...
import sys, logging, time, resource, gc, os import multiprocessing from multiprocessing import Pool from util import print_datetime import numpy as np import gurobipy as grb import torch def estimateWeightsWithoutNeighbor(YT, M, XT, prior_x, sigma_yx_inv, X_constraint, dropout_mode, irepli): logging.info(f'{print_d...
# ********************************************************************************* # REopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions a...
from __future__ import unicode_literals import frappe, base64, hashlib, hmac, json import datetime from frappe import _ def verify_request(): woocommerce_settings = frappe.get_doc("Woocommerce Settings") sig = base64.b64encode( hmac.new( woocommerce_settings.secret.encode('utf8'), frappe.request.data, h...
''' TERMINAL CORE ''' import pygame as pg import xml.etree.ElementTree as ET import random as r import queue from terlocals import * class screenIO: def __init__(self,maxline=30): self.history=[] self.maxline=maxline def flush(self): if len(self.history)>=self.maxline: self....
import numpy as np import tensorflow as tf import gym from datetime import datetime import time import pdb import logging tf.get_logger().setLevel(logging.ERROR) @tf.function def log_summary(writer, step, p_loss, entropy, p_log, ret_batch): with writer.as_default(): tf.summary.scalar('p_loss', p_loss, st...
# -*- coding: utf-8 -*- """ Created on Wed Jul 31 20:05:57 2019 @author: rulix """ import os import logging os.environ['CUDA_VISIBLE_DEVICES'] = '1' os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' logging.basicConfig( format='%(asctime)-15s %(levelname)s: %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.I...
""" Main file for TicTacToe Python """ import time from board import Board import utils from players.player import Player from players.random_player import RandomPlayer from players.input_player import InputPlayer from players.better_opponent_player import BetterOpponentPlayer import input_helpers def exactly_n(n: int...
from django.contrib import admin from django.contrib import messages from django.contrib.admin.decorators import register from django.db.models import Max from django.db.models.fields import TextField from django.db.utils import IntegrityError from django.forms.widgets import Textarea from django.shortcuts import rende...
import torch import torch.nn as nn from torch.utils.data import DataLoader from torchvision.utils import save_image from tensorboardX import SummaryWriter import argparse import os from tqdm import tqdm import csv from utils import * from kpcn import * from dataset import DenoiseDataset from losses import * device =...
import ee import json from traitlets import Any, HasTraits from component import parameter as cp from component import model ee.Initialize() #################################################### ### default parameters of the singleton ######## #################################################### # find the crite...
# -*- coding: utf-8 -*- # Copyright 2015 www.suishouguan.com # # Licensed under the Private License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://github.com/samuelbaizg/ssguan/blob/master/LICENSE # # Unless re...
#!/usr/bin/env python3 from tabulate import tabulate from . import cloudflare from . import local import argparse import configparser import inspect import json import os import re import sys __version__ = "1.0.0" CONFIGPATH = os.path.expanduser('~') + '/.cloudflare.cfg' ZONES_DIR = "" DRY_RUN = False class DNSKe...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
import numpy as np import torch import torch.nn.functional as F import torch.nn as nn import sys from torch.autograd import Variable import math from torch import Tensor class Conv_0(nn.Module): """Convolutional block as comparision with sinc filters""" def __init__(self, out_channels, kernel_si...
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed # under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licens...
import functools import itertools from django.db import models from django.views.generic import base as views_base from django.template import loader from django import template as template_module from django import http from django.conf import settings _namespace_registry = {} class TemplatePrefixMeta(type): de...
from django.db import models from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.models import PermissionsMixin from django.utils.translation import ugettext_lazy as _ from django.core.mail import send_mail from .managers import UserManager class User(AbstractBaseUser, PermissionsMix...
import os import cv2 import random import numpy as np Rain_dataset_path = r'D:\Low level for Real\datasets' dataset_name = r'Rain_haze' def Rain_haze_pair_pic_and_crop_for_dncnn(): rain_path = r'D:\Low level for Real\datasets\Rain_haze\train\in' gt_path = r'D:\Low level for Real\datasets\Rain_haze\train\gt...
""" tests for controller """ # ================================================================================== # Copyright (c) 2019-2020 Nokia # Copyright (c) 2018-2020 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except i...
from django import forms from django.contrib.admin import register, ModelAdmin from django.urls import path, reverse from django.utils.html import format_html from django_mptt_admin.admin import DjangoMpttAdmin from leaflet.admin import LeafletGeoAdmin import logging from reversion.admin import VersionAdmin from thread...
from random import randint, random from sys import float_info def siguienteCiudad(probabilidades, ciudades_recorridas): '''Selecciona la siguiente ciudad. probabilidades: lista de probabilidades de ir a cada ciudad. ciudades_recorridas: lista de ciudades previamente visitadas. ''' # número aleato...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
import torch import math import numpy as np import pandas as pd import torch.nn.functional as F import os import json import matplotlib.pyplot as plt from models.dynamic_net import Vcnet, Drnet, TR from models.itermidate_models import VcnetAtt, VcnetAttv2 from models.DisCri import DisCri from datas.data import get_it...
# Code for KiU-Net # Author: <NAME> import argparse import torch import torchvision from torch import nn from torch.autograd import Variable from torch.utils.data import DataLoader from torchvision import transforms from torchvision.utils import save_image import torch.nn.functional as F import os import matplotlib.pyp...
""" Copyright chriskeraly Copyright (c) 2019 Lumerical Inc. """ import sys import numpy as np import scipy as sp import random import lumapi from lumopt.geometries.geometry import Geometry from lumopt.utilities.edge import Edge from lumopt.utilities.materials import Material class Polygon(Geometry):...
import numpy as np import seaborn as sns import matplotlib.pyplot as plt import pandas as pd import json sns.set_context('paper') sns.set(font_scale=1) palette = sns.color_palette("mako_r", 10) def compare_plots_best_performing(csv): compare_plot_df = {'model': [], 'conds': [], 'rate': [], 'distortion': []} ...
#!/usr/bin/env python # CNN for MNIST Classification # # Standard MNIST: 99.22% # Kaggle Digit Recognizer: 99.04% import tensorflow as tf import numpy as np import pandas as pd def next_batch(data, labels, batch_size): i = 0 n = len(data) while True: yield (data[i:i+batch_size], labels[i:i+batch...
"""Permutation importance for estimators <- code mainly taken from sklearn""" import numpy as np from joblib import Parallel from joblib import delayed from sklearn.metrics import check_scoring from sklearn.utils import Bunch from sklearn.utils import check_random_state from sklearn.utils import check_array from sklear...
import json import random import time from copy import deepcopy from typing import Optional import numpy as np import tensorflow.keras as tk import ai.config as config import ai.utils as ut import model.game as cgm from ai.agent import AlphaZero from model.international_game import InternationalGame def get_models(...
MARTINI_LIPIDS = dict( PC=[ ["DTPC", "PO4"],["DLPC", "PO4"],["DPPC", "PO4"],["DBPC", "PO4"],["DXPC", "PO4"],["DYPC", "PO4"],["DVPC", "PO4"],["DOPC", "PO4"], ["DIPC", "PO4"],["DFPC", "PO4"],["DGPC", "PO4"],["DAPC", "PO4"],["DRPC", "PO4"],["DNPC", "PO4"],["LPPC", "PO4"],["POPC", "PO4"], ["...
from typing import List, Tuple import torch from relogic.logickit.dataflow import DataFlow, Example, Feature, MiniBatch from relogic.logickit.utils import create_tensor from relogic.logickit.tokenizer import CustomizedBertTokenizer, RobertaXLMTokenizer class MixSentExample(Example): """MixSent Example contains th...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import argparse import subprocess from pathlib import Path from shutil import copyfile from check_model import get_extension, check_model from create_input import generate_inputs import coremltools import onnxmltools from onnxmltools.convert.commo...
# from snappy import ProductIO # from snappy import ProductUtils # from snappy import ProgressMonitor # from snappy import jpy # # from os.path import splitext, basename # from os.path import join def plot_products(products, extend=[10, 20, 5, 15]): """ plot the products extends of...
#!/usr/bin/env python ''' These classes contain plumbing for: * Pulling workload from task queues, such as: queue.Queue queue.PriorityQueue boto3.SQS.Client ''' # Queue mechanics ## from queue import Empty as empty from queue import PriorityQueue # For ThreadedRunnerPriorityQueue from queue import Queue ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import unicodedata from .characters import accent, base, diaeresis, iota_subscript, length from .characters import remove_redundant_macron from .characters import breathing, strip_breathing, add_breathing from .characters import SMOO...
from __future__ import print_function import json import logging import os import sys import time import h5py import numpy as np import tensorflow as tf import zarr import gunpowder as gp logger = logging.getLogger(__name__) class NoOp(gp.BatchFilter): def __init__(self): pass def process(self, ba...
from typing import Any, Tuple, Callable, Optional from abc import ABC, abstractmethod from cellrank.ul._docs import d from cellrank.ul._parallelize import parallelize import numpy as np from scipy.sparse import csr_matrix class ThresholdSchemeABC(ABC): """Base class for all connectivity biasing schemes.""" ...
# -*- coding: utf-8 -*- # # Copyright 2021 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
# encoding: utf-8 # network file -> build basic pipline and decoder for Dynamic Network # @author: yanwei.li import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from typing import Dict from dl_lib.layers import Conv2d, ShapeSpec, get_norm from dl_lib.modeling.nn_utils import weight_ini...
import math import random import time class Window: """ class implementing the window (emulator) """ def __init__(self): """ constructor :param dot: top left window :param h: window height :param w: window width """ # r = Region("""get your image here"...
import nltk # nltk.download('punkt') from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from nltk.stem import PorterStemmer import matplotlib.pyplot as plt from wordcloud import WordCloud import math import pandas as pd import numpy as np import re # %matplotlib inline """# Loading the Data""" ...