text
stringlengths
3.07k
22.1k
""" Definitions for Text encoders to be used in different models. Supports BiLSTM, Bert, mBert, TNLR and TULR @author: <NAME> """ # dummy comment to pop it into the PR import json import os import pdb import numpy as np import torch from transformers import XLMRobertaModel, BertModel, BertConfig from ret...
# pylint: disable=no-self-use,invalid-name,protected-access import os import json import h5py import numpy import torch from torch.autograd import Variable from allennlp.common.testing import AllenNlpTestCase from allennlp.data.token_indexers.elmo_indexer import ELMoTokenCharactersIndexer from allennlp.data import To...
#!/usr/bin/env python # # parttool is used to perform partition level operations - reading, # writing, erasing and getting info about the partition. # # Copyright 2018 Espressif Systems (Shanghai) PTE LTD # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
# coding: utf-8 """ Handles conversion of realitive imports """ # region Imports import re from dataclasses import dataclass from typing import List, NamedTuple from kwhelp.decorator import AcceptedTypes from functools import cache import zlib # endregion Imports class rimport(NamedTuple): # python ≥ 3.6 frm:...
# -*- coding: utf-8 -*- __all__ = ["TransitModel", "setup_fit"] import numpy as np from scipy.stats import beta import matplotlib.pyplot as pl from scipy.optimize import minimize import george from george import kernels import transit from .catalogs import KOICatalog from .data import load_light_curves_for_kic c...
# -*- coding: utf-8 -*- """Scheme for numerical modelling of TAP diffusion.""" __author__ = '<NAME>' __email__ = '<EMAIL>' __status__ = 'Operational' import numpy as np from scipy.integrate import odeint def knudsen_diffusion_coeff(temp, ref_coeff, mass=40.0, **kwargs): """Knudsen diffusion coefficient""" ...
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
import threading import itertools from collections import Counter, deque from encodings import utf_8 from functools import cached_property from html.parser import HTMLParser from io import StringIO, TextIOWrapper from typing import Union from krysalid.html_tags import Comment, ElementData, NewLine, Tag from krysalid.m...
# coding=utf-8 # Copyright (c) 2019 Alibaba PAI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
# Copyright (c) 2022 PaddlePaddle 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 appli...
""" EARN following GP genetic operations format """ from Examples.compute.bagging_boosting_of_chains_GA.main import * del globals()["mutation_operation"] del globals()["generate_offspring"] import Examples.compute.bagging_boosting_of_chains_GA.main as main import numpy as np def mutation_operation(P): p = P[ran...
#!/usr/bin/env python3 # Copyright (c) 2018 <NAME> (<EMAIL>). # # 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, m...
import contextlib import importlib import io import itertools import os import pathlib import re import shutil import unittest.mock import warnings from datetime import datetime from distutils.util import strtobool from importlib_metadata import metadata as extract_metadata from types import SimpleNamespace from unitte...
import numpy as np np.random.seed(42) import torch torch.manual_seed(42) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False torch.set_default_dtype(torch.float32) import torch.nn.functional as F import torch.nn as nn import os from tqdm import tqdm from prefetch_generator import Background...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import torch from ..utils import fft, reverse def toeplitz(toeplitz_column, toeplitz_row): """ Constructs tensor version of toeplitz matrix from column vector ...
#!/usr/bin/env python """ Sentry ====== Sentry is a realtime event logging and aggregation platform. It specializes in monitoring errors and extracting all the information needed to do a proper post-mortem without any of the hassle of the standard user feedback loop. Sentry is a Server ------------------ The Sentry ...
from django.http import HttpResponse from django.shortcuts import render from django.utils.encoding import smart_str import os, sys, inspect, StringIO, shutil, time, json, base64 current_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) cardiff_path = os.path.join(os.path.dirname(current...
from manimlib.imports import * import displayer as disp from hilbert.curves import \ TransformOverIncreasingOrders, FlowSnake, HilbertCurve, \ SnakeCurve, Sierpinski from hilbert.section1 import get_mathy_and_bubble class SectionThree(Scene): def construct(self): self.add(TextMobject("A few wor...
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the Li...
# Copyright (c) 2015-2017 Uber Technologies, Inc. # # 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,...
from os.path import dirname, join import numpy as np from nnmnkwii.datasets import ( FileDataSource, FileSourceDataset, MemoryCacheFramewiseDataset, PaddedFileSourceDataset, ) from nnmnkwii.util import ( example_file_data_sources_for_acoustic_model, example_file_data_sources_for_duration_model,...
#!/usr/bin/env python3 """Xbox 360 controller to MIDI controller. This program takes inputs from an Xbox 360 controller and outputs MIDI messages derived from these inputs. """ import os import sys import platform import toml import mido import mido.backends.pygame import pygame # Determine config file location. if ...
import argparse import Bio.SeqIO from collections import OrderedDict import hdbscan import matplotlib.pyplot as plt import numpy as np import pandas as pd import re from scipy.spatial.distance import squareform, pdist import seaborn as sns from sklearn.decomposition import PCA from sklearn.manifold import TSNE, MDS im...
from collections.abc import Mapping import re import sys (C_NONE, C_BACKSLASH, C_STRING_FIRST_LINE, C_STRING_NEXT_LINES, C_BRACKET ) = range(5) if 0: def dump(*stuff): sys.__stdout__.write(' '.join(map(str, stuff)) + '\n') _synchre = re.compile( """ ^ [ \\t]* (?: while | else ...
import pandas as pd from bokeh.io import curdoc, show from bokeh.plotting import figure from bokeh.models import ColumnDataSource, Slider, HoverTool, Select, HoverTool, Legend, LegendItem, Button from bokeh.layouts import Row, Column from bokeh.palettes import Spectral, viridis from tools import openfile, type_change d...
# 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...
import torch from torch import nn import torch.nn.functional as F def resize_like(x, target, mode='bilinear'): return F.interpolate(x, target.shape[-2:], mode=mode, align_corners=False) def get_norm(name, out_channels): if name == 'batch': norm = nn.BatchNorm2d(out_channels) elif name == 'instan...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy import fftpack from scipy.integrate import cumtrapz import numbers class Quaternion: def __init__(self, w, x=None, y=None, z=None): q = [] if isinstance(w, Quaternion): q = w.q elif isinstance(w...
# 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...
import os from unittest import SkipTest import param import holoviews from IPython import version_info from IPython.core.completer import IPCompleter from IPython.display import HTML, publish_display_data from param import ipython as param_ext from ..core.dimension import LabelledData from ..core.tree import AttrTre...
#!/usr/bin/python # -*- coding: utf-8 -*- import collections import itertools import sys from typing import List, Tuple, Dict, Set import dedupe from dedupe.core import randomPairs, randomPairsMatch, unique from dedupe.canonical import getCanonicalRep from dedupe._typing import Data, TrainingData, RecordDict, Trainin...
from django.db import models from django.contrib.auth.models import User # Create your models here. class Store(models.Model): name = models.CharField(max_length=55) description = models.TextField() website = models.CharField(max_length=255) fb_url = models.CharField(max_length=255, null=True, blank=T...
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
"""This module contains code to install dependencies in a target directory""" import logging import os import pathlib import shutil import subprocess import sys import tempfile import typing import lambda_bundler.util as util LOGGER = logging.getLogger("lambda_bundler") def install_dependencies(path_to_requirements:...
# # # # This file is placed under the public domain. # # import os import sys import imp import traceback import unittest import optparse import random import subprocess import time import inspect from . import support, testrunner if sys.version_info[0] >= 3: MAXINT = sys.maxsize else: MAXINT = sys.maxint L...
### # Copyright © 2021, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions, and the...
# coding=utf-8 # Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, 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.or...
# Project Quex (http://quex.sourceforge.net); License: MIT; # (C) 2005-2020 <NAME>; #_______________________________________________________________________________ from quex.input.files.specifier.mode import Mode_Prep, ModeParsed from quex.input.setup import Notificati...
import json import copy import functools from logging import error, info, debug import requests from .schema import Schema, Field, schema_doc, MissingField class NotImplemented(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class InvalidData(Exception): def...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init from torchvision import models from torchvision.models.vgg import model_urls from collections import namedtuple def init_weights(modules): for m in modules: if isinstance(m, nn.Conv2d): init.xavier_u...
#-*- encoding: UTF-8 -*- ############################################### # Todos los derechos reservados a: # # CreceLibre Consultores en Tecnologías Ltda. # # # # ©<NAME> # # <EMAIL> # # ©<NAME> # # <EMAIL>...
""" This file is part of the accompanying code to our manuscript: <NAME>., <NAME>., <NAME>., and <NAME>.: A note on leveraging synergy in multiple meteorological datasets with deep learning for rainfall-runoff modeling, Hydrol. Earth Syst. Sci. Discuss., https://doi.org/10.5194/hess-2020-221, in review, 2020. You sho...
# Lint as: python2, python3 # 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 # ...
import dxfgrabber from dxfgrabber.dxfentities import Insert, Line, Arc from Point_t import * from Balise import * from WPT import WPT from Line_t import Line_t from Arc_t import Arc_t from Contrainte import * from node import * import math import json, pdb import numpy as np def produit_scalaire_norm(vect_1, vect_2)...
""" Module to call mcsqs, distributed with AT-AT https://www.brown.edu/Departments/Engineering/Labs/avdw/atat/ """ from __future__ import annotations import os import tempfile import warnings from collections import namedtuple from pathlib import Path from shutil import which from subprocess import Popen, TimeoutExpi...
from sympy import Derivative from sympy.core.function import UndefinedFunction, AppliedUndef from sympy.core.symbol import Symbol from sympy.interactive.printing import init_printing from sympy.printing.conventions import split_super_sub from sympy.printing.latex import LatexPrinter, translate from sympy.printing.prett...
"""Plugwise Climate component for Home Assistant.""" import logging from plugwise.exceptions import PlugwiseException from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate.const import ( CURRENT_HVAC_COOL, CURRENT_HVAC_HEAT, CURRENT_HVAC_IDLE, HVAC_MODE_AUTO,...
import os import json import logging import requests from enum import Enum from netaddr import IPNetwork, IPAddress from netifaces import AF_INET, ifaddresses, interfaces from kube_hunter.conf import config from kube_hunter.core.events import handler from kube_hunter.core.events.types import Event, NewHostEvent, Vuln...
'''Trains CGAN on MNIST using Keras CGAN is Conditional Generative Adversarial Network. This version of CGAN is similar to DCGAN. The difference mainly is that the z-vector of geneerator is conditioned by a one-hot label to produce specific fake images. The discriminator is trained to discriminate real from fake image...
import csv import random from timeit import default_timer from tqdm import tqdm import deepxde as dde import numpy as np from baselines.data import NSdata import torch from torch.optim import Adam from tensordiffeq.boundaries import DomainND, periodicBC from .tqd_utils import PointsIC from .model import SAWeight from...
""" Created on 22. apr. 2015 @author: pab References ---------- A METHODOLOGY FOR ROBUST OPTIMIZATION OF LOW-THRUST TRAJECTORIES IN MULTI-BODY ENVIRONMENTS <NAME> (2010) Phd thesis, Georgia Institute of Technology USING MULTICOMPLEX VARIABLES FOR AUTOMATIC COMPUTATION OF HIGH-ORDER DERIVATIVES <NAME>, <NAME> , and <...
import sys sys.path.extend(['../']) import os import pickle import argparse import numpy as np from tqdm import tqdm from data_gen.preprocess import pre_normalization # NTU RGB+D Skeleton 120 Configurations: https://arxiv.org/pdf/1905.04757.pdf training_subjects = set([ 1, 2, 4, 5, 8, 9, 13, 14, 15, 16, 17, 18...
# Copyright 2021 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.txt" file accom...
from banal import first from pprint import pprint from normality import stringify, collapse_spaces from pantomime.types import XML from followthemoney.util import join_text from opensanctions.core import Context from opensanctions import helpers as h from opensanctions.util import multi_split, remove_bracketed FORMAT...
import copy import logging import typing import warnings from typing import Any, Dict, Iterator, List, Optional, Text from rasa_sdk.events import EventType if typing.TYPE_CHECKING: # pragma: no cover from rasa_sdk.executor import CollectingDispatcher from rasa_sdk.types import DomainDict, TrackerState logg...
"""Encapsulated manager for in-memory tasks on a worker. This module covers: - spill/unspill data depending on the 'distributed.worker.memory.target' threshold - spill/unspill data depending on the 'distributed.worker.memory.spill' threshold - pause/unpause the worker depending on the 'distributed.worker.memory.pause'...
import numpy as np import pandas as pd import pandas.util.testing as tm import pandas.tseries.period as period from pandas import period_range, PeriodIndex, Index, date_range def _permute(obj): return obj.take(np.random.permutation(len(obj))) class TestPeriodIndex(tm.TestCase): def setUp(self): pa...
""" ulmo.usgs.eddn.core ~~~~~~~~~~~~~~~~~~~~~ This module provides access to data provided by the `United States Geological Survey`_ `Emergency Data Distribution Network`_ web site. The `DCP message format`_ includes some header information that is parsed and the message body, with a variable ...
""" Collaborate with RestApiClient to make remote anonymous and authenticated calls. Uses user_io to request user's login and password and obtain a token for calling authenticated methods if receives AuthenticationException from RestApiClient. Flow: Directly invoke a REST method in RestApiClient, example: get_co...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: gexiao # Created on 2017-01-09 20:53 import time import requests import functools import proxy_switcher import logging from token_bucket import Bucket from config.config import V2EX_USERNAME CRAWLER_HEADERS = { 'Accept': 'text/html,application/xhtml+xml,appl...
# -*- coding: utf-8 -*- from __future__ import print_function import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import torchvision.datasets as dsets import torchvision.transforms as transforms from torch.nn.init import kaiming_normal, calculate_gain from PIL import...
import logging import os import re import functools from netdisc.tools import helpers, pandor logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler()) # from netdisc.tools import pandor INDEX = "index" PROMPT = "Enter something> " SHORTEN = 60 def print_device_info(device): print(f"These nei...
import configparser import logging import subprocess import tkinter as tk from tkinter import ttk from typing import List, Optional from modlunky2.config import Config from modlunky2.ui.play.config import SECTIONS, PlaylunkyConfig from modlunky2.ui.widgets import ( ScrollableFrameLegacy, Tab, ) from modlunky2...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from numpy.testing import assert_almost_equal import tensorflow as tf import ray import ray.experimental.tf_utils def make_linear_network(w_name=None, b_name=None): # Define the inputs. x_data = tf.p...
import numpy as np from conftest import check_image_equality, data_path from kitt.dataloading import DataLoader from kitt.image.image import load_image from kitt.image.segmentation.dataloading import ( PatchingSamplerLoader, SegmentationAugmentationLoader, ) from kitt.image.segmentation.mask import ( binar...
# Copyright 2010 New Relic, 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 to in writ...
""" Copyright 2019 <NAME>. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distribut...
import logging import copy import numpy as np import pandas as pd import os import time from supervised.algorithms.algorithm import BaseAlgorithm from supervised.algorithms.registry import AlgorithmsRegistry from supervised.algorithms.registry import ( BINARY_CLASSIFICATION, MULTICLASS_CLASSIFICATION, REGR...
import json import logging import os import shutil import torch import numpy as np from tqdm import tqdm import matplotlib matplotlib.use('Agg') #matplotlib.rcParams['savefig.dpi'] = 300 #Uncomment for higher plot resolutions import matplotlib.pyplot as plt import model.net as net logger = logging.getLogger('DeepA...
import gym import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from tensorflow.keras import layers env = gym.make("Pendulum-v0") num_states = env.observation_space.shape[0] print("Size of State Space -> {}".format(num_states)) num_actions = env.action_space.shape[0] print("Size of Action Spac...
from flask import json DEFAULT_PLATFORMS=['windows','linux','darwin','freebsd'] class PolyLogyxServerDefaults: plgx_config_all_options = "plgx_config_all_options" plgx_config_all_settings = "plgx_config_all_settings" default_type = "default" current_ip = 'https://localhost:9000' BASE_URL = "/src/...
#!/usr/bin/env python """pyrg - colorized Python's UnitTest Result Tool""" from configparser import ConfigParser from subprocess import Popen, PIPE from select import poll, POLLIN from optparse import OptionParser import sys import re import os import pwd __version__ = '0.2.6' __author__ = '<NAME> <<EMAIL>>' __license...
""" Overview =============================================================================== +----------+------------------------------------------------------------------+ | Path | PyPoE/poe/file/file_system.py | +----------+------------------------------------------------------...
from typing import Optional, Tuple import torch from torch import Tensor, nn from df.config import DfParams, config from df.modules import DfOp, GroupedGRU, GroupedLinear, Mask, convkxf, erb_fb, get_device from libdf import DF class ModelParams(DfParams): section = "deepfilternet" def __init__(self): ...
# Copyright (c) 2015-2017 Tigera, 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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
# # Copyright 2012-2013 Ontology Engineering Group, Universidad Politecnica de Madrid, Spain # # 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...
import os import pytest import sys import tempfile from pathlib import Path from ray import job_config import yaml from ray._private.runtime_env.validation import ( parse_and_validate_excludes, parse_and_validate_working_dir, parse_and_validate_conda, parse_and_validate_pip, parse_and_validate_env_vars, pa...
""" For more information about astronomical date specifications, consult a reference source such as U{this page <http://tycho.usno.navy.mil/systime.html>} provided by the US Naval Observatory. Constants and formulae in this module were taken from the times.h include file of the tpm package by <NAME>, to ensure compati...
import pickle import typing as t import zipfile import functools from typing import TYPE_CHECKING from pathlib import Path import cloudpickle from simple_di import inject from simple_di import Provide from bentoml import Tag from bentoml import Runner from ..models import Model from ..models import PT_EXT from ..mod...
"""Functions for reading data.""" import tensorflow as tf import numpy as np def get_padded_shapes(dataset): """Returns the padded shapes for ``tf.data.Dataset.padded_batch``. Args: dataset: The dataset that will be batched with padding. Returns: The same structure as ``dataset.output_shapes`` contai...
'''Train CIFAR10 with PyTorch.''' import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.backends.cudnn as cudnn import torchvision import torchvision.transforms as transforms import os import argparse from models import ResNet20 from models import ResNet56 from ...
# 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...
from typing import List, Dict, Union from sqlalchemy.orm import Query from sqlalchemy.orm.session import Session from threedi_api_client.openapi.models.timed_structure_control import ( TimedStructureControl, ) from threedi_api_client.openapi.models.measure_location import MeasureLocation from threedi_api_client.ope...
import os import re import torch import string import pandas as pd import numpy as np from collections import OrderedDict from transformers import BertTokenizer from transformers import BertModel from scipy.spatial.distance import cosine from scipy.stats import pearsonr, spearmanr from nltk.corpus import wordnet as wn ...
import carla import numpy as np from typing import NamedTuple, List, Tuple, Optional from carla_birdeye_view import lanes from cv2 import cv2 as cv from carla_birdeye_view.lanes import LaneSide Mask = np.ndarray # of shape (y, x), stores 0 and 1, dtype=np.int32 RoadSegmentWaypoints = List[carla.Waypoint] COLOR_OFF ...
import json from typing import Optional from refract.registry import Registry from refract.elements import (Element, Attributes, Metadata, KeyValuePair, String, Array) from refract.refraction import refract META_KEYS = ('id', 'title', 'description', 'classes', 'links', 'ref') class JS...
""" Implementation of the three networks that make up the Talking Heads generative model. """ from collections import OrderedDict import torch import torch.nn as nn from torch.nn import functional as F from .components import ResidualBlock, AdaptiveResidualBlock, ResidualBlockDown, AdaptiveResidualBlockUp, SelfAttent...
__ver__ = 0.5 # Guess The Programming Language v0.5 (Written in Python) # Created by QuanMCPC (https://quanmcpc.site/), licensed under MIT license # Inspired from https://guessthiscode.com/ # MIT License # Copyright (c) 2021 QuanMCPC # Permission is hereby granted, free of charge, to any person obtaining a copy # of...
#!/usr/bin/env python3 # pylint: disable=invalid-name """Use the public Octopus Energy API to request the half-hourly rates for the Agile tariff for a particular region, and insert these into an SQLite database, dealing with duplicate requests and pruning old data so that the DB doesn't grow infinitely.""" import sql...
import os import random import json import numpy as np from glob import glob from itertools import compress import torch from torch.utils import data import torchvision.transforms as TF import datasets.transform as mytrans from utils.system import load_image_in_PIL, gct import matplotlib.pyplot as plt f...
from os.path import splitext from os import listdir import numpy as np from glob import glob import torch from torch.utils.data import Dataset import logging from skimage.transform import resize, rotate from skimage.filters import gaussian from skimage import io import Augmentor import cv2 class BasicDataset(Dataset):...
import random import numpy as np import math def sigmoid(x): return 1. / (1 + np.exp(-x)) def sigmoid_derivative(values): return values*(1-values) def tanh_derivative(values): return 1. - values ** 2 # createst uniform random array w/ values in [a,b) and shape args def rand_arr(a, b, *args): np...
"""The dhcp integration.""" from abc import abstractmethod import fnmatch from ipaddress import ip_address as make_ip_address import logging import os import threading from scapy.arch.common import compile_filter from scapy.config import conf from scapy.error import Scapy_Exception from scapy.layers.dhcp import DHCP ...
# Copyright (c) 2021, INRIA # Copyright (c) 2021, University of Lille # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, t...
from pylab import rcParams from matplotlib import pyplot as plt import numpy as np from collections import Counter import matplotlib.patches as mpatches import seaborn as sns colors = ['blue', 'red', 'green', 'yellow'] styles = ['-','--',':','-.'] rcParams['font.size'] = 16 def plot_transition_matrix(em, kmeans, hos...
from collections import Iterable import numpy as np import openmdao.api as om from .constants import INF_BOUND class _ReprClass(object): """ Class for defining objects with a simple constant string __repr__. This is useful for constants used in arg lists when you want them to appear in automaticall...
import cv2 import torch import torch.nn as nn import numpy as np from PIL import Image from tqdm import tqdm from fastai.vision import pil2tensor, ImageSegment, SegmentationLabelList def get_training_image_size(original_size, multiple=32): """ Our inputs to the network must by multiples of 32. We'll fi...
import numpy, PIL from PIL import Image, ImageDraw, ImageChops #code from jialongw - download_image() method modified # imports import requests # to get image from the web import shutil # to save it locally import os import sys import csv import cv2 import argparse from ast import literal_eval # global va...
import os import json import sys import pytest import subprocess import re import shlex from prettytable import PrettyTable from collections import OrderedDict from yattag import Doc from pathlib import Path from tests.conftest import TEST_ROOT, PROJECT_ROOT BG_COLOR_GREEN_HEX = 'ccffcc' BG_COLOR_YELLOW_HEX = 'ffffcc'...
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' File name: Project.ipynb Author: <NAME> Date created: 3/12/2021 Date last modified: 4/12/2021 Python Version: 3.8 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''...