text
stringlengths
3.07k
22.1k
import numpy as np from utils import constants import atm def get_path_loss(range_m, freq_hz, tx_ht_m, rx_ht_m, include_atm_loss=True, atmosphere=None): """ Computes the propagation loss according to a piece-wise model where free space is used at close range, and two-ray is used at long range. The cross-...
import numpy as np import torch import torch.nn as nn import torch.optim as optim import torchvision import torchvision.transforms as transforms import time import pathlib import os import pickle import random from tqdm import tqdm import pdb class AverageMeter(object): """Computes and stores the average and curre...
import email.utils import smtplib import os, mimetypes from datetime import date from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.image import MIMEImage from email.mime.audio import MIMEAudio from email.mime.base import MIMEBase from email.mime.application import MIMEA...
import bpy, random class ColouredCube(): def __init__(self, x, y, z, cubesize, colour): bpy.ops.mesh.primitive_cube_add(size=cubesize, enter_editmode=False, location=(x, y, z)) print("Number of objects:", len(bpy.data.objects)) self.colours = ["Red", "Green", "Blue", "Black"...
# using SendGrid's Python Library # https://github.com/sendgrid/sendgrid-python import os from sendgrid import SendGridAPIClient from sendgrid.helpers.mail import * import logging import json import simplejson import websockets import datetime import asyncio import time import numpy as np from pathlib import Path # CO...
# Imports here import matplotlib.pyplot as plt import seaborn as sns from PIL import Image import json import numpy as np import os, random import time import torch from torch import nn from torch import optim import torch.nn.functional as F from torchvision import datasets, transforms, models import argparse def loa...
#!/usr/bin/env python3 import argparse import threading from time import sleep import cv2 import depthai as dai import socket from common import target_finder from common.config import NN_IMG_SIZE from pipelines import object_tracker_detection, object_edge_detection import logging from common.mjpeg_stream import Mj...
"""Supernet builder.""" import numbers from torch import nn import functools from models.mobilenet_base import _make_divisible from models.mobilenet_base import ConvBNReLU from models.mobilenet_base import get_active_fn from models.mobilenet_base import get_block import torch.nn.functional as F __all__ = ['MobileNetV3...
import numpy as np from scipy.integrate import odeint import deepxde as dde from deepxde.backend import tf def apoptosis_model( t, x0, k1, kd1, kd2, k3, kd3, kd4, k5, kd5, kd6, ): def func(x, t): v4_1 = kd1 * x[4] v4_2 = kd2 * x[4] v5_3 = kd3 * x[5] v5_4 = kd4 * x[5] v...
import time, abc, threading, logging, logging.config from rp1controller.communications import RP1Server from rp1controller.trajectory_planners import LocalVelocityControl, Target, WorldVelocityControl, WorldPoseControl from rp1_gamepad import GamepadInput from rp1controller.rp1config import RP1Configuration from v...
from my_utils import * def args_parser(): parser = argparse.ArgumentParser(description='RL and IL cores.') parser.add_argument('--env_id', type=int, default=4, help='Id of environment') parser.add_argument('--render', type=int, default=0, help='render the environment during testing') parser.add_argume...
#! /usr/bin/env python # ______________________________________________________________________ """ The built-ins of the Mython compile time environment. """ # ______________________________________________________________________ # Module imports import sys as _sys import ast as _pyast import os as _os import stat as...
from nest_py.core.jobs.jobs_logger import log from nest_py.core.jobs.checkpoint import CheckpointTimer import nest_py.ops.container_users as container_users import nest_py.core.jobs.jobs_auth as jobs_auth import nest_py.core.db.nest_db as nest_db import nest_py.omix.jobs.biom_etl as biom_etl import nest_py.omix.jobs.f...
import re import itertools as it import numpy as np import pandas as pd from string import punctuation import unicodedata from sklearn.feature_extraction.text import CountVectorizer import nltk from nltk.tokenize import TweetTokenizer # import tweepy import matplotlib.pyplot as plt from matplotlib.ticker import Func...
""" Based on ExpResNet architecture (see https://www.biorxiv.org/content/10.1101/2020.06.21.163956v1.full.pdf) A residual architecture with a skip connection for cell type embeddings. The forward method accepts the cell type embeddings to use during training, as well as cell targets which select the cell types (and h...
from collections import namedtuple import csv # import torch # import torch.nn as nn class WalsInfo: def __init__(self): # Maps between WALS code and ISO 639-3. # e.g. "aar" <-> "aiw". Sometimes the ISO 639-3 code is missing, # which would just be the empty string. self.wals_code_...
from behave import given, when, then from hamcrest import assert_that, equal_to from launchkey.entities.service import GeoFence, AuthMethod, AuthMethodType, \ Requirement, AuthResponseReason # Auth Creation @given("I made an Authorization request") @when("I make an Authorization request") def make_auth_for_cu...
import time import os import json import paho.mqtt.client as mqtt import paho.mqtt.subscribe as subscribe import RPi.GPIO as GPIO # Constants DEG = u'\N{DEGREE SIGN}' # Globals hvac_mode = "HEAT" set_temp = 65.0 fan_mode = "AUTO" temp_indoor = 65.0 def on_connect(client, userdata, flags, rc): if rc == 0: ...
from IMLearn.utils import split_train_test from IMLearn.learners.regressors import LinearRegression from typing import NoReturn import numpy as np import pandas as pd import plotly.graph_objects as go import plotly.express as px import plotly.io as pio pio.templates.default = "simple_white" DROP = ["id", "price", "d...
from finbot.apps.snapwsrv.schema import ( TakeSnapshotRequest, TakeSnapshotResponse, SnapshotResultsCount, SnapshotSummary, ) from finbot.clients.finbot import FinbotClient, LineItem from finbot.providers.plaid_us import pack_credentials as pack_plaid_credentials from finbot.core import secure, utils, f...
import abc import logging import sqlite3 import unittest from typing import Union assert sqlite3.sqlite_version_info >= ( 3, 24, ), "Your database engine (not the python package) is out of date." log = logging.getLogger(__name__) # Foreign key flags Restrict = "restrict" SetNull = "set null" SetDefault = "se...
import contextlib import json import logging import traceback from collections import defaultdict from pathlib import Path import click from filelock import FileLock from src.anima_site import bangumi_moe_site from src.database import (bangumi_moe_database, download_database, source_database...
# -*- coding: utf-8 -*- import json from django.urls import reverse_lazy from django.views.generic import TemplateView from django.views import View from django.conf import settings from django.http import HttpResponse from django.utils.translation import gettext_lazy as _ from TWLight.applications.models import Appl...
import numpy as np import os, sys import contextlib import io import re import h5py import subprocess import fnmatch from spyci import spyci import matplotlib.pyplot as plt import matplotlib.ticker import matplotlib from matplotlib.ticker import FuncFormatter def create_sim_object(simulator: str): """ Cr...
import csv import random import matplotlib.pyplot as plt import matplotlib.patches as mpatches # region variables # test each k... K_MIN = 1 # ...from K_MIN... K_MAX = 20 # ...to K_MAX... N_TEST = 25 # ... N_TEST times. accuracies = [0] * (K_MAX - K_MIN + 1) # to keep the accuracy for each k k = 3 # ...
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe, os, json from frappe.custom.doctype.custom_field.custom_field import create_custom_fields from frappe.permissions import add_permission,...
""" Genetic algorithm implementation for training a neural network - doesnt work, probably has some issues? """ import time import threading import math import random import tensorflow as tf import tensorflow.contrib.slim as slim from tensorflow.examples.tutorials.mnist import input_data import numpy as np INPUT_DIMEN...
from unityagents import UnityEnvironment import numpy as np from agent import MultiAgentDeepDeterministicPolicyGradient import torch import time from collections import deque import numpy as np from tensorboardX import SummaryWriter # Reference/Credit Stats class & reporting mechanisms: danielnbarbosa/drlnd_collab...
""" CLI for the deliver subcommand """ import click import logging from taca.utils.misc import send_mail from taca.utils.config import load_yaml_config from .deliver import deliver as _deliver from .deliver import deliver_grus as _deliver_grus logger = logging.getLogger(__name__) ####################################...
#!/usr/bin/env python3 import base64 import os import io import re import sqlite3 import json import requests import xml.etree.ElementTree as ET from datetime import datetime from collections import deque from urllib.parse import quote_plus, unquote_plus from flask import Flask, request, redirect, url_for, flash, Respo...
import logging import socket import ssl import struct import warnings import zlib import io import os import platform from functools import wraps from threading import local as thread_local from .rencode import dumps, loads DEFAULT_LINUX_CONFIG_DIR_PATH = '~/.config/deluge' RPC_RESPONSE = 1 RPC_ERROR = 2 RPC_EVENT = ...
import datetime import numpy as np import os import sys sys.path.append('.') from core.utils.data_utils.image_io_utils import load_image, save_to_image, save_to_image_gdal from core.configures import generate_dadaset_config def generate_dataset_random(image_paths, label_paths, ...
from migen.fhdl.std import * from migen.genlib.misc import optree control_tokens = [0b1101010100, 0b0010101011, 0b0101010100, 0b1010101011] class Encoder(Module): def __init__(self): self.d = Signal(8) self.c = Signal(2) self.de = Signal() self.out = Signal(10) ### ...
import os import numpy as np import json import shutil from nipype.interfaces.base import CommandLine, CommandLineInputSpec from nipype.interfaces.base import (TraitedSpec, File, traits, InputMultiPath, BaseInterface, OutputMultiPath, BaseInterfaceInputSpec, isdefined) import pyminc.volumes.factory as pyminc class Mod...
import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as clr from scipy import signal import tensorflow as tf # Number of sections M = 3 # Sample rate f_s = 24000 # Passband center frequency f0 = 9000 # Number of frequencies to compute N = 2048 section_colors = np.zeros([M, 3]) for k in rang...
# Copyright 2016 Google 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 applicable law or ag...
# delicatessen from . import tools # Standard library import pathlib import sys from collections import OrderedDict # Third-party import astropy.table as at import numpy as np import pandas as pd import requests from io import BytesIO from bokeh.io import curdoc from bokeh.layouts import column, row, Spacer from boke...
import argparse import datetime import random import time from pathlib import Path import numpy as np import torch from torch.utils.data import DataLoader from utils import misc as utils from datasets.StaticDataset import build_dataset, collate_fn from datasets import samplers from engine import train_one_epoch from mo...
# SPDX-License-Identifier: MIT # Copyright (c) 2021 ETH Zurich, <NAME> import numpy as np from morinth.jacobian import ApproximateJacobian from morinth.newton import Newton from morinth.butcher import ButcherTableau class TimeIntegration(object): """Interface for time-integration.""" def __init__(self, bc, ...
# -*- coding: utf-8 -*- # Copyright 2021 VMware, Inc. # SPDX-License-Identifier: MIT import re import sys import time import requests import hashlib from datetime import datetime, timedelta from cbc_sdk import CBCloudAPI from cbc_sdk.enterprise_edr import Feed, Report class CarbonBlackCloud: ''' This i...
# pylint: disable=missing-docstring, maya-short-flag, invalid-name, unused-argument """Symmetry stuff. :created: 14/01/2019 :author: <NAME> <<EMAIL>> """ from functools import partial from PySide2 import QtWidgets from maya import cmds import pymel.core as pm import pymel.core.datatypes as dt import pymel.core.nodety...
import os from flask import Blueprint, render_template, request, url_for, redirect, session from MapMyNotesApplication.models.date_time_helper import DateTimeHelper from MapMyNotesApplication.models.google_calendar_service import GoogleCalendarService from MapMyNotesApplication.models.google_services_helper import Go...
# Copyright (c) 2020. <NAME>. hk2699 at caa dot columbia dot edu. import matplotlib as mpl import numpy as np import numpy_groupies as npg import statsmodels.api as sm from matplotlib import pyplot as plt from data_2d import consts, load_data from lib.pylabyk import plt2, np2 def get_coefs( dim, dif_other,...
import argparse from types import FunctionType import torch import torch.nn as nn import numpy as np # type: ignore import torch.optim as optim import torch.backends.cudnn as cudnn import os import os.path as osp import matplotlib.pyplot as plt # type: ignore from src.config import * from util.typing.basic import * fr...
import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms from torch.utils.data import DataLoader import numpy as np from skimage.transform import rotate import random from typing import List from copy import deepcopy class RotatedCIFAR10Handler: """ Object for the CIFA...
import datetime from Statistics.statistics import StatisticsService def menu(): print("[0] Exit") print("-------STUDENT OPERATIONS-----------") print("[1] Add a student") print("[2] Remove a student") print("[3] Update student") print('[4] Display students list') print("-------ASSIGNMENT ...
import os import subprocess from platform import system as operating_system import threading from numpy.lib.function_base import average def clear_static(): for root, dirs, files in os.walk('src/static'): for file in files: #append the file name to the list print(os.path.j...
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
# -*- coding: utf-8 -*- from enum import Enum, IntEnum from homeassistant.components.climate.const import \ HVAC_MODE_COOL, HVAC_MODE_FAN_ONLY, HVAC_MODE_HEAT, HVAC_MODE_DRY, HVAC_MODE_AUTO, HVAC_MODE_HEAT_COOL class EnumCmdType(IntEnum): AIR_CAPABILITY_QUERY = 6 AIR_CON_CAPABILITY_V2 = 35 AIR_CON_CL...
#!/usr/bin/env python # coding: utf-8 # # Copyright (c) 2020 <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 to use, co...
import argparse import pathlib import json import requests from folioclient.FolioClient import FolioClient class Purge: def __init__(self, folio_client, path, set_name): self.folio_client = folio_client self.path = path self.set_name = set_name print("initializing Purge") def ...
""" pyart.io._sigmet_noaa_hh ======================== Functions needed for reading Sigmet files from the airborne radar located on NOAA's Hurricane Hunter aircraft. .. autosummary:: :toctree: generated/ _decode_noaa_hh_hdr _georeference_yprime """ import numpy as np from ._sigmetfile import bin4_to_ang...
"""Retokenization helpers This module provides helpers for projecting span annotations from one tokenization to another. Notes: * Code is ported from https://github.com/nyu-mll/jiant/blob/master/jiant/utils/retokenize.py * Please keep this code as a standalone utility; don't make this module depend on jiant m...
import os import sys import win32com.client class PSDBase(object): RESIZE_DEFAULT = 1 RESIZE_STRETCH_CONSTRAINED = 2 def __init__(self,*args,**kwargs): self.resize_method = PSDBase.RESIZE_DEFAULT def open(self,path): pass def close(self,doc): ...
r"""CrowdStrike Falcon Bulk User Maintenance utility. ___ ___ ___ ___ __ | Y .-----.-----.----.| Y .---.-.-----.---.-.-----.-----.--------.-----.-----| |_ |. | |__ --| -__| _||. | _ | | _ | _ | -__| | -__| ...
#!/usr/bin/python3 ''' Copyright (c) 2016 - 2019 Regents of the University of Minnesota and Bolder Flight Systems Inc. MIT License; See LICENSE.md for complete details Author: <NAME>, <NAME> ''' # import libraries import h5py import numpy as np import struct import argparse import os import re import sys # class for...
#!/usr/bin/env python import argparse import json import requests from sys import exit as exit_with from sys import argv as sys_argv # meh? from CONST import supported_currencies description = '''Convert currency using http://fixer.io/ - when no parameters are provided script returns exchange rates for 1 EUR - whe...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils.spectral_norm as spectral_norm def SnConv1(in_channel, out_channel, bias = True): return spectral_norm(nn.Conv2d(in_channel, out_channel, 1, 1, bias = bias)) def SnConv3(in_channel, out_channel, bias = True): retu...
import argparse parser = argparse.ArgumentParser(description='Sequence Modeling - The Adding Problem') parser.add_argument('--batch_size', type=int, default=32, metavar='N', help='batch size (default: 32)') parser.add_argument('--cuda', action='store_false', help='use CUDA (def...
import re from argparse import ArgumentParser, FileType, ArgumentDefaultsHelpFormatter from datetime import datetime from pathlib import Path import typing from adding_puzzle import AddingBoardGraph from bees import BeesFitnessCalculator, BeesProblem from book_parser import parse, Styles from domino_puzzle import Boa...
import numpy as np from numba import jit from functools import reduce @jit(nopython=True) def where(element, test_elements, assume_sorted=True): """Return indices of `test_element` containing each element of `element` (np.nan otherwise), for case where `test_elements` is an array of unique values. Broadca...
# # Librairie permettant de gerer le capteur de temperature # et d'humidite SHT21 / HTU21 # Tester sur NodeMCU Lolin # # Auteur : iTechnoFrance # # from machine import I2C, Pin # i2c = I2C(0, scl=Pin(22), sda=Pin(21)); import time _address_sht21 = 0x40 # adresse du capteur SHT21 sur le bus I2C _soft_reset_sht21 = b...
# Auto-anchor utils import numpy as np import torch import yaml from scipy.cluster.vq import kmeans from tqdm import tqdm import math def check_anchor_order(anchors, anchor_grid, stride): # Check anchor order against stride order for YOLOv5 Detect() module m, and correct if necessary a = anchor_grid.prod(-1)...
# calculate filterbank features. Provides e.g. fbank and mfcc features for use in ASR applications # Author: <NAME> 2012 from __future__ import division import numpy from scipy.fftpack import dct import decimal import math logSpecDbConst = 10.0 / numpy.log(10.0) * numpy.sqrt(2) def mcd(mfcc1, mfcc2): # n...
import glob from subprocess import Popen, PIPE, STDOUT import os from backend.smc2py import parseEngineStdout import math import copy # validate data and proxy to real functions def execute(data): models = list_models()['models'] if 'type' not in data: return {'error': 'No type recieved'} if data[...
import os import scipy import logging import numpy as np import SimpleITK as sitk from keras.models import Model from keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D, Cropping2D, ZeroPadding2D from keras.layers.advanced_activations import LeakyReLU from keras.layers.merge import concatenate from keras imp...
import torch import torch.nn as nn from torch.autograd import Variable def fill_fc_weights(layers): for m in layers.modules(): if isinstance(m, nn.Conv2d): if m.bias is not None: nn.init.constant_(m.bias, 0) class PadNet(nn.Module): def __init__(self, opt, head_convs, head...
""" This module contains data structures useful for decoding in the context of SMT. @author waziz """ __author__ = 'waziz' import re import itertools import numpy as np from collections import defaultdict from operator import xor from chisel.semiring import CountSemiring, ProbabilitySemiring from chisel.util import np...
from core import * from ngen import * from core import module_pool_class_registry def register_module(m): module_pool_class_registry[m.__name__] = m class OutputModule(Module): def __init__(self, mp): Module.__init__(self, mp) self.input = Input(self) self.name = StringProperty() ...
# -*- coding: utf-8 -*- # # satcfe/base.py # # Copyright 2015 Base4 Sistemas Ltda ME # # 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 # # Unl...
""" Routines to compute halo shapes. And plotting ellipsoids in 3d and 2d. """ import numpy as np from scipy.spatial import ConvexHull from scipy import linalg from scipy.spatial.transform import Rotation as R def shells(pos, width, r, q, s): r_shell = np.sqrt(pos[:,0]**2.0 + pos[:,1]**2.0/q**2.0 + pos[:,2]**2.0...
# Code copied from https://raw.githubusercontent.com/DLR-RM/stable-baselines3/master/stable_baselines3/ppo/ppo.py import warnings from typing import Any, Dict, Optional, Type, Union import numpy as np import torch as th from gym import spaces from torch.nn import functional as F from stable_baselines3.common import ...
from __future__ import division, absolute_import, print_function from rdkit import Chem, Geometry from simtk.openmm import app, Vec3 from simtk import unit import itertools import pyparsing as pyp from itertools import groupby proteinResidues = ['ALA', 'ASN', 'CYS', 'GLU', 'HIS', 'LEU', 'MET', 'PRO'...
#!/usr/bin/python # -*- coding: utf-8 -*- import datetime import json import os import random from CTFd import create_app from CTFd.models import Teams, Solves, Challenges, WrongKeys, Keys, Awards app = create_app() USER_AMOUNT = 50 CHAL_AMOUNT = 23 AWARDS_AMOUNT = 5 challenges_json_file = os.path.join('data', 'ch...
# -*- coding: utf-8 -*- # opts.py """Compute classification accuracy and consistency statistics. """ import os import sys import numpy as np import numpy.ma as ma import pandas as pd from scipy import stats import damon1.core as dmn import damon1.tools as dmnt np.seterr(all='ignore') import matplotlib.pyplot as plt ...
#!/usr/bin/env python # -*- coding: utf-8; -*- # Copyright (c) 2020, 2022 Oracle and/or its affiliates. # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ import ast import json import oci import os import pathlib import re import shutil import sqlalchemy from oc...
#!/usr/bin/env python # # Goal: To capture axial views of LFMs. # # Created: 2018-10-30 # Modified: 2018-10-31 # Contributors: <NAME> import os import numpy as np import commands import sys import matplotlib.pyplot as plt from skimage.measure import find_contours from scipy.ndimage.morphology import binary_dilation f...
# Copyright 2020 <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, soft...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 18 21:45:40 2018 @author: BallBlueMeercat """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import time import os.path import results import tools import datasim import stats # Number of datapoints to be simulated and numb...
# -*- coding: utf-8 -*- """ Created on Sat Jun 10 00:17:44 2017 @author: <NAME> """ import numpy as np import matplotlib.pyplot as plt from scipy import optimize charge_density = 4.7 # ligands per nm^2 k_b = 1.38e-23 # Boltzmann constant, J/K N_A = 6.02214e23 # Avogadro's number Bjerr_len = 0.7e-9 # in water, in nano...
#!/usr/bin/python3 import os import itertools import multiprocessing from Bio import SeqIO, AlignIO from BCBio import GFF _MUSCLE_EXE = '/home/ante/Programs/alignment/MUSCLE/muscle3.8.31/muscle' _CLUSTALO_EXE = '/home/ante/bin/clustalo' _CLUSTALO_THREADS = multiprocessing.cpu_count() _concatenated_prefix = 'concate...
#!/usr/bin/python3 import pytest from brownie import accounts, compile_source module_source = """ pragma solidity 0.4.25; interface IModular { function setHook(bytes4, bool, bool) external returns (bool); function setHookTags(bytes4, bool, bytes1, bytes1[]) external returns (bool); function clearHookTag...
from __future__ import annotations import ast import functools import json from itertools import groupby from os.path import abspath, dirname, exists, join from typing import Any, Sequence import numpy as np import pandas as pd import torch from pymatgen.core import Structure from torch import LongTensor, Tensor from...
#!/usr/bin/python3 # # Copyright 2012 <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...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from sklearn.datasets import fetch_mldata import matplotlib matplotlib.use('agg') from matplotlib import pyplot as plt import numpy as np import cv2 import mxnet as mx from datetime import datetime from ft_notify import send_notification mnist = fetch_mldata('MNIST origi...
from .. import utils from . import fmt from . import utils as det_utils incorrect_light_1569_message = 'Object "{0}" has incorrect light format: ' \ '"Builds 1096-1558". Must be "Builds 1569-CoP"' incorrect_light_1096_message = 'Object "{0}" has incorrect light format: ' \ '"Builds 1569-CoP". Must be "Builds...
import torch import random import numpy as np import cv2 from .util import utilities as util_ ##### Useful Utilities ##### def array_to_tensor(array): """Convert a numpy.ndarray to torch.FloatTensor. numpy.ndarray [N, H, W, C] -> torch.FloatTensor [N, C, H, W] OR numpy.ndarray [H, W, C] -> torc...
# Functions needed for training models from __future__ import unicode_literals, print_function, division from io import open import unicodedata import string import re import random from random import shuffle import torch import torch.nn as nn from torch.autograd import Variable from torch import optim import torch.n...
import itertools import random class Minesweeper(): """ Minesweeper game representation """ def __init__(self, height=8, width=8, mines=8): # Set initial width, height, and number of mines self.height = height self.width = width self.mines = set() # Initializ...
import torch import torch.nn.functional as F from .torchncon import ncon from .ncon import ncon as ncon0 import numpy as np from numpy import linalg as LA from scipy.sparse.linalg import LinearOperator from scipy.sparse.linalg import eigs from .svd import SVD svd_ = SVD.apply def normal(tensor, type): r"""renormal...
"""Tests for variantkey rsidvar module.""" # test_rsidvar.py # @category Libraries # @author <NAME> <<EMAIL>> # @copyright 2017-2018 GENOMICS plc # @license MIT (see LICENSE) # @link https://github.com/genomicsplc/variantkey import variantkey as bs import os import time from unittest import TestCase ...
import math import statistics import warnings import numpy as np from hmmlearn.hmm import GaussianHMM from sklearn.model_selection import KFold from asl_utils import combine_sequences class ModelSelector(object): ''' base class for model selection (strategy design pattern) ''' def __init__(self, all...
d# gradcam_experiments.py # runs the experiments in section 5.2 # visualizes the disagreement and confusing input elements using GradCam import cv2 import os import torch from torchvision.utils import save_image import numpy as np import torch.nn as nn from shutil import copyfile from torch.autograd import Variabl...
# This script generates an overview of the angular component hierarchy import os import os.path import re from xml.dom import minidom class Component: def __init__(self, tsFilename: str, templateFilename: str, selector: str, subcomponents: list, isRoot: bool): self.TsFilename = tsFilename ...
#!/usr/bin/python # # Reads labels as polygons in JSON format and converts them to instance images, # where each pixel has an ID that represents the ground truth class and the # individual instance of that class. # # The pixel values encode both, class and the individual instance. # The integer part of a division by 10...
""" validating FLOPs and memory if is_save_ply_label = True: Pth -> PlyLabel """ import torch import torch.nn as nn import numpy as np import glob import math import sparseconvnet as scn import iou import torch.utils.data import os import time import sys import psutil from plyfile import PlyData, PlyElement...
from enum import Enum from pprint import pprint from math import sqrt import time import copy from itertools import groupby from operator import itemgetter class Map(Enum): NONE = 0 # 何もない TRIED = 1 # 探索済 ROUTE = 2 # ルートとして選択 WALL = 3 # 壁 START = 4 # スタート地点 GOAL = 5 # ゴール地点 cla...
""" This file contains the implementation of the Tensor class, the main building block of the autodiff module. """ # Standard libraries from typing import Union, List # Third-party libraries import numpy as np # Project files import autodiff.constants as const class Tensor: """ A wrapper class around np.nd...
from __future__ import annotations from typing import Optional, Tuple, TYPE_CHECKING import game.color as color import game.exceptions as exceptions if TYPE_CHECKING: from engine import Engine from entity import Actor, Entity, Item class Action: def __init__(self, entity: Actor) -> None: super(...
# -*- coding: utf-8 -*- """ Copyright 2021 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...