text
stringlengths
3.07k
22.1k
"""Custom YAML file loader with !secrets support.""" import logging import os import sys from config.configuration import Configuration from dateutil.parser import parse from pathlib import Path import yaml from config import config_from_yaml from collections import OrderedDict from typing import Dict, List, TextIO,...
import cv2 from bresenham import bresenham # from PIL import Image, ImageDraw import matplotlib.pyplot as plt import cv2 import numpy as np # from multiprocessing import Process, Queue from threading import Thread as Process from queue import Queue from collections import Counter w_occ = 2.0 thresh_floor = -0.3 def ...
"""Define resources model classes. Defines the basic attributes & interface of any resource type class, responsible for the resource static & dynamic information. """ # pylint: disable=access-member-before-definition,no-init # pylint: disable=attribute-defined-outside-init,invalid-name # pylint: disable=no-self-use,to...
#!/usr/bin/env python3 import os python_files = [] for root, dirs, files in os.walk('./code'): for file in files: if file.endswith('.py'): python_files += [ root + "/" + file ] num_files = len(python_files) print(str(num_files) + " files loaded") import io blob = "" for file in python_files...
""" Reference: https://pytorch.org/tutorials/beginner/data_loading_tutorial.html TODO: Documentaion """ import numpy as np import pandas as pd from os.path import join as path_join from PIL import Image from torch.utils.data import Dataset from . import PairIndexSet class DeepFashionDataset(Dataset): """...
import re from copy import deepcopy from ast import Node from ast import ast_to_string, find_constants, find_functions from ast import resolve_variable_collisions from petrick import petrick_method def eliminate_implication_and_iff(node): if node.type == 'IMPLIES': node.type = 'LOR' node.data = 'or' ...
""" =========================== Creating annotated heatmaps =========================== It is often desirable to show data which depends on two independent variables as a color coded image plot. This is often referred to as a heatmap. If the data is categorical, this would be called a categorical heatmap. Matplotlib's...
# -*- coding: utf8 -*- # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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...
import requests import spotipy from spotipy.oauth2 import SpotifyClientCredentials import sys import time from flask import Flask, request, jsonify, render_template, Response from flask_sqlalchemy import SQLAlchemy import lyricsgenius as genius import pandas as pd import numpy as np import os # import NLP processing m...
import os import torch import logging from igraph import Graph, plot from enum import Enum from tqdm import tqdm from pathlib import Path # DATA HANDLING CLASSES from treelstm import Vocab # IMPORT CONSTANTS from treelstm import Constants # CONFIG PARSER from config import parse_args # UTILITY FUNCTIONS from tree...
""" Layers for target prediction such as Energy and Charge """ import torch from . import indexers from . import hiplayers class HEnergy(torch.nn.Module): """ Predict a system-level scalar such as energy from a sum over local components. """ def __init__(self,feature_sizes,first_is_interacting=False,n...
''' Copyright 2018 <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, s...
# -*- coding: utf-8 -*- """ Created on Wed May 24 08:00:33 2017 This script load the xml IPCR descriptions text from Wipo (ipcr-2015.xml) and a patent universe from P2N (a list of patent according to a request). It develops "Augmented Abstracts" consisting of each abstracts completed with the sum of the first deepers ...
import importlib import os import shlex import subprocess import sys from contextlib import contextmanager import pytest import yaml from click.testing import CliRunner from cookiecutter.utils import rmtree from pytest_cookies.plugin import Cookies @contextmanager def inside_dir(dirpath): """ Execute code fr...
import requests, psutil, os, sys, json, ctypes, traceback, logging from InquirerPy.utils import color_print from requests.adapters import HTTPAdapter, Retry from .localization.localization import Localizer from .config.constants import Constants # Get handle for console window kernel32 = ctypes.WinDLL('kernel32') use...
import sys import json import traceback _LOG_LEVELS = {level: idx for idx, level in enumerate(("critical", "error", "warning", "notice", "info", "verbose", "debug"))} def _skip_until_empty_line(file): while True: line = file.readline().strip() if not line: break def _get_request(file...
# Generated by Django 2.1.3 on 2018-12-07 15:11 from django.contrib.auth import get_user_model from django.db import migrations from os import getenv def create_preferences(apps, schema_editor): PreferenceModule = apps.get_model('pyplan', 'PreferenceModule') Preference = apps.get_model('pyplan', 'Preference...
#Fitter module import numpy as np import scipy.optimize as opt #uses numpy (as np) functions: # A is a numpy array # if A = [1,2,2,3,4,5,5,] --> returns [1,2,3,4,5] #as well as the indices of the elements in A used # does NOT modify A #returns (A[index], index) def RemoveConsecutiveClones(A): C = ...
# -*- coding: utf-8 -*- """ Model for SO-labeling. @author:yuhaitao """ import sys import tensorflow as tf from tensorflow.contrib.layers.python.layers import initializers sys.path.append("../") from bert.bert_code import modeling, optimization, tokenization class InputExample(object): """A single training/test...
"""entity recreate. Revision ID: cc03d89e76c8 Revises: 4f5eb9113692 Create Date: 2016-04-14 14:24:08.804039 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'cc03d89e76c8' down_revision = '4f5eb9113692' def upgrade(): op.create_table('entity_address', ...
#!/usr/bin/env python3 """ Load the Session.sublime_session file from either the Sublime Text or Sublime Merge data directory and perform a cleanup operation to remove all of the recent workspaces, folders/git repositories, and files that are in the list of recently accessed items if they no longer exist on disk. The i...
#!/usr/bin/env python3 import argparse import numpy as np import time import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def cubic_bezier(u, p0, p1, p2, p3): """ u in [0, 1] p_j the four relevant control points """ assert u >= 0. assert u <= 1. u2 = u*u u3 = u2*u ret = (1. - ...
# -*- coding: utf-8 -*- """ Created on Sat Apr 17 17:49:50 2021 @author: natnael """ # how to move image to particular postion ; to move the objects from ther orgin # # from tkinter import * import tkinter.font as font from PIL import ImageTk, Image import random import time root = Tk() root.title("Ludo King") ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Control you Sonos system from you Mac Menu Bar """ # <bitbar.title>SonosBar</bitbar.title> # <bitbar.version>v1.0</bitbar.version> # <bitbar.author><NAME></bitbar.author> # <bitbar.author.github>anergictcell</bitbar.author.github> # <bitbar.desc>Control you Sonos syste...
from torch.autograd import Variable import warnings warnings.filterwarnings("ignore") import torch import torch.optim as optim from datetime import datetime, timedelta from data.dataset import NCPDataset,NCP2DDataset,NCPJPGDataset,NCPJPGDataset_new,NCPJPGtestDataset_new from torch.utils.data import DataLoader from tens...
import asyncio import os from asyncio import AbstractEventLoop from contextlib import suppress from datetime import datetime import pytest import naff from naff import ( GuildChannel, MessageableMixin, GuildNews, ThreadableMixin, ExplicitContentFilterLevels, VerificationLevels, Client, ...
from flask_wtf import FlaskForm from wtforms import TextField, PasswordField, StringField, IntegerField, FileField, BooleanField, SubmitField, \ SelectField, HiddenField, TextAreaField, MultipleFileField from wtforms.validators import DataRequired, EqualTo, Length from wtforms.fields.html5 import EmailField, De...
from concurrent.futures import ThreadPoolExecutor from dataclasses import dataclass from queue import Queue from typing import Any, Dict, List, Tuple, Callable, Union import numpy as np import torch import torch.distributed as dist from torch.utils.data.dataset import IterableDataset from transformers import BertToken...
#!/usr/bin/env python3 # Copyright 2016 The Meson development 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 appl...
from typing import Tuple import torch from torch import Tensor from torch import nn from torch.nn import functional as F __all__ = ['ENet', 'enet'] def enet(in_channels, out_channels): return ENet(in_channels, out_channels) class ENet(nn.Module): def __init__(self, in_channels, out_channels): sup...
import os import subprocess as sp from dotmap import DotMap from typing import Union, Tuple from .startup_script_gcp import ( tmux_setup, clone_gcp_bucket_dir, install_venv, install_additional_setup, jax_gpu_build, jax_tpu_build, exec_python, exec_bash, sync_results_from_dir, ) cor...
# This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative works of this code must retain this # copyright notice, and mod...
#Required imports import cv2 import numpy as np import math #Reading the Image ig1 = cv2.imread('hough.jpg') ig2 = cv2.imread('hough.jpg') sample = cv2.imread('hough.jpg',0) #Methods #Flips the kernel def flip_operator(kernel): kernel_copy = [[0 for x in range(kernel.shape[1])] for y in range(kerne...
from dearpypixl.components import Item from dearpypixl import Application from dearpypixl import basic from dearpypixl import colors from dearpypixl import containers from dearpypixl import drawing from dearpypixl import misc from dearpypixl import nodes from dearpypixl import plotting from dearpypixl import tables fro...
#!/usr/bin/env python # -*- coding:utf-8 -*- from __future__ import print_function import json import os from jinja2 import ChoiceLoader, FileSystemLoader from notebook.utils import url_path_join, to_os_path from notebook.services.contents.checkpoints import GenericCheckpointsMixin from notebook.services.contents.f...
########################################################################## # mriWorks - Copyright (C) IRMAGE/INSERM, 2020 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # https://cecill.info/licences/Licence_CeCILL_V2-en.html # for detai...
# Under Maintenance import argparse import pathlib import sys from impacket.dcerpc.v5 import rprn, transport from impacket.dcerpc.v5.dtypes import NULL from impacket.structure import Structure # https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/2825d22e-c5a5-47cd-a216-3e903fd6e030 class DRIVER_IN...
from .functions import * from typing import Coroutine, Dict, Type, Union, Callable, List, Any, Optional, AsyncGenerator from pathlib import Path from .config import Config, cm_dir, config_path import os from . import utils, api, static, error as command_errors from .utils import * from .api import * import colo...
#!/usr/bin/python3.6 """ Distributes stdin to multiple child processes executing in parallel. The child processes are described by <args>. The output and stderr from each child is collated and output as one stream without priority to any one process, and without clipping or mashing together lines from different childre...
import argparse import os, sys import json from copy import deepcopy import numpy as np from scipy.spatial import cKDTree from tqdm import tqdm from ..utils.scannet_utils import get_global_part_labels_description, load_pickle, get_scannet from ..utils.vox import load_sample from ..utils.transforms import apply_transf...
# 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...
""" Your module contains the Observations and Model classes. """ import numpy as np import os.path import matplotlib.pylab as plt from astropy.io import fits from astropy.cosmology import WMAP9 as cosmo from reproject import reproject_interp from astropy.convolution import convolve,Gaussian2DKernel class Observat...
from __future__ import division, print_function from six.moves import xrange as range from nose.tools import with_setup, assert_raises, assert_equal import itertools from scipy.linalg import block_diag import numpy as np where = np.flatnonzero from lavaburst.core import algo from lavaburst import scoring A = 10*bl...
""" Tools to make mini-languages. Uses cases: In situations where you want to get some input from a user (from the web, in a command line, etc.) that specifies a computation to be carried out, you know (right) that you definitely shouldn't resort to using `eval` or `exec`. Because it's dangerous for everyone involved ...
import math import torch.nn as nn from mmcv.cnn import ConvModule,build_norm_layer from mmcv.runner import BaseModule, auto_fp16 from mmcv.cnn import kaiming_init from mmdet.models.builder import NECKS from mmcv.ops import DeformConv2dPack @NECKS.register_module() class ShortcutNeck(BaseModule): """The neck used...
import sys sys.path.append('..') sys.path.append('/moire') import math import numpy as np import cv2 import os from skimage.feature import local_binary_pattern from dsift import DsiftExtractor import pickle from lib.processing_utils import analysis, get_file_list import datetime import time from lib.processing_utils i...
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 ADCIRC Development Group # # 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 ri...
import gensim import random import logging # configuration trains = "../../temp_results/word2vec_hindi.txt" create = 1 topn = 10 data_folder = '../data/word2vec_evaluation/' TARGET_SYN = data_folder+'syntactic.questions.txt' TARGET_SEM_OP = data_folder+'semantic_op.questions.txt' TARGET_SEM_BM = data_folder+'se...
#!/usr/bin/python # -*- coding:utf-8 -*- """ 训练程序玩Atari打砖块游戏 最好在linux下运行 需要安装软件包 pip install gym[atari] """ import gym import pickle import random import warnings import numpy as np from collections import deque from skimage.color import rgb2gray from skimage.transform import resize from keras import layers from ker...
# Copyright 2017 D-Wave Systems 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 wri...
# --coding: utf8-- import logging from collections import OrderedDict from itertools import islice from django.conf import settings from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models.signals i...
import os import numpy as np import pandas as pd import scipy.special import uproot import oyaml as yaml from . import geometry __all__ = [ "create_hdf_from_root", "convert", "convert_table_to_fixed", "basic_query", "basic_eval", "rename_column", "object_cross_cleaning", "shift_2dvecto...
from csvmimesis.mimesis_data_providers import list_providers_methods, list_locals from csvmimesis.table_generator import create_data_provider_list from dtpattern.unicode_translate.uc_models import PATTERN from dtpattern import dtpattern2, value_pattern_detection from dtpattern.unicode_translate.pattern_detection_print...
# -*- coding: utf-8 -*- import uuid import datetime from sqlalchemy import Column, ForeignKey, func from sqlalchemy.types import Unicode, Boolean, DateTime, Integer, Float, Binary from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declarative_base from shapely import wkb from shapely.geom...
import unittest from maze import Cell, MazePage, InvalidExitError, MultipleSolutionsError class DummyRandom(object): def __init__(self, choiceIndexes=None, randints=None): self.choiceIndexes = choiceIndexes or [] self.randints = randints or [] def choice(self, seq): choice...
"""SRPMBuildModel Copr related fields Revision ID: 0ad4d1c2a2d8 Revises: <PASSWORD> Create Date: 2022-01-17 13:51:01.783926 """ import enum from datetime import datetime from typing import TYPE_CHECKING from packit_service.models import ProjectAndTriggersConnector import sqlalchemy as sa from alembic import op from ...
# Copyright (c) 2017 Civic Knowledge. This file is licensed under the terms of the # MIT License, included in this distribution as LICENSE """ Access the Census API and create Pandas dataframes, with support for IPython and Jupyter display """ import json from collections import UserDict, UserList from textwrap import...
import torch import math import time def CIEDE2000(Lab_1, Lab_2): '''Calculates CIEDE2000 color distance between two CIE L*a*b* colors''' start = time.time() C_25_7 = 6103515625 # 25**7 L1, a1, b1 = Lab_1[:, :, :, 0], Lab_1[:, :, :, 1], Lab_1[:, :, :, 2] # b,N,K,1 L2, a2, b2 = Lab_2[:, :, :, 0], ...
# -*- coding: utf-8 -*- import json from io import StringIO from gsxws import escalations from django import template from django.contrib import messages from django.http import HttpResponse from django.utils.translation import ugettext as _ from django.forms.models import modelformset_factory from django.views.decor...
# -*-coding: UTF-8 -*- from __future__ import division, absolute_import, print_function import time import logging import six from .base_parsers import DOMScope from .dom_components import ComponentProxy from .exceptions import PageNotReady, Timeout from selenium.webdriver.remote.webdriver import WebElement from sele...
from datetime import date import pytest def test_adder(): from simple import Adder assert Adder(3).add(5) == 8 assert Adder(2).add(7) == 9 def test_prefix(): from simple import Prefix p = Prefix("foo") assert p.pre("bar") == "foobar" def test_int_string1(): from simple import IntString...
# -*- coding: utf-8 -*- from keepuppy.sync import Syncer, HashCache from keepuppy.exceptions import FileException, HashCacheException, SyncException import os import tempfile from nose.tools import eq_, assert_true, raises, assert_raises from datetime import datetime, timedelta import json from mock import MagicMock f...
""" Don't confuse these classes with :mod:`parsing_representation` modules, the modules here can access these representation with ``module.parser.module``. ``Module`` exists mainly for caching purposes. Basically :mod:`modules` offers the classes: - ``CachedModule``, a base class for Cachedmodule. - ``Module`` the cl...
import asyncio import datetime import os import pytz import re import logging from logging.handlers import TimedRotatingFileHandler import discord from discord.ext import commands from utils import customchecks, sql, punishmentshelper workDir = os.getcwd() logDir = os.path.join(workDir, "logs") if not os.path.exist...
from scipy import interpolate from cached_property import cached_property import numpy as np try: import matplotlib.pyplot as plt except: plt = None from devito import Dimension from devito.function import SparseTimeFunction __all__ = ['PointSource', 'Receiver', 'Shot', 'WaveletSource', 'RickerSou...
import numpy as np def get_bands(nscf_out, tgrid0): """Get bands and kgrid info from nscf output data contains: kvecs, bands, tgrid, raxes, gvecs kvecs (nk, ndim) are reciprocal points possible in the irreducible wedge kvecs are in 2\pi/alat units bands (nk, nstate) are the Kohn-Sham eigenvalues bands a...
# TODO: fix import # poetry run python ghpypideps/ghpypideps.py # poetry run pytest --ignore=__pypackages__ -vv # poetry run python example.py from __future__ import absolute_import try: from .source_finder import find_source_repo except (ModuleNotFoundError, ImportError) as e: from source_finder import find_s...
""" Plots the grid-convergence for the lid-driven cavity case. """ import os import sys import argparse import math import numpy from matplotlib import pyplot sys.path.append(os.path.join(os.environ['PETIBM_DIR'], 'scripts', 'python')) import ioPetIBM def parse_command_line(): """ Parses the command-line. R...
# Copyright 2014 TWO SIGMA OPEN SOURCE, LLC # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
# -*- coding: utf-8 -*- from func.import_lib import * from func.save_get_data import * from func.get_env import * from func.get_partial_web_content import * from urllib.parse import urlparse POSTCAT_LINKALL = getENV("POSTCAT_LINKALL") PRODUCTCAT_LINKALL = getENV("PRODUCTCAT_LINKALL") POST_LINKALL = getENV("...
import os import logging import asyncio import aiohttp import interactions import python_weather import time from .helpers import levenshtein_ratio_and_distance from .db import StreamDAL, Session, StreamLink from .google import create_factchect_service, GoogleError log = logging.getLogger("feedbot.discord") SERVER_I...
""" Example showing how to use quantum programs in NetSquid, see: https://docs.netsquid.org/latest-release/tutorial.quantumprocessor.html +-------------+ +---------------+ +--------------+ | | DC | | DC | | | create_node +-------+ entangle_node +-------+ measur...
#!/usr/bin/env/python3 """Recipe for training a speech enhancement system with spectral masking. To run this recipe, do the following: > python train.py train.yaml --data_folder /path/to/save/mini_librispeech To read the code, first scroll to the bottom to see the "main" code. This gives a high-level overview of what...
import os import sys import json import glob import math import ntpath import requests from tqdm import tqdm import pandas as pd from ast import literal_eval from scipy.stats import entropy from SPARQLWrapper import SPARQLWrapper, JSON from config import SPARQL_URI, IDENTIFIER_WIKIFIER sparql = SPARQLW...
import boto3 import json import random import resource from io import StringIO ## for Python 3 import time import sys from joblib import Parallel, delayed # constants INPUT_MAPPER_PREFIX = "artemiy/input/" OUTPUT_MAPPER_PREFIX = "artemiy/task/mapper/" INPUT_REDUCER_PREFIX = OUTPUT_MAPPER_PREFIX OUTPUT_REDUCER_PREFIX ...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import ast import os import numpy as np import pandas as pd # transform the encoded video: def video_format_conversion(video_path, output_path, h264_format=False): """ Encode video in a different format. :param...
#!/usr/bin/python ''' Send a count of pending security updates ''' # Copyright 2017 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/licens...
import numpy as np import warnings from time import sleep import subprocess from tensorflow.keras.callbacks import Callback, ReduceLROnPlateau class PatchedModelCheckpoint(Callback): """Save the model after every epoch. `filepath` can contain named formatting options, which will be filled with the values o...
""" This implements the value recursion for numerical semirings. V(v) = \bigoplus_{e \in BS(v)} \omega(e) \bigotimes_{u \in tail(e)} V(u) We also have an implementation which is robust to the presence of cycles. :Authors: - <NAME> """ from collections import defaultdict from functools import reduce from grasp.s...
from pathlib import Path from typing import List, Optional, Tuple, Union import albumentations as albu import cv2 import numpy as np import torch import torchvision.transforms.functional as F_vision from src.dataset.utils import get_class_mask_from_ins, use_sc_cam_format class HPAImageDataset(torch.utils.data.Datas...
from formula import Formula, Atom, Negation, Conjunction, Disjunction, Implication, Biconditional import copy operatorList = ['^', 'v', '~', '=>', '<=>'] afterList = ['(', '>'] beforeList = [')', '=', '<'] def splitString(logic): RList = [] for i in range(len(logic)): j = 0 while j < len(logic...
#!/usr/bin/env python3 import os import sys import argparse import numpy as np import matplotlib.pyplot as plt from yellowbrick.regressor import AlphaSelection from yellowbrick.regressor import ResidualsPlot from yellowbrick.regressor import PredictionError from yellowbrick.cluster import KElbowVisualizer from yellow...
import argparse import math from datetime import datetime import h5py import numpy as np import tensorflow as tf import socket import importlib import os import sys import os.path from os import path import json import pickle BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) # model sys.p...
from pyformlang.finite_automaton import EpsilonNFA, State, Symbol from main import * def test_der(): assert derivative_check('$', 'a*.b*|$') assert derivative_check('aaabbbbbb', 'a*.b*|$') assert not derivative_check('', 'a*.b*|$') assert not derivative_check('abba', 'a*.b*|$') assert derivative_...
############################################################################## # Copyright by The HDF Group. # # All rights reserved. # # # # Th...
# -*- coding: utf-8 -*- # # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # # Graph Isomorphism Networks. # pylint: disable= no-member, arguments-differ, invalid-name import dgl.function as fn import torch import torch.nn as nn import torch.nn.functional as F ...
# -*- coding: utf-8 -*- """ Copyright 2018 <NAME>. All rights reserved. <EMAIL> Licensed under the MIT license. A GATKReport is simply a text document that contains well-formatted, easy to read representation of some tabular data. Many GATK tools output their results as GATKReports. A report contains one or more ind...
#!/usr/bin/env python # The MIT License (MIT) # # Copyright (c) 2015 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # t...
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # # 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. # THIS SOFTWARE IS PROVIDED "AS I...
import fnmatch import re import os import importlib import sys import time from mflog import get_logger from opinionated_configparser import OpinionatedConfigParser LOGGER = get_logger("switch/rules") class add_sys_path(): def __init__(self, path): self.path = path def __enter__(self): if s...
# from data import COMM_DATA from os.path import join from os import getcwd from os.path import dirname, abspath import torch from torch import nn # from nltk.tokenize import sent_tokenize, word_tokenize import random from torchtext.legacy.data import TabularDataset, Field, LabelField, BucketIterator import spacy from...
# Copyright (c) 2009-2020 Arm Limited # SPDX-License-Identifier: Apache-2.0 # # 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 ...
#!/usr/bin/env python # By Apie # 2020-12-06 import json from flask import Flask, request, send_file from jinja2 import Environment, PackageLoader, select_autoescape from flask_apscheduler import APScheduler import sys import urllib.parse from os import path, truncate, getenv from datetime import datetime from func...
import dataclasses import importlib.util import logging import os import pathlib import sys import typing import warnings from functools import singledispatch from types import ModuleType from urllib.request import url2pathname, urlretrieve import requests from marshmallow import ValidationError from . import base_no...
from copy import deepcopy import pandas as pd import numpy as np import torch from torchvision.models.detection.transform import GeneralizedRCNNTransform from options.train_options import TrainOptions from src.dl_template import DLTemplate from src.losses.losses import create_loss from matplotlib.colors import color...
import os import nni import tqdm import torch import datetime import numpy as np import transformers import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from utils import calc_performance,calc_classification_metrics import warnings warnings.filterwarnings(action="ignore") cl...
from drf_yasg.utils import swagger_auto_schema from django_filters import rest_framework as filters from django.views.decorators import csrf from django.utils.decorators import method_decorator from rest_framework.decorators import action, renderer_classes, api_view from rest_framework.renderers import JSONRenderer f...
import copy import glob import os import shutil import sys import tempfile import unittest import unittest.mock import numpy as np import pytest from sklearn.base import clone import torch from autoPyTorch import constants from autoPyTorch.pipeline.components.training.data_loader.base_data_loader import ( Base...
import torch import torch.nn as nn import numpy as np import math def get_upsample_filter(size): """Make a 2D bilinear kernel suitable for upsampling""" factor = (size + 1) // 2 if size % 2 == 1: center = factor - 1 else: center = factor - 0.5 og = np.ogrid[:size, :size] filter ...
#!/usr/bin/env python # python -m unittest -v test_vmu[.TestClass][.test_function] #pylint: disable=C0301 #pylint: disable=R0904 import copy import mock import os import sys import unittest PATHNAME = os.path.realpath('../') sys.path.insert(0, PATHNAME) import vmu def results_msg(expected, actual, msg): divide...