text
stringlengths
3.07k
22.1k
# This file is part of Viper - https://github.com/viper-framework/viper # See the file 'LICENSE' for copying permission. import os import glob import atexit import readline import traceback from viper.common.out import * from viper.core.session import __sessions__ from viper.core.plugins import __modules__ from viper...
import os from os import path from glob import glob import json import re import pickle import argparse import numpy as np import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt from textwrap import wrap from scipy import ndimage, misc import config from type import RecipeContainer, DataContainer fro...
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function) from itertools import product import math try: import numpy as np except ImportError: np = None from .printing import number_to_scientific_html from ._util import get_backend, mat_dot_vec, prodpow class EqCalcResult(...
import numpy as np import astropy.units as u import astropy.constants as const import astropy.io.fits import astropy.time as atime import astropy.coordinates as coord import numpy.random as random import os from simulacra.theory import TheoryModel def read_in_fits(filename): print('reading in {}'.format(filenam...
"""A helper module for generating html tables that are represented as Strings""" import logging LOGGER = logging.getLogger('natcap.invest.reporting.table_generator') def generate_table(table_dict, attributes=None): """Takes in a dictionary representation of a table and generates a String of the the table ...
import math import torch import itertools import numpy as np from torchvision.ops.boxes import nms class SSDBoxCoder: def __init__(self, steps, box_sizes, aspect_ratios, fm_sizes, box_generator=None): self.prior_boxes, self.priors = box_generator(steps, box_sizes, aspect_ratios, fm_sizes) if box_generato...
import multiprocessing import itertools import numpy as np import pandas as pd import scipy.optimize import pickle import sys if '../' not in sys.path: sys.path.append('../') import tick from tick.hawkes.simulation import SimuHawkesExpKernels from tick.hawkes.inference import HawkesConditionalLaw, HawkesADM4, Haw...
import ray from ray import tune import os import random os.environ['SUFFIX']="500K-with-3-vids" os.environ['BASE_DIR']="/home/ec2-user/emb3" from spotlight.cross_validation import random_train_test_split from spotlight.datasets.movielens import get_movielens_dataset from spotlight.factorization.implicit import Implici...
# Copyright 2018 Deep Learning Service of Huawei Cloud. 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...
import os from dataclasses import dataclass, field from enum import Enum from typing import Any, List, Optional from hydra.core.config_store import ConfigStore from omegaconf import MISSING from hiding_adversarial_attacks.config.attack.adversarial_attack_config import ( ALL_CLASSES, ) from hiding_adversarial_atta...
# Copyright 2019 Canonicauh 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 in writing, ...
#! /usr/bin/env python3 # # Copyright 2020 maximumG, xtonousou # # 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...
import time from collections import namedtuple, Sized from heapq import heappush, heappop from pddlstream.algorithms.algorithm import add_certified, add_facts from pddlstream.language.conversion import evaluation_from_fact from pddlstream.language.function import FunctionResult from pddlstream.language.stream import S...
# -*- coding: utf-8 -*- # Extract the chapters as single documents # -*- coding: utf-8 -*- """ Created on Sat Jun 13 15:53:14 2020 @author: yaniv """ from docx import * import re from statistics import mode from nltk.corpus import stopwords from gensim.utils import simple_preprocess import spacy from functools impor...
""" defines: - model = Boundary(log=None, debug=False) - model = BoundaryFile(log=None, debug=False) """ from __future__ import print_function import os from codecs import open from collections import OrderedDict import numpy as np from pyNastran.converters.openfoam.points_file import PointFile from pyNastran.conve...
import tnetwork as tn import sklearn import sklearn.metrics import scipy import statistics import networkx as nx from tnetwork.DCD.analytics.onmi import onmi import numpy as np __all__ = ["longitudinal_similarity", "consecutive_sn_similarity", "similarity_at_each_step", "entropy_by_node","nb_node_change","quality_at_e...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 13 12:00:40 2020 @author: medrclaa This file contains the functions for constructing an exit gfates probablity distribution for an agent given its current heading. Currently, this heading is determined by the slope of the line through an agents st...
import base64 import binascii import struct from typing import Union from crc16 import crc16xmodem from .exceptions import ( Ed25519SecretSeedInvalidError, Ed25519PublicKeyInvalidError, ValueError, TypeError, ) __all__ = ["StrKey"] _version_bytes = { "ed25519_public_key": binascii.a2b_hex("30"),...
import hashlib import requests from haversine import haversine from requests.exceptions import SSLError, ConnectTimeout, ConnectionError from django.conf import settings from django.core.cache import cache from django.core.files.base import ContentFile class TencentLBS(object): key = settings.TENCENT_LBS_KEY ...
""" library containing differential equation solver for d=1 kernel elements """ __author__ = " <NAME>" __email__ = "<EMAIL>" import os import numpy as np from scipy.special import factorial import pdb np.seterr(divide='ignore', invalid='ignore') from scipy import special from scipy.integrate import odeint, solve_ivp...
#!/usr/bin/env python # # Copyright (c) 2011 <NAME> (zuo). All rights reserved. # Licensed under the MIT License. # # Python 2.5+/3.x-compatibile. # # The newest version of this module should be downloadable from: # https://github.com/zuo/Zuo-s-Recipes-and-Drafts/blob/master/auxmethods.py from __future__ import with_s...
from __future__ import print_function from numpy import * from scipy.integrate import fixed_quad from scipy.special import gammaln, betaln, digamma, polygamma from scipy.optimize import fmin import sys def lnchoose(n, m): nf = gammaln(n + 1) mf = gammaln(m + 1) nmmnf = gammaln(n - m + 1) return nf - (m...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. from functools import reduce import operator from seedot.compiler.antlr.seedotParser import seedotParser as SeeDotParser import seedot.compiler.ast.ast as AST from seedot.compiler.ast.astVisitor import ASTVisitor class Ty...
# Music World Sprite Ripper # Version 1.0 # By Buu342 import os import sys import math import numpy as np from PIL import Image as im from pathlib import Path ######################## # Globals ######################## # Start and end offsets in the uncompressed.pxo where sprites are located # Values obtained...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 23 21:30:34 2017 @author: Aeolitus """ from PyQt5 import QtWidgets, QtCore, QtGui import sys import logging import os.path import MainWindow import CharakterEditor import DatenbankEdit import CharakterMain import DatenbankMain from Wolke import Wolk...
# coding=utf-8 ### # Patient.py - # This file contains the definition of class Patient used to handle patients scans, store their lesions # and survival time. # Patient.py also implements handy function to pre process a pile of dicom image e.g. conversion to SUV # # Author : <NAME> - <EMAIL> # # Created on : 16/02/201...
#!/usr/bin/python2.7 #manage-downloads - adds/removes downloads to the catalogue #TODO: # test it all \0/ import os,json,sys import hashlib,uuid from downloadhygeine import DownloadHygeine,Util,crypto color={"green":"\33[92m","blue":"\33[96m","red":"\33[31m","yellow":"\33[93m","white":"\33[98m"} def add(dh): downl...
# -*- coding: utf-8 -*- # Copyright: 2016-2018, <NAME> # These sources are released under the terms of the MIT license: see LICENSE import time, os, signal, random, math from threading import Lock, Thread, Event from logger import Logger import RPi.GPIO as GPIO OPEN_FRONT_DOOR_OUTPUT = 4 # Pin 5 OPEN_APARTMENT_DO...
# %% [markdown] # ## import os import time import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from matplotlib.patches import Circle from mpl_toolkits.axes_grid1 import make_axes_locatable from mpl_toolkits.mplot3d.art3d import Poly3DCollection from sci...
import sys import socket import struct import time import threading class server_msi( object ): def __recv( self, sckt ): msg = sckt.recv( self.slen ) try: cmd = msg[0:1] who = int( msg[1:4] ) dst = int( msg[4:7] ) siz = int( msg[7:17] ) ...
# -*- coding: utf-8 -*- """ utils/hosts.py is for the tools that handle setting the MilMove hostnames and setting up TLS certs. """ import logging import os from typing import Optional from locust.env import Environment from .base import ImplementationError, ValueEnum from .constants import LOCAL_MTLS_CERT, LOCAL_MTL...
import argparse import datetime import numpy as np import os import optuna import pandas as pd import sys import tensorflow as tf from optuna.integration import TFKerasPruningCallback from pathlib import Path # global variables DATA_SET_PATH = "" def parse_split(split_str): pieces = split_str.split(",") spl...
import math import functools import torch import torch.nn as nn import torch.nn.functional as F from . import block as B def pa_upconv_block( nf, unf, kernel_size=3, stride=1, padding=1, mode='nearest', upscale_factor=2, act_type='lrelu'): upsample = B.Upsample(scale_factor=upscale_factor, mode=...
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from azureml._cli.workspace.workspace_subgroup import WorkspaceSubGroup from azureml._cli.cli_command import command from azureml._cl...
import json import os import requests from django.utils import translation from django.http import HttpResponse from django.contrib.auth.views import PasswordChangeView from django.views.generic import FormView, DetailView, UpdateView from django.urls import reverse_lazy, reverse from django.shortcuts import redirect f...
import logging from ibmsecurity.utilities import tools logger = logging.getLogger(__name__) # "uri" variable already used so using a different name module_uri = "/iam/access/v8/authentication/policies" requires_modules = ["mga"] requires_version = None def get_all(isamAppliance, start=None, count=None, filter=None,...
import csv import os import pcbnew import re import wx from decimal import Decimal, getcontext from pathlib import Path ref_ignore = ["TP", "T", "NT", "REF**", "G", "H"] # original rotation db from: # https://github.com/matthewlai/JLCKicadTools/blob/master/jlc_kicad_tools/cpl_rotations_db.csv rotations = { "^SOT-...
#!/usr/bin/env python3 from pathlib import Path import defopt import numpy as np import pandas as pd from matplotlib.backends.backend_pdf import PdfPages import matplotlib.pyplot as plt from gp_ppc import load_data from gp_model import extract_filters from plot_orsolic_paper import plot_psycho, plot_chrono from strenum...
import numpy as np from scipy.interpolate import LinearNDInterpolator, interp1d from astropy import table from astropy.table import Table, Column import warnings def get_track_meta(track, key="FeH"): """ get meta info from a track """ assert key in track.meta.keys() return track.meta[key] def find_ran...
#!/usr/bin/env python # Family size distribution of tags which were aligned to the reference genome # # Author: <NAME> & <NAME>, Johannes-Kepler University Linz (Austria) # Contact: <EMAIL> # # Takes at least one TABULAR file with tags before the alignment to the SSCS, # a BAM file with tags of reads that overlap the ...
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team. # Copyright (c) 2018, <NAME>PORATION. 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 ...
#________HEADER FILES_______ import tkinter from tkinter import* #from tkvideo import tkvideo from tkinter import ttk from tkinter import filedialog from _cffi_backend import callback from PIL import ImageTk, Image import cv2 from cv2 import * import numpy as np import sys import time import argparse import imutils fr...
"""Support for Rainwise IP-100 service.""" import asyncio import logging import async_timeout import aiohttp import voluptuous as vol from bs4 import BeautifulSoup import homeassistant.helpers.config_validation as cv from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.helpers.aiohttp_client...
import numpy as np # from scp import SCP from main_komo import run_komo_standalone from utils_motion_primitives import sort_primitives, visualize_motion, plot_stats import robots import yaml import msgpack import multiprocessing as mp import tqdm import itertools import argparse import subprocess import tempfile from p...
""" file: list_mode_data_decoder.py brief: Decodes binary data produced by an XIA Pixie16 module author: <NAME> date: January 17, 2019 """ from enum import Enum from functools import partial from io import BytesIO from struct import unpack from dolosse.constants.data import WORD, HALF_WORD class HeaderCodes(Enum): ...
# -*- coding: utf-8 -*- import markdown from django.utils import timezone from flask import request from api.caching.tasks import ban_url from osf.models import Guid from framework.postcommit_tasks.handlers import enqueue_postcommit_task from website import settings from addons.base.signals import file_updated from o...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, division, print_function, absolute_import import types import re import cgi from functools import wraps import logging from decorators import FuncDecorator, property from ..compat import * from ..exception import CallError logger = logging.getLogger(_...
#!/usr/bin/env python3 # This script replaces the Makefile to provide a convenient cross-platform build tool import argparse import glob import os from os import path import shutil import subprocess import sys def fatal_print(msg): print(msg) exit(1) def fs_action(action, sourcefile, destfile = ""): isfile = pat...
#<NAME> import numpy as np import matplotlib.pyplot as plt import pandas as pd import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) from sklearn.linear_model import LinearRegression, Ridge, Lasso, ElasticNet from sklearn.model_selection import train_test_split, GridSearchCV, cross_val_predi...
import argparse import inspect import os from io import StringIO from pathlib import Path from typing import TypeVar, Callable, Optional, Union from pangtreebuild.serialization.json import TaskParameters from pangtreebuild.affinity_tree import parameters as at_params from pangtreebuild.pangenome import graph from pang...
import pandas as pd import numpy as np import re from sklearn.feature_extraction.text import CountVectorizer from sklearn.preprocessing import OneHotEncoder from sklearn.decomposition import PCA , TruncatedSVD import joblib from sklearn.manifold import TSNE # import seaborn as sns import matplotlib.pyplot as ...
# coding=utf-8 # Copyright 2018 The TF-Agents 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...
import os import string import plyr import shutil from pydub import AudioSegment from time import localtime, strftime from mutagen.id3 import ID3, TPE1, TIT2, TRCK, TALB, APIC, TDEN, TDTG, ID3NoHeaderError DEBUG = True DISCO_DIR = os.path.join(os.sep, 'home', 'pi', 'disco') ART_DIR = os.path.join(DISCO_DIR, 'Art') DA...
from collections import OrderedDict import torch import torch.nn as nn from gym import spaces from rl.policies.utils import MLP, BC_Visual_Policy from rl.policies.actor_critic import Actor, Critic from util.gym import observation_size, action_size, goal_size, box_size, robot_state_size, image_size import numpy as np...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 3 09:30:54 2020 @author: jeremiasknoblauch Description: Read in the results and produce plots. Before creating the plots create .txt files holding the results to be plotted. """ import numpy as np import matplotlib.pyplot as plt # global variabl...
# Adapted from https://github.com/maurapintor/Fast-Minimum-Norm-FMN-Attack import math from functools import partial from typing import Optional import torch from torch import nn, Tensor from torch.autograd import grad from adv_lib.utils.losses import difference_of_logits from adv_lib.utils.projections import l1_bal...
import os from makehex.lexer import lex as __lex from makehex.parser import parser as __parser from makehex.tools import xint as __int, CB def __exec(command: str, out, locals_: dict): from os import environ as __env from subprocess import Popen, PIPE env = __env.copy() env["HX_COMMAND"] = command ...
# Copyright 2019 The Android Open Source Project # # 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 ag...
# Common Segmentation Operator implemented by Pytorch # XiangtaiLi(<EMAIL>) import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import BatchNorm2d upsample = lambda x, size: F.interpolate(x, size, mode='bilinear', align_corners=True) def conv3x3(in_planes, out_planes, stride=1): ""...
import torch import torch.nn as nn import torch.optim as optim import torch.utils.data import torchvision.datasets as dset import torchvision.transforms as transforms import torchvision.utils as utils import matplotlib.pyplot as plt import numpy as np from torchvision.utils import save_image import imageio from PIL imp...
import pygame import random pygame.init() bg_color = (192, 192, 192) grid_color = (128, 128, 128) game_width = 10 # Change this to increase size game_height = 10 # Change this to increase size numMine = 9 # Number of mines grid_size = 32 # Size of grid (WARNING: macke sure to change the images dimension...
""" Authors: <NAME>. Copyright: Copyright (c) 2021 Microsoft Research 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, mo...
# Copyright 2013 The Swarming Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 that # can be found in the LICENSE file. """subprocess42 is the answer to life the universe and everything. It has the particularity of having a Popen implementation that can yield o...
#!/bin/env python # # Utilities to generate an automated workflow with GNU make # makefile_init is used to initialize the make, then makefile_append # or makefile_secondary to add commands and makefile_run to run the workflow. # <NAME> # 03/2019 import os import sys from tempfile import NamedTemporaryFile import trace...
import os import csv import pkg_resources import re import traceback import nbformat as nf import nbconvert as nc from urllib.parse import quote as urlquote def isdir(path): ''' Checks whether given path is a directory ''' if not os.path.isdir(path): raise OSError('"' + path + '"' + ' is not ...
# Copyright (c) 2014, Vienna University of Technology (TU Wien), Department # of Geodesy and Geoinformation (GEO). # 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 co...
import base64 import copy import json import os from cloud_info_provider import exceptions from cloud_info_provider.providers import base from cloud_info_provider.providers import static from cloud_info_provider import utils try: import defusedxml.ElementTree from defusedxml import xmlrpc from six.moves i...
from typing import List, Callable import nltk import re from pathlib import Path import re class BaseTokenizer(object): def tokenize_text(self, text: str) -> List[List[str]]: """Splits text into sentences or treats entire text as sentence, splits sentences into tokens. :param text: Text to be t...
import torch import numpy as np import time import tempfile import random from itertools import count import gc import os import glob import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import utils default_variables_dict = utils.get_default_variable_dict() LEAVE_PRINT_EVERY_N_SECS = d...
import numpy as np from scipy.stats import linregress import json import sys import getopt try: from matplotlib import pyplot as plt except Exception: import matplotlib matplotlib.use('pdf') from matplotlib import pyplot as plt def save_plot(alg_name, file_suffix, y_label, legend_list, title_prefix, ...
# SHA-256 hashing function from math import ceil # Constants CHUNK_SIZE_BYTES = 64 ROUND_CONSTANTS = [ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c...
from itertools import chain from django.http import HttpResponse, HttpResponseRedirect from django.utils.safestring import mark_safe from .models import EmailPreferences, Task from django.views.generic.list import ListView from django.views.generic.edit import CreateView, UpdateView, DeleteView from django.forms impor...
# -*- coding: utf-8 -*- import dash import dash_table import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output, State import yaml from iriscovid19 import IRISCOVID19 from iris_python_suite import irisglobal, irisdomestic, irisglobalchart import networkx as nx im...
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import logging import os import platform import shutil import socket import sys import tempfile import time import urllib2 import zipfile from t...
#!/usr/bin/python3 import os import os.path import sys from bottle import abort, redirect, request, route, run, static_file, template SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) STATIC_DIR = '{}/static'.format(SCRIPT_DIR) NAVIGATION_SIZE = 7 PREFETCH_SIZE = 5 ROW_COUNT = 5 LARGE_GALLERY_SIZE = 100 de...
# 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...
from django.http import HttpResponseRedirect from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_exempt from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView try: from extra_views import ModelFormSetView except ImportError: Mode...
import logging import os import signal import subprocess import tempfile from typing import List, Sequence, Optional, Tuple, Union import numpy as np import pandas as pd import prctl import soundfile as sf from d3m import container, utils from d3m.base import utils as base_utils from d3m.metadata import base as metada...
""" For ODIN[1], we simply apply f(x) = [max prob_t(x')]> theta, where - x' is the epsilon-perturbed x in direction that minimizes the CE loss on **the most likely output class**. - For the loss calculation, the output is scaled according to the temperature. we use the s...
# %% """ This module contains copies of the classes SOMToolBox_Parse and SomViz provided by the lecturers. """ import pandas as pd import numpy as np import gzip from scipy.spatial import distance_matrix, distance from ipywidgets import Layout, HBox, Box, widgets, interact import plotly.graph_objects as go class SOM...
#!/usr/bin/python # # -*- coding: utf-8 -*- # """ iptables_converter.py: convert iptables commands within a script into a correspondig iptables-save script default filename to read is rules, to read some other file, append: -s filename output is written to stdout for maximum flexibilty Author...
import requests,urllib,socket,random,time,re,threading,sys,whois,json,os,xtelnet import bs4 from bs4 import BeautifulSoup from bane.payloads import * if os.path.isdir('/data/data/com.termux/')==False: import dns.resolver def get_banner(u,p=23,timeout=3,payload=None): try: return xtelnet.get_banner(u,p=p,timeout=...
# Copyright 2014 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
import torch import torch.nn as nn import torch.nn.functional as F from pytorch_transformers.modeling_bert import BertPreTrainedModel, BertModel from configs.basic_config import config as basic_config class BertFCForMultiLable(BertPreTrainedModel): def __init__(self, config): super(BertFCForMul...
""" Proof of concept for pytest + rich integration. """ import sys import warnings from pathlib import Path from typing import Dict from typing import List from typing import Optional from typing import Sequence from typing import Tuple from typing import Union import attr import pytest from _pytest._code.code import ...
import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms import argparse, time, sys, os, cv2 import numpy as np from dataloader import AlzhDataset import tensorboard_logger as tb_logger from PIL import Image from utils import AverageMeter, accuracy, adjust_learning_rate from net...
""" Debris Module - adapted from JDH Consulting and Martin's work - An instance of Debris class represents a debris item - generate sources of debris. - generate debris items from those sources. - track items and sample target collisions. - handle collisions (impact) """ import logging import nump...
#!/usr/bin/python3 """ This file will replace the real elf with PyActor to extract features """ import os import shutil import shlex import subprocess as sp import LitDriver as drv import ServiceLib as sv import multiprocessing import fileinput class Singleton(type): _instances = {} def __call__(cls, *args, **...
# Copyright 2017 ProjectQ-Framework (www.projectq.ch) # # 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 app...
# -*- test-case-name: twisted.web.test.test_xmlrpc -*- # # Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. # """Test XML-RPC support.""" import xmlrpclib from twisted.web2 import xmlrpc from twisted.web2.xmlrpc import XMLRPC, addIntrospection from twisted.internet import defer from...
import torch import torch.nn as nn from torch.autograd import Variable import math import torch.nn.functional as F class GMMLogLoss(nn.Module): ''' compute the GMM loss between model output and the groundtruth data. Args: ncenter: numbers of gaussian distribution ndim: dimension of ...
# Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Interfaces, classes and types for Device API.""" from cros.factory.utils import sys_interface from cros.factory.utils import type_utils # Default co...
import fcntl import os import select import shlex import signal import threading import time from subprocess import Popen, PIPE from performance.driver.core.events import Event, LogLineEvent, ParameterUpdateEvent, TeardownEvent, StartEvent from performance.driver.core.template import TemplateString, TemplateDict from...
from __future__ import print_function import re from fabric.api import hide from six.moves.urllib.request import urlopen from burlap.constants import * from burlap import ContainerSatchel from burlap.decorators import task def _to_int(val): try: return int(val) except ValueError: return val...
# Author: <NAME>, <<EMAIL>> # # License: BSD (3-clause) import numpy as np from numpy.testing import assert_array_equal from nose.tools import assert_raises, assert_true, assert_equal from mne.utils import requires_version from mne.decoding.search_light import SlidingEstimator, GeneralizingEstimator from mne.decoding...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This function simulates a variable speed pumping system. First, you enter in the pump and system curve information. The function then calculates a curve relating rpm to flow and rpm to kW. This is useful for estimating the flow of variable speed pumping systems w...
""" This script converts FGE data provided in the LFCA ASCII format to a NetCDF format that mimics the production format. It doesn’t have everything in the production format, but has everything from the ASCII files that overlaps the production format, and uses the same variable names. Author: <NAME>, 20 April 2017 ...
# hyperparameter optimization from ray import tune from ray.tune.schedulers import ASHAScheduler from model import GRU # set processing device import torch import torch.nn as nn device = torch.device("cuda:0") if torch.cuda.is_available() else torch.device("cpu") # data from torchtext.legacy.data import Field, Tabu...
# -*- coding: utf-8 -*- from kivy.app import App from kivy.uix.label import Label from kivy.uix.boxlayout import BoxLayout from kivy.uix.scrollview import ScrollView from kivy.uix.gridlayout import GridLayout from kivy.clock import Clock from kivy.uix.textinput import TextInput from kivy.uix.button import Button from ...
from torch.utils.data import Dataset from utils.visual_augmentation import ColorDistort, pixel_jitter import numpy as np import copy import json import random import cv2 from utils.augmentation import Rotate_aug, Affine_aug, Mirror, Padding_aug, Img_dropout from utils.headpose import get_head_pose import time from util...