text stringlengths 3.07k 22.1k |
|---|
import pandas as pd
import numpy as np
import os
from df_to_sql.write2text import *
def drop_cols(df, col2drop = []):
if len(col2drop) > 0:
cols = df.columns.to_list()
ncols = []
for i in range(len(cols)):
match = 0
for j in range(len(col2drop)):
if ... |
import uuid
import urllib
import os
import json
from datetime import datetime
from functools import wraps, update_wrapper
import requests
from flask import g, request, abort, make_response, Response
from flask_restplus import Resource, fields
from werkzeug.datastructures import FileStorage
from pyinfraboxutils imp... |
# Copyright 2016 Google 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 sys
import os
# check SBMolGen_PATH setting
if os.getenv('SBMolGen_PATH') == None:
print("THe SBMolGen_PATH has not defined, please set it before use it!")
exit(0)
else:
SBMolGen_PATH=os.getenv('SBMolGen_PATH')
sys.path.append(SBMolGen_PATH+'/utils')
from subprocess import Popen, PIPE
from math i... |
# -*- coding: utf-8 -*
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import requests
import os
from astropy.coordinates import SkyCoord
import astropy.units as u
from astropy.table import Table, Column
from astropy.io.votable import parse
from astroquery import log
from astroquery.c... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# -*- coding: utf-8 -*-
from uuid import uuid4
from decimal import Decimal
from zope.interface import implementer
from schematics.exceptions import ValidationError
from schematics.transforms import whitelist, blacklist
from schematics.types import StringType, FloatType, IntType, MD5Type
from schematics.types.compound i... |
# -*- encoding: utf-8 -*-
#
#
# Copyright (C) 2002-2011 <NAME> <<EMAIL>>
# Copyright (C) 2002-2011 <NAME> <<EMAIL>>
#
# This file is part of PyX (http://pyx.sourceforge.net/).
#
# PyX is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fre... |
from pymongo import MongoClient
import datetime
import pickle
connectionstring = 'mongodb://takuu.dcs.gla.ac.uk:27017'
client = MongoClient(connectionstring)
database_name = "Game_data"
db = client[database_name]
players = db["players"]
games = db["games"]
completed_games = db["completed_games"]
player_backup = db["p... |
##
# Copyright (c) 2006-2018 Apple 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 l... |
# -*- coding: utf-8 -*-
"""
Copyright © 2022 <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, copy, modify, merge, pub... |
"""
This file contains specific functions for computing losses of FCOS
file
"""
import torch
from torch import nn
from torch.nn import functional as F
from maskrcnn_benchmark.layers import IOULoss
from maskrcnn_benchmark.layers import SigmoidFocalLoss
from maskrcnn_benchmark.utils.comm import reduce_sum, get_world_si... |
import py
from rpython.rlib.signature import signature, finishsigs, FieldSpec, ClassSpec
from rpython.rlib import types
from rpython.annotator import model
from rpython.rtyper.llannotation import SomePtr
from rpython.annotator.signature import SignatureError
from rpython.translator.translator import TranslationContext,... |
import asyncio
import collections
import hashlib
import json
import os
import sys
import time
from collections import OrderedDict
from datetime import datetime
from functools import reduce
from pathlib import Path
from urllib.parse import quote_plus
import aiohttp
import nexussdk as nxs
import pandas as pd
import prog... |
import math
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from model.layers.attention_layers import SEModule, CBAM
import config.yolov4_config as cfg
class Mish(nn.Module):
def __init__(self):
super(Mish, self).__init__()
def forward(self, x):
return x ... |
import os.path
import cv2
import matplotlib.pyplot as plt
import numpy as np
from keras import Input, regularizers
from keras.applications import vgg16
from keras.engine import Model
from keras.layers import Flatten, Dense, Lambda, Cropping2D, Dropout, ELU, Activation, MaxPooling2D, Conv2D, \
BatchNormalization
fr... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from . import _utilities... |
"""
Get fingerprints produced by a 3D conformed-basedmodel.
"""
import json
import os
import subprocess
import pickle
import time
import argparse
from tqdm import tqdm
from nff.utils import (METRICS, CHEMPROP_TRANSFORM, parse_args, get_split_names)
# dictionary that transforms our metric syntax to chemprop's
REVERSE... |
import os
import argparse
import logging
import sys
import numpy as np
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from tensorboardX import SummaryWriter
sys.path.append('./')
from dataset.backbone_dataset import ImageNetDataset
from model.Backbone import ResNet
from dataset.transfo... |
#!/usr/bin/env python3
# --- Euler pb 1
# Multiples of 3 and 5
# If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
# The sum of these multiples is 23.
# Find the sum of all the multiples of 3 or 5 below 1000.
def euler1(n):
return sum([x for x in range(1, n) if x % ... |
# Copyright 2015 Conchylicultor. All Rights Reserved.
# Modifications copyright (C) 2016 <NAME>
# Modifications copyright (C) 2017 <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
#
# ... |
# Copyright 2006-2016 by <NAME>. All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""Bio.AlignIO support for ... |
import cgen as c
from sympy import Symbol
from devito.cgen_utils import ccode
from devito.ir.iet import (Expression, Iteration, List, UnboundedIndex, ntags,
FindAdjacentIterations, FindNodes, IsPerfectIteration,
NestedTransformer, Transformer, compose_nodes,
... |
#!/usr/bin/env python
# Written for Python 3.4
#
# Dependencies
# pillow
# scikit-image
# scikit-learn
# ...and their dependencies
#
# @TODO@:
# * implement shared palette
# * range check numeric command-line arguments
# * consider click instead of argparse
# * error out if width or height is not a mult... |
"""
mdform.fields
~~~~~~~~~~~~~
Labeled field <label> =
Labeled required field <label>* =
Specific fields:
- StringField ___[length] (length is optional)
- IntegerField ###[min:max:step] (min, max, step are optional)
- Decimal... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from . import templates
from .name_convention import (
is_valid_class_name, is_valid_variable_name, is_valid_surfix,
to_variable_name
)
from .exc import ValidationError
from .pkg.six import integer_types, string_types
from .pkg.... |
from __future__ import print_function
import os, time, json
from collections import defaultdict
from .database import get_db
from ..errors import UsageError
def abbrev(t):
if t is None:
return "-"
if t > 1.0:
return "%.3fs" % t
if t > 1e-3:
return "%.1fms" % (t*1e3)
return "%.1f... |
import logging
import os
import time
from functools import reduce
from typing import Dict
from typing import List
from typing import Set
from typing import Tuple
import pyinotify
from kazoo.protocol.states import EventType
from kazoo.recipe.watchers import ChildrenWatch
from kazoo.recipe.watchers import DataWatch
from... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Library to parse the market data file form BmfBovespa
@author: ucaiado
Created on 06/10/2016
"""
# import libraries
import os
import zipfile
import pandas as pd
import subprocess
'''
Begin help functions
'''
class NoMappedException(Exception):
"""
NoMappedExcep... |
# -*- coding: utf-8 -*-
# This file is distributed under the same License of Python
# Copyright (c) 2014 <NAME> <<EMAIL>>
"""
build_manpage.py
Add a `build_manpage` command to your setup.py.
To use this Command class import the class to your setup.py,
and add a command to call this class::
from build_manpage ... |
'''
trainer for GAT model
----
ACM CHIL 2020 paper
<NAME>, 200228
'''
import os,sys,pickle,time,random,glob
import numpy as np
import pandas as pd
from typing import List
import copy
import os.path as osp
import torch
import torch.utils.data
from torch_sparse import SparseTensor, cat
from torch_g... |
# GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... |
#! usr/bin/env python
import math
# Custom imports
from . import GlobalConstants as GC
from . import Engine, Utility
def flicker_image(image, color):
color = tuple(Utility.clamp(c, 0, 255) for c in color)
image = Engine.copy_surface(image)
Engine.fill(image, color, None, Engine.BLEND_RGB_ADD)
... |
from collections import namedtuple
import lasagne as nn
from lasagne.layers.dnn import Conv2DDNNLayer, MaxPool2DDNNLayer
import data_iterators
import numpy as np
import theano.tensor as T
from functools import partial
import utils_heart
import nn_heart
from pathfinder import PKL_TRAIN_DATA_PATH, TRAIN_LABELS_P... |
from pathlib import Path
from os.path import sep
from pkg_resources import require
from shutil import which
import frontmatter
from flask import (
render_template,
flash,
redirect,
request,
url_for,
send_file,
send_from_directory,
)
from flask_login import login_user, current_user, logout_u... |
"""
The default styling.
"""
from prompt_toolkit.cache import memoized
from .base import ANSI_COLOR_NAMES
from .named_colors import NAMED_COLORS
from .style import BaseStyle, Style, merge_styles
__all__ = [
'default_ui_style',
'default_pygments_style',
]
#: Default styling. Mapping from classnames to their s... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button
import math
from scipy.optimize import fsolve
def equations(vars, *args):
x, y = vars
eq1 = (args[0]-x)**2+(args[1]-y)**2-l4**2
eq2 = (args[2]-x)**2+(args[3]-y)**2-l5**2
return [eq1, eq2]
#Define Link Lengths
l1 ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import abc
import copy
import datetime
import math
import pickle
import random
import signal
import sys
import time
def round_figures(x, n):
"""Returns x rounded to ... |
import logging
import urllib
import urlparse
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.utils.translation import ugettext_lazy as _
from sentry.models import GroupMeta
from sentry.plugins.base import Response
from sentry.plugins.bases.... |
"""
The Condor plugin. Allows submission to
`HTCondor <http://research.cs.wisc.edu/htcondor/>`_.
Note: Condor was renamed to HTCondor in 2012.
"""
from __future__ import print_function
import os
import sys
import random
import math
import logging
import getpass
from datetime import datetime,timedelta
import subproces... |
"""
Sequence I/O: Read and write FASTA and FASTQ files efficiently
"""
__all__ = [
'open',
'Sequence',
'FastaReader',
'FastaWriter',
'FastqReader',
'FastqWriter',
'UnknownFileFormat',
'FileFormatError',
'FastaFormatError',
'FastqFormatError',
'InterleavedSequenceReader',
... |
from skimage.measure import compare_ssim as ssim
import matplotlib.pyplot as plt
import cv2
import urllib.request
import urllib.parse
import urllib.error
import tkinter as tk
from tkinter import font as tkfont
from tkinter import *
import os
from tkinter import filedialog
import sqlite3
import numpy as np
import shuti... |
# 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 numpy as np
from skimage.transform import resize
import skimage
import torchvision.utils as tvutils
import torch
import PIL
from PIL import Image
import torchvision
class UnNormalize(object):
def __init__(self, mean, std):
self.mean = torch.tensor(mean).unsqueeze(0).unsqueeze(2).unsqueeze(3)
... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# >>
# cfc, 2021
# <NAME> <<EMAIL>>
# <<
import os
import pwd
import json
import math
import asyncio
import operator as op
import mimetypes
from enum import Enum
from pathlib import Path
from functools import cached_property
from collections import deque
from typing ... |
from __future__ import annotations
import json
import pathlib
from enum import Enum
from typing import Dict, List, Optional
import jsonschema
import networkx as nx
import parchmint
from parchmint.component import Component
from parchmint.connection import Connection
from parchmint.layer import Layer
from parchmint.p... |
# %%
from functools import reduce
import numpy as np
import pandas as pd
from pandas.tseries.offsets import DateOffset
pd.set_option("display.max_rows", None)
pd.set_option("display.max_columns", None)
# %%
def build_gvkeys(prc, fund):
gvkeys_fund = fund.gvkey.unique()
gvkeys_prc = prc[prc.close > 5].gvkey.un... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import datetime
import logging
import re
from django.conf import settings
from django.contrib.contenttypes.models import C... |
from django import template
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.contenttypes.models import ContentType
from django.db.models import Count, Q
from django.http import Http404, HttpResponseForbidden
from dja... |
import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions.categorical import Categorical
from src.util import init_weights, init_gate
from src.module import VGGExtractor, CNNExtractor, RNNLayer, ScaleDotAttention, LocationAwareAttention
class ASR(nn.Mo... |
# -*- coding: utf-8 -*-
import requests
import os
import skimage
import random
import json
import webbrowser
import time
import pandas as pd
import matplotlib.pyplot as plt
import os
import sys
from PIL import Image, ImageDraw
global population
global api_calls
global stop
global MUTATION_RATE
classList = []
confidenc... |
# -*- coding:utf-8 -*-
import numpy as np
import GVal
def initializationProcess():
localprefix = '/home/'
serverprefix = '/home/labcompute/'
GVal.setPARA('prefix_PARA', serverprefix)
# GVal.setPARA('prefix_PARA', localprefix)
return GVal.getPARA('prefix_PARA')
def processCodeEnc... |
# Copyright 2015-2018 Canonical Ltd.
# Copyright 2020 <NAME>
# All Rights Reserved
"""Tests for a simple calculator."""
import math
from decimal import Decimal
from unittest import TestCase
import simplecalc
class BaseTestCase(TestCase):
"""Common code for all test cases."""
def check(self, operations):
... |
#
"""
Various loss functions for policy gradients.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from texar.losses.losses_utils import mask_and_reduce
from texar.utils.shapes import get_rank
# pylint: disable=too-many-argumen... |
import torch.nn as nn
import math
import torch
def init_model(model, **kwargs):
conv_type = kwargs.get("conv_type", None)
if conv_type == "def":
conv_type = None
bias_type = kwargs.get("bias_type", None)
if bias_type == "def":
bias_type = None
mode = kwargs.get("mode", None)
no... |
"""Tool for handling rigs"""
import logging
import re
from collections import defaultdict
from itertools import combinations
import networkx as nx
import numpy as np
from opensfm import actions, pygeometry, pymap
from opensfm.dataset import DataSet, DataSetBase
logger = logging.getLogger(__name__)
def find_image_... |
#!/usr/bin/env python3
# This file is part of Pixelsorting.
#
# Pixelsorting 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 of the License, or
# (at your option) any later version.
#
# Pixe... |
import json
import os
import tempfile
from unittest.mock import MagicMock, patch
import cloudpickle
import pendulum
import pytest
import prefect
from prefect.client import Client
from prefect.engine.result_handlers import (
AzureResultHandler,
GCSResultHandler,
JSONResultHandler,
LocalResultHandler,
... |
import numpy as np
from skimage.measure import label
import skimage.measure._ccomp as ccomp
from skimage._shared import testing
from skimage._shared.testing import assert_array_equal
BG = 0 # background value
class TestConnectedComponents:
def setup(self):
self.x = np.array([
[0, 0, 3, 2, ... |
import matplotlib.pyplot as plt
import numpy as np
import sys
from os import walk
import matplotlib.colors as mcolors
'''
Return: table of lists of intervals {[%f,%f]}
'''
def read_log_file(filename):
result = {}
f = open(filename, 'r')
lines = f.readlines()
for line in lines:
line = line.repla... |
#!/usr/bin/env python3
import argparse
import os
import re
import glog as log
import numpy as np
import pandas as pd
import ray
from factorized_sampler_lib import data_utils
from factorized_sampler_lib import rustlib
import join_utils
NULL = -1
@ray.remote
def get_first_jct(join_name, table, base_count_table):
... |
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()
# Initialize... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#!/usr/bin/env python
from __future__ import print_function
from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext
from distutils.errors import DistutilsSetupError
from distutils import log
from distutils.dep_util import newer_group
from distutils.dir_util import mkpat... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# -*- coding: utf-8 -*-
import codecs
from collections import Counter, defaultdict
from itertools import chain, count
import torch
import torchtext.data
import torchtext.vocab
PAD_WORD = '<blank>'
UNK = 0
BOS_WORD = '<s>'
EOS_WORD = '</s>'
def __getstate__(self):
return dict(self.__dict__, stoi=dict(self.stoi)... |
import datetime
from subprocess import CalledProcessError # nosec
from threading import Thread
from typing import Dict, List, Optional, Set
import boto3
import click
import pytz
import semver
from botocore.config import Config
from botocore.exceptions import ClientError
from colored import attr, fg
from opta.amplitu... |
import json
from typing import Dict, Sequence, List, Tuple, Union
from django import forms
from django.conf import settings
from django.contrib.postgres.forms import SimpleArrayField
from utilities.choices import ColorChoices
from .utils import add_blank_choice, parse_numeric_range
__all__ = (
'APISelect',
'... |
#!/usr/bin/env python3
# Author: <NAME>
# Date: 2021/1/29
# Functions to generate csv summaries of data statistics and merge result statistics
import os
import argparse
import re
from typing import Tuple
import pandas as pd
import numpy as np
import consts as C
from processing.marsdataloader import MARSDataLoader
... |
#===============================================================================
# Copyright 2020-2021 Intel Corporation
#
# 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.apa... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import numpy as np
print("GPU is", "available" if torch.cuda.is_available() else "NOT AVAILABLE")
print(torch.__version__)
# import images dataset
import os
from PIL import Image
#import c... |
# This file is part of paramiko.
"""
Configuration file (aka ``ssh_config``) support.
"""
import fnmatch # filename match
import os
import re
import shlex # shell lexical analyzers
import socket
from retic import List,Void,String,Bool
SSH_PORT = 22
@fields({SETTINGS_REGEX: String, _config:List(Tuple(List(String),D... |
# -*- coding: utf-8 -*-
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
from datetime import datetime
from logging import getLogger as get_logger
from threading import Event, Thread
from limits import parse as parse_rate_limit
from limits.stor... |
"""Sample script of word embedding model.
This code implements skip-gram model and continuous-bow model.
Use ../ptb/download.py to download 'ptb.train.txt'.
"""
import argparse
import collections
import numpy as np
import six
import chainer
from chainer import cuda
import chainer.functions as F
import chainer.initial... |
from collections import deque
from functools import reduce
from operator import mul
from typing import Iterable, Tuple
class BitProvider:
def __init__(self, characters: str) -> None:
self.characters: deque[str] = deque(characters)
self.currentBits: deque[int] = deque()
def _BitsFromNextChar(s... |
import logging
import os
import re
import time
from threading import Event, Lock, Thread
import cook.util as cu
class ProgressSequenceCounter:
"""Utility class that supports atomically incrementing the sequence value."""
def __init__(self, initial=0):
self.lock = Lock()
self.value = initial
... |
#! /bin/env python
import os
import sys
import numpy as np
from ...grids import RasterField
class BovError(Exception):
pass
class MissingRequiredKeyError(BovError):
def __init__(self, opt):
self.opt = opt
def __str__(self):
return "%s: Missing required key" % self.opt
class BadKeyVa... |
from collections import namedtuple
import attr
from fuzzysearch.common import FuzzySearchBase, Match, \
consolidate_overlapping_matches
from fuzzysearch.compat import text_type, xrange
from fuzzysearch.search_exact import search_exact
__all__ = [
'find_near_matches_generic',
'find_near_matches_generic_l... |
import argparse
import logging
from os import path
import signal
import subprocess
import sys
import time
import cv2
import numpy as np
from picamera.array import PiRGBArray
from picamera import PiCamera
from socketIO_client import SocketIO, BaseNamespace
# enable safe shutdown with ctl+c
global running
running = Tru... |
import tensorflow as tf
import os
import time
import numpy as np
import glob
import matplotlib.pyplot as plt
import PIL
import imageio
import argparse
import dataset as dt
INPUT_SHAPE = (32, 32, 1)
tf.random.set_seed(777)
NORM_LIST = ["interframe_minmax", "est_minmax", "zscore"]
class ConvVAE(tf.keras.Model):
... |
# coding: utf-8
import numpy as np
import torch
import pysptk
import pyworld
import librosa
from sklearn.preprocessing import MinMaxScaler
from nnmnkwii.io import hts
from nnmnkwii.frontend import merlin as fe
from nnmnkwii.postfilters import merlin_post_filter
from nnmnkwii.preprocessing.f0 import interp1d
from nnsv... |
# Copyright 2020 Adap GmbH. 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... |
import os
import time
import argparse
import math
from numpy import finfo
import numpy as np
import torch
from distributed import apply_gradient_allreduce
import torch.distributed as dist
from torch.utils.data.distributed import DistributedSampler
from torch.utils.data import DataLoader
from model import Tacotron2
fr... |
# Copyright (c) 2019 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 applic... |
# Copyright IBM Corp. 2016 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... |
import sklearn
import copy
import numpy as np
import scipy as sp
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import seaborn as sns
# from viz import viz
from bokeh.plotting import figure, show, output_notebook, output_file, save
from functions import merge_data
from sklearn.mod... |
"""Tests for the design module"""
import numpy as np
import turbigen.compflow as cf
from turbigen import design
# Set up test data
# Ranges of velocity triangle parameters covering the classic Smith chart
phi = np.linspace(0.4, 1.2, 5)
psi = np.linspace(0.8, 2.4, 5)
# "Reasonable" range of reaction (usually close to... |
#!/usr/bin/env python
"""
Code to load an expert policy and generate roll-out data for behavioral cloning.
Example usage:
python dagger_pytorch.py experts/Humanoid-v1.pkl Humanoid-v2 --render \
--num_rollouts 20
Author of this script and included expert policies: <NAME> (<EMAIL>)
"""
import pickle
im... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#File afsk1200lib.py
#Author <NAME>/M0ZJO
#Date 05/10/2019
#Desc. This is a physical layer decoder for UOSAT-2 AFSK
__author__ = "Jonathan/M0ZJO"
__copyright__ = "Jonathan/M0ZJO 2019"
__credits__ = ["Surrey University"]
__license__ = "MIT"
__versi... |
import sys, os, subprocess, importlib
import numpy as np
import ctypes
__all__ = ['Potential', 'TTM', 'MBPol']
class Potential:
"""Abstract base class for potential energy surfaces. A single function, evaluate(),
must be implemented which returns the energy and gradients.
Each child class needs... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of cond... |
"""
This module is a framework for solving constraint satisfaction problems.
"""
from collections import deque
class ConstraintSatisfactionProblem:
"""
The abstract base class of a constraint satisfaction problem.
Attributes:
variables (dict): A mapping of variable names -> variable objects
... |
from joblib import delayed, Parallel
import os
import sys
import glob
from tqdm import tqdm
import cv2
import argparse
import matplotlib.pyplot as plt
plt.switch_backend('agg')
def str2bool(s):
"""Convert string to bool (in argparse context)."""
if s.lower() not in ['true', 'false']:
raise ValueE... |
from collections import OrderedDict
import numpy as np
import torch
import torch.optim as optim
from torch import nn as nn
import rlkit.torch.pytorch_util as ptu
from rlkit.core.eval_util import create_stats_ordered_dict
from rlkit.torch.torch_rl_algorithm import TorchTrainer
from rlkit.torch.networks import FlattenM... |
"""
Local workstations as clusters (:mod:`fluiddyn.clusters.local`)
===============================================================
Provides:
.. autoclass:: ClusterLocal
:members:
"""
import datetime
import os
import stat
from shlex import split
from socket import gethostname
import psutil
from . import Cluste... |
"""
Implicit gradient-enhanced damage model in dolfinx
==================================================
For the theory and the constitutive model, please refer to the dolfin version :ref:`gdm-label`.
Here, you see the "quadrature" approach working in dolfinx without the need of `LocalProject`.
"""
from gdm_constit... |
"""Trace treadmill application events.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os
import socket
import sys
import click
import gevent
from gevent import queue as g_queue
import six... |
import copy
import json
import types
from typing import Dict, NamedTuple
from io import StringIO
from argparse import ArgumentParser
import unittest
from unittest.mock import patch
import sap.adt
import sap.cli.core
class Response:
def __init__(self, text=None, status_code=None, headers=None, content_type=None... |
# Copyright 2012 OpenStack Foundation
#
# 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 l... |
#!/usr/bin/env python
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.