text stringlengths 3.07k 22.1k |
|---|
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
# Copyright 2017 The Abseil 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 or agreed to in ... |
"""Draw polygon regions of interest (ROIs) in matplotlib images,
similar to Matlab's roipoly function.
"""
import sys
import logging
import warnings
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.path import Path as MplPath
from matplotlib.widgets import Button
logger = logging.getLogger(__name__... |
#
# TP-Link Wi-Fi Smart Plug Protocol Client
# For use with TP-Link HS-100 or HS-110
#
# by <NAME>
# Copyright 2016 softScheck GmbH
#
# Modified by <NAME>. (colingit93), 2019
# Python 3 - extended version for energy monitoring with visualisation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ... |
# Author: <NAME> at 12/07/2021 <<EMAIL>>
# Licence: MIT License
# Copyright: <NAME> (2018) <<EMAIL>>
from collections import defaultdict, deque, namedtuple
from typing import Dict, List
import numpy as np
from .._base import _Node
from . import safe_defaultdict_copy
from .validation import is_mapping
DataPoint = nam... |
import collections
from flatfeature import Bed
import sys
import os
import os.path as op
sys.path.insert(0, os.path.dirname(__file__))
sys.path.append("scripts/")
from find_cns import get_pair
#same as brents assign just added coge links.. may want to add otption for links
def cns_id(cns_dict):
c = cns_dict
... |
"""
Script for generating synthetic datasets from a single image and landmarks.
The output is set of geometrical deformed images with also change color space
and related computed new landmarks.
Sample run::
python create_real_synth_dataset.py \
-i ../data-images/images/Rat-Kidney_HE.jpg \
-l ../da... |
# -*- coding: utf-8 -*-
import sys
sys.path.append('../')
import torch
import numpy as np
from game.engine import Agent, Game, GameState, Card
from data.DataLoader import label_int2str
import model.resnet as resnet
import argparse
parser = argparse.ArgumentParser(
description='ArgParser for the eval on engine.')... |
import asyncio
import binascii
import logging
import random
import time
from collections import namedtuple
from urllib.parse import quote_plus, urljoin, urlparse
import aiohttp
from aiohttp.helpers import sentinel
from queuelib import queue
from scrapy.http.request import Request
from scrapy.utils.defer import maybeDe... |
import io
import os
import random
import shutil
import string
import uuid
import json
from mimetypes import guess_type
import bleach
import filetype
from flask import (Blueprint, Flask, after_this_request, redirect,
render_template, request, send_file, session, url_for)
from flask_socketio import So... |
# -*- coding: utf-8 -*-
"""
@Time : 2017/11/1 13:14
@Author : Elvis
"""
"""
logger.py
"""
# Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
# import tensorflow as tf
# import numpy as np
# import scipy.misc
import sys
import os
import time
try:
from StringIO import Stri... |
'''
a point cloud projector based on np
'''
import numpy as np
from COTR.utils import debug_utils, utils
def render_point_cloud_at_capture(point_cloud, capture, render_type='rgb', return_pcd=False):
assert render_type in ['rgb', 'bw', 'depth']
if render_type == 'rgb':
assert point_cloud.shape[1] == ... |
"""Repair data on subscriber.
Walks tables by primary key and searcher
missing inserts/updates/deletes.
"""
import sys, os, time, skytools
try:
import subprocess
have_subprocess = True
except ImportError:
have_subprocess = False
from syncer import Syncer
__all__ = ['Repairer']
def unescape(s):
re... |
#!/usr/bin/env python
"""
@package mi.dataset.parser
@file mi-dataset/mi/dataset/parser/ctdbp_p.py
@author <NAME>, <NAME>
@brief Parser for the ctdbp_p, dosta_abcdjm_ctdbp_p and flord_g_ctdbp_p dataset drivers.
This file contains code for the CTDBP-P Common parser and code to produce data particles
for the intrument ... |
from discord.ext import commands
import urllib.parse as parse
import discord
import subprocess
import re
import io
import datetime
import contextlib
_code_block_regex = re.compile(r"\s*```(?:\S*?\n)?([\s\S]+?)```\s*", re.I)
_inline_code_regex = re.compile(r"(?<!`)(``?)(?!`)([\s\S]+?)(?<!`)\1(?!`)")
def _clang_format(... |
import numpy as np
import pandas as pd
from typing import Dict
from cascade_at.core.log import get_loggers
from cascade_at.inputs.utilities.gbd_ids import make_age_intervals, make_time_intervals
from cascade_at.inputs import InputsError
LOG = get_loggers(__name__)
class CovariateInterpolationError(InputsError):
... |
import glob
import os
import torch
import tqdm
from torch.nn.utils import clip_grad_norm_
from torch.cuda.amp import autocast, GradScaler
import time
import datetime
from pcdet.utils import common_utils
from pcdet.datasets import build_dataloader
from tools.val_utils import val_utils
def train_one_epoch(model, optim... |
import re
import typing
OUTPUT_VAR = "_output_"
INDENT = 1
UNINDENT = -1
INDENT_SPACES = 2
INDEX_VAR = "index"
class LoopVar:
def __init__(self, index: int):
self.index = index
self.index0 = index
self.index1 = index + 1
class CodeBuilder:
"""Manage code generating context."""
... |
from functools import partial, lru_cache
from typing import Any, Callable, Dict, List, Union
from opyapi.json_schema import JsonSchema
from opyapi.errors import ValidationError, AdditionalItemsValidationError
from opyapi.validators import validate_equal
from opyapi.validators.array_validators import (
validate_arr... |
import cv2
import numpy as np
class BirdsEyePerspectiveTxfrm():
#http://www.coldvision.io/2017/03/02/advanced-lane-finding-using-opencv/
def compute_perspective_transform(self, binary_image):
# Get input image dimensions
shape = binary_image.shape[::-1] # (width,height)
w = shape[0]
... |
import pytest
from nonebug import App
from utils import load_plugin, make_fake_event, make_fake_message
@pytest.mark.asyncio
async def test_depend(app: App, load_plugin):
from nonebot.params import DependParam
from plugins.param.param_depend import (
ClassDependency,
runned,
depends,... |
import pandas as pd
import numpy as np
from hpfrec import HPF
import math
from sklearn.model_selection import train_test_split
"""
df_a = pd.read_csv("data/preprocess_data/preproc_100k_exposure_data.csv", header=0)
df_a = df_a.sort_values("user_id").reset_index(drop=True)
df_a = df_a.drop(["user_id"], axis=1)
df_y ... |
import time
import datetime
import json
from bcreg.bcregistries import BCRegistries, system_type, MIN_START_DATE, MAX_END_DATE
from bcreg.eventprocessor import EventProcessor
from bcreg.tests.sample_corps_history import sample_history_corps
def adapt_decimal(d):
return str(d)
def convert_decimal(s):
return... |
# -*- coding: utf-8 -*-
from scipy.sparse import coo_matrix
import numpy as np
from numpy import ndarray
from dewloosh.math import squeeze
from dewloosh.math.array import isintegerarray, isfloatarray, \
isboolarray, bool_to_float, atleastnd
from dewloosh.math.linalg.sparse.utils import lower_spdata, upper_spdata
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from data_utils import *
import os.path
import numpy as np
import tensorflow as tf
import argparse
import sys
from tqdm import tqdm
from snidsa_model import SNIDSA
class Config(object):
"""Configuration of model"""
num_layers = 1
batch_size = 32
embedding_dim =... |
import logging
import json
import unittest
import time
import uuid
import os
import urllib.parse as urlparse
from operators import DelayedTupleSourceWithLastTuple
from requests import exceptions
from streamsx.topology.tester import Tester
from streamsx.topology import topology, schema
from streamsx.topology.context im... |
import sys
import json
import logging
from typing import TYPE_CHECKING
import yaml
import click
from simple_di import inject
from simple_di import Provide
from rich.table import Table
from rich.console import Console
from bentoml.bentos import import_bento
from bentoml.bentos import build_bentofile
from ..utils impo... |
import re
from operator import itemgetter
from pathlib import Path
from lxml import html
from lxml.html.clean import Cleaner
from datetime import datetime
from urllib.parse import urlparse, parse_qs
from .utils import get_or_create_downloads_folder
from aafinder.models import (
MeetingType, Location,
Meeting, M... |
#!/usr/bin/env python
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import seaborn as sns
from argparse import ArgumentParser
from itertools import combinations
from sklearn.datasets import load_boston
import plotly
import plotly.plotly as py
... |
from __future__ import print_function
import argparse
import gc
from importlib import import_module
import json
import os
import resource
import sys
import time
import traceback
import boto3
from emulambda.timeout import timeout, TimeoutError
from emulambda.render import render_result, render_summary
__author__ = 'do... |
"""Various utility functions."""
from contextlib import contextmanager
from contextvars import copy_context
from io import BytesIO
import logging
import sys
from typing import (
List,
Optional,
Iterator,
Union,
cast,
Callable,
Sequence,
)
try:
import ctypes
HAVE_CTYPES = True
exce... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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... |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under ... |
import argparse
import os, sys
import time
import datetime
# Import pytorch dependencies
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import torch.optim as optim
from tqdm import tqdm_notebook as tqdm
import numpy as np
# You cannot ... |
#!/usr/bin/python3
# This is called automatically by the build process to generate some
# layouts that are similar to other layouts.
import os
import pathlib
import sys
NAME = "name"
SOURCE = "source"
# was the source file generated by us as well?
IS_SOURCE_GENERATED = "is_source_generated"
# simple string replaceme... |
"""
Provides feature embeddings of type Bert, Twitter, and TFIDF across
experiment types
"""
from sklearn.feature_extraction.text import TfidfVectorizer
from gensim.models import word2vec, KeyedVectors
import torch.utils.data as data
from utils import *
import torch
import torch.utils.data
import pandas as pd
from ber... |
import json
import logging
import os.path
import re
import app
import numpy as np
import pandas as pd
import shapely.geometry as shapely_geom
from app import celery, model
from app.api_v1.upload import Uploads
from app.decorators.exceptions import (
HugeRequestException,
IntersectionException,
NotEnoughPoi... |
from ui import Canvas, Refresher, Menu, MockOutput
def show_pinouts(i, o):
zp_pinout = zp_pinouts_page(o).get_image()
ua_pinout = uap_pinouts_page(o).get_image()
isp_pinout = isp_pinouts_page(o).get_image()
pk2_pinout = pk2_pinouts_page(o).get_image()
show_pinout = lambda x: Refresher(lambda: x, i,... |
# emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil; coding: utf-8 -*-
# ex: set sts=4 ts=4 sw=4 et:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license te... |
#!/usr/bin/env python
# Usage:
# 1. To Invite users
# python manageUsers.py -i invite -u applicants.ini
# 2. To block users and free allocated IP addresses.
# python manageUsers.py -d delete -u applicants.ini
# 3. To view current IP/JID allocation.
# python manageUsers... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: test.py
# Author: <NAME> <<EMAIL>>
import os
import platform
import numpy as np
import skimage.transform
import tensorflow as tf
import sys
sys.path.append('../')
import loader
import configs.parsecfg as parscfg
import src.utils.image as image
import src.dataflow... |
import random
import torch
import json
from torch.utils.data import Dataset
from pytorch_transformers import GPT2Tokenizer
class EpisodeSummaryTokenizer(GPT2Tokenizer):
"""
Tokenizer class for episode summary strings/text.
The class inherits most of its functionality from the pytorch_transformers.GPT2Tok... |
# procurve_dokuwiki.py - Parses HP Procurve config files and makes DokuWiki tables
# https://github.com/pv2b/procurve_dokuwiki
#
# Copyright (c) 2017 <NAME> <<EMAIL>>
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files ... |
import itertools
import argparse
import trio
import sys
import os
import logging
from itertools import groupby
from dnm_cohorts.ensembl import get_consequences
from dnm_cohorts.cohorts import (open_de_ligt_cohort, open_rauch_cohort,
open_de_rubeis_cohort, open_epi4k_ajhg_cohort, open_iossifov_nature_cohort,
o... |
# Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# 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... |
# Load the required Libraries
import tensorflow as tf
import matplotlib.image as img
import numpy as np
from collections import defaultdict
import collections
from shutil import copy
from shutil import copytree, rmtree
import tensorflow.keras.backend as K
from tensorflow.keras.models import load_model
fro... |
import torch
import torch.nn as nn
from .neural_functions import init_neural_function
# TODO allow user to choose device
if torch.cuda.is_available():
device = 'cuda:0'
else:
device = 'cpu'
class LibraryFunction:
def __init__(self, submodules, input_type, output_type, input_size, output_size, num_units... |
import numpy as np
import random
import tensorflow as tf
import h5py
import pickle
import mmnrm.modelsv2
import math
from datetime import datetime as dt
def set_random_seed(seed_value=42):
tf.random.set_seed(seed_value)
random.seed(seed_value)
np.random.seed(seed_value)
def save_model_weights(f... |
'''
File: detect_forest_change.py
Author: <NAME>
Version: 0.1
Create: 2018-04-20 15:42:37
Description: detect forest changes from foest probility layers and tree cover layers
'''
import logging
def _load_tcc(f_tcc, msk):
from gio import geo_raster_ex as gx
from gio import config
import numpy ... |
import numpy as np
from math import sqrt
import matplotlib.pyplot as plt
import numba
import time
from scipy.integrate import odeint
# a sample differential equation dy/dx = (x-y)/2
# def dydx(x,y):
# return ((x-y)/2)
# # find the value of y for a given x using step size h
# # and an initial value y0 at x0
# ... |
r"""
Solves the incompressible Navier Stokes equations using the Lattice-Boltzmann
Method¹. The scenario is the flow around a cylinder in 2D which yields a van
Karman vortex street.
periodic
+-------------------------------------------------------------+
| ... |
#!/usr/bin/env python3
from __future__ import (unicode_literals, absolute_import,
print_function, division)
from functools import lru_cache
from itertools import count, islice
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)
import argparse
import collections
import collec... |
'''
This file
1. Reads in data from <data_dir>/<subfolder_name>
2. Merges ALL data together, shuffles the lines, and outputs the data into small chuns into <data_dir>/<subfolder_name>/<train/dev/test>
After this, run generate_slices.py
Example run command:
'''
import argparse
import collections
import copy
import ha... |
import math
import os
import re
import sys
exec(open(sys.argv[1], "r").read())
def gen_gnuplot(exp_name, exp_type):
f = open("tmp_" + exp_name + "_" + exp_type + ".gnuplot", "w")
print("set terminal postscript eps enhanced color size " + plot_config_exp[exp_name]["size"] + " font '" + plot_config_misc["font"]... |
from importlib.metadata import requires
from wsgiref.validate import validator
from pkg_resources import safe_extra
from mycroft import MycroftSkill, intent_handler
from adapt.intent import IntentBuilder
from mycroft.util.format import join_list
from os.path import dirname, join
from lingua_franca.parse import fuzzy_m... |
#!/usr/bin/env python
## Copyright (c) 2019, Alliance for Open Media. All rights reserved
##
## This source code is subject to the terms of the BSD 2 Clause License and
## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
## was not distributed with this source code in the LICENSE file, you ca... |
import argparse
import os
import pickle
import time
import sys
import matplotlib.pyplot as plt
import numpy as np
import yaml
import torch
import torch.nn as nn
import torchvision.models as models
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from torch.utils.data import DataLoade... |
#-------------------------------------------------------------------------------
#
# Project: EOxServer <http://eoxserver.org>
# Authors: <NAME> <<EMAIL>>
#
#-------------------------------------------------------------------------------
# Copyright (C) 2013 EOX IT Services GmbH
#
# Permission is hereby granted, free o... |
import argparse
import os
import numpy as np
import random
import cv2
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as transforms
from load_data import load_dataset
from read_data import ReadDataset
from run_model import run_model, pre... |
"""API to control single Google Sheet."""
import abc
import datetime
import string
import github
import fill_funcs
import sheet_builder
from reg_exps import DIGITS_PATTERN
from instances import Columns, Row
from utils import BatchIterator, get_url_from_formula
class BaseSheet(metaclass=abc.ABCMeta):
"""Single she... |
# Copyright <NAME> 2019-2019
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#-------------------------------------------------------------------------------
# RunProcess
#------------------... |
#!/usr/bin/env python
# encoding: utf-8
"""
Download a Minecraft sample world from GitHub and verify the SHA256 checksum.
"""
import sys
import os
try:
import urllib.request as urllib # Python 3
except ImportError:
import urllib2 as urllib # Python 2
import logging
import subprocess
import tarfile
import h... |
from stable_baselines3 import SAC
from stable_baselines3.common.vec_env import MultiAgentVecEnv
from mlagents_envs.exception import UnityTimeOutException, UnityWorkerInUseException
from mlagents_envs.side_channel.engine_configuration_channel import EngineConfigurationChannel
import torch as th
import os, yaml
from t... |
"""Utilities for disa time-series modeling."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import numpy as np
import pandas as pd
from pandas.tseries.holiday import USFederalHolidayCalendar as calendar
def _keep(window, windows):
"""Hel... |
import pandas as pd
import os
from qaPairsRelationClassification.utils.data_utils import shuffle, pad_sequences
from qaPairsRelationClassification.DSSM import args
import jieba
import re
from gensim.models import Word2Vec
import numpy as np
from qaPairsRelationClassification.DRCN import args
from qaPairsRelationClassif... |
import botogram
import sqlite3
from datetime import datetime, timedelta
import redis
import json
from dateutil import parser
dat = sqlite3.connect("dat.db")
d = dat.cursor()
# to delete in final version
# d.execute('DROP TABLE IF EXISTS users')
# d.execute('DROP TABLE IF EXISTS remind')
d.execute('CREATE TABLE IF NOT E... |
import logging
from django.conf import settings
from django.shortcuts import get_object_or_404
from django_filters import rest_framework as djfilters
from rest_framework import viewsets, generics, filters, mixins
from rest_framework.decorators import list_route, detail_route
from rest_framework.response import Respo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# calls.py
#
# Copyright 2014 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including with... |
import pytest
from rbc.tests import omnisci_fixture, sql_execute
from rbc.externals.omniscidb import table_function_error
import numpy as np
@pytest.fixture(scope='module')
def omnisci():
for o in omnisci_fixture(globals()):
define(o)
yield o
def define(omnisci):
T = ['int64', 'int32', 'int... |
import click
import os
import os.path
import sys
import shutil
import random
import string
import itertools
import time
import platform
from ruamel import yaml
from pkg_resources import get_distribution
from .bapHelp import *
def getBfiles(bedtools_genome, blacklist_file, reference_genome, script_dir, supported_genome... |
bl_info = \
{
"name" : "Spaceship Generator",
"author" : "<NAME>, <NAME>",
"version" : (1, 6, 5),
"blender" : (3, 0, 0),
"location" : "View3D > Add > Mesh",
"description" : "Procedurally generate 3D spaceships from a random seed.",
"wiki_url" : "https://github... |
import kivy
kivy.require( '1.9.1' )
# add the following 2 lines to solve OpenGL 2.0 bug
#from kivy import Config
#Config.set( 'graphics', 'multisamples', '0' )
from kivy.garden.graph import Graph, SmoothLinePlot
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.dropdown import Drop... |
'''
Written by <NAME>
'''
import numpy as np
import os
import glob
import xml.etree.ElementTree as ET
import json
validation_ratio = 0.1
def generate_image_imdb(vid_root_path, vid_curated_path):
'''
# save image crops to the vid_curated_path
'''
anno_str = "Annotations/VID/train/"
data_str = "Da... |
import scipy as sp
import numpy as np
from scipy import linalg as la
from typing import List, Callable
import logging
from ..sampler import Sampler
from .scales import standard_deviation
from .base import Distance
logger = logging.getLogger("Distance")
class PNormDistance(Distance):
"""
Use weighted p-norm... |
from torch import nn
import torch
cuda = torch.cuda.is_available()
device = torch.device("cuda" if cuda else "cpu")
class Reshape(nn.Module):
def __init__(self, shape, **kwargs):
self.shape = shape
super(Reshape, self).__init__(**kwargs)
def forward(self, input):
return input.view(self... |
from spydrnet.ir import InnerPin, OuterPin, Wire, Netlist, Library, Definition, Element, Instance,\
Port, Cable
from spydrnet.util.hierarchical_reference import HRef
from spydrnet.util.selection import Selection
from spydrnet.global_state.global_service import lookup
from spydrnet.util.patterns import _is_pattern_a... |
"""
Student Name: <NAME>
Professor Name: Dr. Frinchaboy
Class: PHYS 50733
Project: Double Stars Planetary System
Last edited: 7 May 2017
Overview:
---------
Input:
------
None
Output:
-------
"""
# Importing needed modules
import numpy as np
import matplotlib.pyplot as plt
# Setting plotting parameters
from ma... |
#
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
#
"""
VNC pod task management for mesos
"""
import json
import uuid
from cStringIO import StringIO
from cfgm_common.exceptions import RefsExistError, NoIdError
from cfgm_common.utils import cgitb_hook
from vnc_api.vnc_api import ( InstanceIp, Virtua... |
import pdb
#pdb.set_trace()
import gzip
from collections import defaultdict
import pickle
import os
import sys
from subprocess import Popen
from argparse import ArgumentParser
import glob
from collections import Counter
script_path = os.path.dirname(os.path.abspath( __file__ ))
code_path = script_path + "/"
def Most... |
from collections import OrderedDict
from typing import List, Tuple
import torch
import torch.nn as nn
import numpy as np
from tqdm import tqdm
from firelab.utils.training_utils import get_module_device
def weight_vector(params):
return torch.cat([p.view(-1) for p in params])
def params_diff(p_lhs, p_rhs):
... |
import os
import db
from mycrypto import MyCipher
import pyftpdlib.filesystems
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler, proto_cmds
from pyftpdlib.servers import FTPServer
from pyftpdlib.filesystems import AbstractedFS
from cryptography.exceptions import InvalidKey
ip... |
#!/usr/bin/env python
# Copyright (C) 2014 Open Data ("Open Data" refers to
# one or more of the following companies: Open Data Partners LLC,
# Open Data Research LLC, or Open Data Capital LLC.)
#
# This file is part of Hadrian.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this... |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
import pandas as pd
import seaborn as sns
import matpl... |
import numpy as np
from typing import Callable, List
import matplotlib.pyplot as plt
from dataclasses import dataclass
from .utils import rotation, averageB
@dataclass
class Result:
magFieldError: float
B0: float
B0Error: float
B0MinimizationArray: List[float]
b: float
bMinimizationArray: List[float]
R0... |
# -*- coding: utf-8 -*-
##########################################################################
# NSAp - Copyright (C) CEA, 2019
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
#... |
'''
Author: <NAME>(<EMAIL>)
Date: 2022-04-07 10:35:16
LastEditTime: 2022-04-09 00:41:32
LastEditors: <NAME>(<EMAIL>)
Description: Train the aging-aware model with write-aware training
FilePath: /projects/ELight/train.py
'''
import argparse
import os
from typing import Iterable
import numpy as np
import torch
import to... |
# -*- coding: utf-8 -*-
"""Create masked LM/next sentence masked_lm TF examples for BERT."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys,os,json
import sys,os
import time
father_path = os.path.join(os.getcwd())
print(father_path, "==father... |
"""
Appraise evaluation framework
See LICENSE for usage details
"""
from datetime import datetime
from django.core.management.base import BaseCommand, CommandError
from tablib import Dataset
from Campaign.utils import (
_create_uniform_task_map,
_identify_super_users,
_load_campaign_manife... |
from django import forms
from django.core.exceptions import ValidationError
from .models import *
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.utils.html import strip_tags
# from datetime import datetime
import datetime
from HTMLParser import HTMLPars... |
# -*- coding: utf-8 -*-
# <sure - utility belt for automated testing in python>
# Copyright (C) <2010-2017> <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 o... |
# Copyright 2019 Atalaya Tech, 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 writing, ... |
import math
from os import path
import pygame
from color import Color
# Init pygame font module
pygame.font.init()
dirname = path.dirname(path.realpath(__file__))
# Loading font
font_arcade = pygame.font.Font("{}/fonts/arcadeclassic.ttf".format(dirname), 46)
# Colour Constants
colors = [Color.APPLIANCE_WHITE,
... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from common_utils import *
from crypto_utils import *
def PrintUsage():
executable = os.path.basename(__file__)
print(u'\nencrypt_platform_data\n\n\tUsage:\t{} shared_petpin.bin platform_public_key.bin platform_private_key.bin token_public_key.bin local_pet_key.b... |
"""Caching capabilities for a faster build process."""
import hashlib
import inspect
import logging
import os
import struct
import numpy as np
from nengo.rc import rc
from nengo.utils.cache import byte_align, bytes2human, human2bytes
from nengo.utils.compat import is_string, pickle, PY2
from nengo.utils import nco
... |
import copy
import hashlib
import json
import semver
import datetime
import re
from threading import Lock
class ResourceKeyExistsError(Exception):
pass
class ConstructResourceError(Exception):
def __init__(self, msg):
super(ConstructResourceError, self).__init__(
"error constructing ope... |
#!/usr/bin/env python3
# coding=utf-8
from __future__ import absolute_import, division, unicode_literals
import multiprocessing
import os
import threading
import logging
import weakref
try:
from typing import Callable, Any, Union
except:
pass
__ALL__ = ["GMP", "Meta"]
VERSION = (2, 0, 0, 0)
VERSION_STR = "{... |
# -*- coding: utf-8 -*-
"""
Collections that wrap multiple targets.
"""
__all__ = ["TargetCollection", "SiblingFileCollection"]
import types
import random
import six
from law.target.base import Target
from law.target.file import FileSystemTarget
from law.util import colored, flatten, create_hash
class TargetCo... |
from __future__ import print_function, absolute_import
import glob
import re
import os.path as osp
from IPython import embed
class Market1501(object):
"""
Market1501
Reference:
Zheng et al. Scalable Person Re-identification: A Benchmark. ICCV 2015.
URL: http://www.liangzheng.org/Project/... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# A library for access to OpenWeatherMap Weather Service
#
# Copyright (C) 2011 <NAME>
# <EMAIL>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundati... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.