text stringlengths 3.07k 22.1k |
|---|
"""Capsule Networks basic implementation according to the paper:
Dynamic Routing Between Capsules - <NAME>, <NAME>, <NAME>
Paper Link: https://arxiv.org/abs/1710.09829"""
import numpy as np
import tensorflow as tf
# Squash Function
def squash(vector, ax = -1, epsilon = 1e-7):
"""
Arguments:
- vector... |
"""
Run production server.
"""
import ctypes
import logging
import multiprocessing
import os
import signal
import sys
import time
import setproctitle
import six
import tornado.httpserver
import tornado.ioloop
import tornado.netutil
import tornado.process
from shelter.core.app import get_tornado_apps
from shelter.co... |
import itertools
import torch
import torch.nn as nn
from torch.nn import functional as F
from mine.datasets import load_dataloader
from mine.models.mine import Mine
from mine.utils.helpers import AverageMeter
from tqdm import tqdm
import numpy as np
import random
import pytorch_lightning as pl
from pytorch_lightning i... |
''' Main plot operations. '''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import re
from . import figure
from . import util
from .ops import plot, plot_many
from .util import merge_kwargs
from biwrap import biwrap
from matplotlib.fig... |
"""Interface of the different fixtures for executing JSTests against."""
from __future__ import absolute_import
import os.path
import time
import pymongo
import pymongo.errors
from ... import config
from ... import errors
from ... import logging
from ... import utils
from ...utils import registry
_FIXTURES = {} #... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import numpy as np
import argparse
import time
import paddle.fluid as fluid
import data_utils.augmentor.trans_mean_variance_norm as trans_mean_variance_norm
import data_utils.augmentor.tra... |
from PIL import Image, ImageDraw, ImageFont
def stick_maker_temp_default(text: str, image_file: bytes, font_path: str, image_wight: int, image_height: int):
# 处理图片
draw = ImageDraw.Draw(image_file)
font_size = 72
font = ImageFont.truetype(font_path, font_size)
text_w, text_h = font.getsize_multili... |
class UnetOptions:
def __init__(self):
self.in_channels=1
self.n_classes=2
self.depth=5
self.wf=6
self.padding=False
self.up_mode='upconv'
self.batch_norm=True
self.non_neg = True
self.pose_predict_mode = False
self.pretrained_mode =... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
# Created By : <NAME>
# Created Date: Tue June 22 9:00:00 PDT 2021
# =============================================================================
import time
import numpy
import gudhi as gd
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# #*** <License> ************************************************************#
# This module is part of the repository CNDB.
#
# This module is licensed under the terms of the BSD 3-Clause License
# <http://www.c-tanzer.at/license/bsd_3c.html>.
# #*** </License> ***************... |
from operator import itemgetter
import cv2
import math
import numpy as np
BODY_PARTS_KPT_IDS = [[1, 2], [1, 5], [2, 3], [3, 4], [5, 6], [6, 7], [1, 8], [8, 9], [9, 10], [1, 11],
[11, 12], [12, 13], [1, 0], [0, 14], [14, 16], [0, 15], [15, 17], [2, 16], [5, 17]]
BODY_PARTS_PAF_IDS = ([12, 13], [2... |
import argparse
from tqdm import trange
import requests
import os
import sys
import csv
import pandas as pd
from time import sleep
from datetime import datetime
# URLs to make api calls
BASE_URL = "https://metamon-api.radiocaca.com/usm-api"
TOKEN_URL = f"{BASE_URL}/login"
LIST_MONSTER_URL = f"{BASE_URL}/getWalletProp... |
"""
Greynir: Natural language processing for Icelandic
Scraper database models
Copyright (C) 2021 <NAME>.
This software is licensed under the MIT License:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
... |
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
@receiver(post_save, sender=sett... |
#!/bin/env python
#===============================================================================
# NAME: XmlPortsParser.py
#
# DESCRIPTION: This class parses the XML port types files.
#
# USAGE:
#
# AUTHOR: reder
# EMAIL: <EMAIL>
# DATE CREATED : Feb. 4, 2013
#
# Copyright 2007, California Institute of Technology.... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from parlai.core.teachers ... |
"""
This file is part of the accompanying code to our manuscript (currently under review):
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
<NAME>, <NAME>, <NAME>, <NAME>. 2022.
“Regionalization in a global hydrologic deep learning model: from physical descriptors to random vectors”
Water Resources Re... |
import os
import time
import json
import logging
from six.moves import cPickle
import numpy as np
import matplotlib.pyplot as plt
import matplotlibex.mlplot as plx
import ml.gptheano.vecgpdm.enums as enm
from ml.gptheano.vecgpdm.equations import list_of_nones
from ml.gptheano.vecgpdm.equations import matrix_of_nones
im... |
__version__ = '1.0.3'
__author__ = '<NAME>, <NAME>'
import colorsys
from matplotlib.patches import Rectangle
import matplotlib.pyplot as plt
import numpy as np
# Width of each instance in the bar plot
TOTAL_WIDTH = 0.75
def plot_chip(file, width, height, circuits, min_index):
"""Plots a chip configuration.
... |
from ctypes import (
POINTER, byref, c_byte, c_char, c_double, c_float, c_int, c_int64, c_short,
c_ubyte, c_ushort, c_uint, c_uint64, pointer,
)
import datetime
import decimal
import sys
import unittest
from comtypes import IUnknown, GUID
from comtypes.automation import (
VARIANT, DISPPARAMS, VT_NULL, VT_E... |
import enum
import serial
import time
import threading
import logging
LOG = logging.getLogger('pymindwave')
class device_error(Exception):
pass
class request_denied(Exception):
pass
class checksum_mismatch(Exception):
pass
class wrong_token_error(Exception):
pass
class read_timeout(Exception):
... |
import typing
import discord
from discord.ext import commands
import asyncio
import random
from PIL import Image
import io
from pathlib import Path
from nerdlandbot.translations.Translations import get_text as translate
from nerdlandbot.helpers.TranslationHelper import get_culture_from_context as culture
from nerdland... |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""
Dora the Explorer, special thank to @pierrestock.
"""
import argparse
import json
import logging
import shlex
import sub... |
"""
Copyright 2017-present Airbnb, 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, sof... |
# Copyright (c) 2017 Sony Corporation. 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 applicabl... |
# 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... |
import numpy as np
import tensorflow.compat.v1 as tf
import mesh_tensorflow as mtf
import utils
from rnnlm import RNNOperation
def CreateMeshes(inputs, labels, num_nodes, num_gpus, batch_size):
graph = mtf.Graph()
meshes = []
mesh_to_impl = {}
mesh = mtf.Mesh(graph, 'mesh0')
meshes.append(mesh)
... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# Copyright (c) 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 without ... |
import logging
import os
import platform
import time
from dataclasses import dataclass
from typing import Any, MutableMapping, Optional, Tuple
from weakref import WeakKeyDictionary
try:
from functools import singledispatchmethod
except ImportError:
from singledispatchmethod import singledispatchmethod # type:... |
from os import path
import pandas as pd
import numpy as np
import dateparser
import datetime as dt
from enum import Enum
'''Tools to import both endogeneous and exogeneous data based on known file types.
For each type of data (endogeneous and exogeneous) there is an importer class containing
a single factory method t... |
"""
Implements the ability for SCons to emit a compilation database for the MongoDB project. See
http://clang.llvm.org/docs/JSONCompilationDatabase.html for details on what a compilation
database is, and why you might want one. The only user visible entry point here is
'env.CompilationDatabase'. This method takes an op... |
"""
Flask-Classy
------------
Class based views for the Flask microframework.
:copyright: (c) 2013 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
__version__ = "0.6.8"
import sys
import functools
import inspect
from werkzeug.routing import parse_rule
from flask import request, Respo... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, <NAME>, Inc.
# 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 copyri... |
"""
# Copyright 2022 Red Hat
#
# 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 agr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Group evaluation for Linear Regression with NN-Encoded QPESUMS.
- Read in encoded QPESUMS data
- Read in precipitation data of 45 stations
- Loop through 45 stations
- train with 2013~2015 and evaluate on 2016
"""
import sys, os, csv, logging, argparse, h5py
import nu... |
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for details.
from __fu... |
#!/usr/bin/env python3
import socket
import argparse
import threading
import signal
import json
import requests
import sys
import time
import traceback
from queue import Queue
from contextlib import contextmanager
CLIENT2SERVER = 1
SERVER2CLIENT = 2
running = True
"""
"fast" TLS brute-force
@author: <NAME>
"""
MESS... |
#!/usr/bin/env python3
# coding=utf-8
import argparse
import glob
import os
import sys
from PIL import Image
import numpy as np
import torch
import torch.nn as nn
import torchvision.transforms.functional as F
from torchvision.utils import save_image
from facenet_pytorch import InceptionResnetV1
import vgg_m_face_bn_... |
"""
Elementary Dependency Matching
"""
from typing import Union, List, Tuple, Iterable, Any, NamedTuple
import logging
from collections import Counter
from itertools import zip_longest
from delphin.lnk import LnkMixin
from delphin.eds import EDS
from delphin.dmrs import DMRS
__version__ = '0.1.0'
logging.basicConf... |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from datetime import datetime, timedelta
from io import BytesIO
import pytest
from pytz import utc
from ... |
from enum import auto, IntEnum, Enum
import pytest
from anystrenum import StrEnum, BaseAnyStrEnum, BytesEnum, AnyStrEnumMeta, auto_str, StrItem, BytesItem
from anystrenum.inflected import CamelizeByteEnum, CamelizeStrEnum
class Weekday(StrEnum):
monday: str
tuesday: str
wednesday: str
thursday: str
... |
# Copyright 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... |
from django.dispatch import receiver
from django.db.models import Q, Value, CharField, F
from django.db.models.query import QuerySet
from django.db.models.signals import post_save, m2m_changed
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.models import User
import sys
import logging
... |
# -*- coding: utf-8 -*-
# pylint: disable=expression-not-assigned,line-too-long
"""Meeting, rendezvous, confluence (Finnish kohtaaminen) mark up, down, and up again. API."""
import itertools
import os
import pathlib
import re
import shutil
import sys
import tempfile
import zipfile
from typing import List, Optional, Tup... |
import glob
import os
import shutil
import sys
import unittest
from test.test_support import run_unittest, TESTFN
def fsdecode(s):
return unicode(s, sys.getfilesystemencoding())
class GlobTests(unittest.TestCase):
def norm(self, *parts):
return os.path.normpath(os.path.join(self.te... |
# Copyright 2019 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
from hitchstory.utils import DEFAULT_STACK_TRACE, underscore_slugify
from hitchstory.result import Success, Failure, FlakeResult
from hitchstory.story_step import StoryStep
from hitchstory.given import Given
from hitchstory import exceptions
from hitchstory import utils
from collections import OrderedDict
from slugify ... |
import copy
import os
import multiprocessing as mp
import time
import json
import traceback
import sys
import requests
import pypugjs
import sass
from dizest import util
from dizest.core import kernel
class Instance(util.std.stdClass):
def __init__(self, flow):
self.flow = flow
self.data = dict()
... |
'''
Created on Dec 20, 2010
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
import datetime, re
from arelle import (XPathContext, ModelValue)
from arelle.FunctionUtil import (anytypeArg, atomicArg, stringArg, numericArg, qnameArg, nodeArg)
from arelle.XPathParser imp... |
import sys
import collections
from multiprocessing import Process
import time
from pprint import pprint
from omegaconf import OmegaConf
from pp.placer import save_doe
from pp.placer import doe_exists
from pp.placer import build_components
from pp.placer import load_doe_component_names
from pp.config import CONFIG
fro... |
from .model import model
from .torch_util import Conv2d, Conv3d
from .region_proposal_network import RPN
import torch.nn.functional as F
import torch.nn as nn
import torch
import time
import logging
logger = logging.getLogger('global')
class FCN(nn.Module):
def __init__(self, inplanes, planes):
super(FCN,... |
# -*- coding: utf-8 -*-
"""
Collecting summaries at each iteration of a SMC algorithm.
Overview
========
This module implements "summary collectors", that is, objects that collect at
every time t certain summaries of the particle system. Important applications
are **fixed-lag smoothing** and **on-line smoothing**. ... |
import os
import sys
from datetime import datetime
import time
import numpy as np
import random
import argparse
from shutil import copyfile
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from model.trainer import DGITrainer
from utils.loader import DataLoader,wikiData... |
#!/usr/bin/env python3
###############################################################################
## Dactyl Style Police ##
## Author: <NAME> ##
## Copyright: Ripple Labs, Inc. 2016 ... |
from __future__ import annotations
import os
import time
import shlex
import json
import socket
from datetime import datetime
from time import sleep
from redis import Redis
from typing import Dict, Optional, List
from environments import environment
from micra_store import Coordinator, Listener, retry, Job, uuid, str... |
#!/usr/bin/python
# coding=utf-8
# Python access to Elektro Automatik PS 2000 B devices via USB/serial
#
# Supported features:
# - read static device information (manufacturer, serial, device type ...)
# - read dynamic device information (current, voltage)
# - read/write remote control
# - read/write output control
#
#... |
# $Id$
from Products.PortalTransforms.interfaces import iclassifier
from Products.PortalTransforms.MimeTypeItem import MimeTypeItem, \
MimeTypeException
from types import InstanceType
import re
class text_plain(MimeTypeItem):
__implements__ = MimeTypeItem.__implements__
__name__ = "Plain Text"
mi... |
import numpy as np
import random
def policy_loss(u_sa, mdp_env, opt_u_sa=None):
'''Compute policy loss wrt opt_u_sa'''
if opt_u_sa is None:
#compute optimal policy first
opt_u_sa = mdp.solve_mdp_lp(mdp_env)
return np.dot(opt_u_sa, mdp_env.r_sa) - np.dot(u_sa, mdp_env.r_sa)
def sample_l2_b... |
"""
Tests for the inter-service interactions that occur through the lifetime of an agent device_plugin session
"""
import json
import httplib
import urllib
import urlparse
from chroma_core.lib.util import chroma_settings
settings = chroma_settings()
from Queue import Empty
import time
from chroma_core.models import... |
#!/usr/bin/env python3
import argparse
import copy
import numpy as np
import os
from pathlib import Path
import pdb
from tqdm import tqdm
import uuid
from ab3dmot import AB3DMOT
import argoverse
from argoverse.data_loading.object_label_record import json_label_dict_to_obj_record
from argoverse.data_loading.simple_t... |
import six
import cv2
import torch
import numpy as np
from PIL import Image
from torch.utils.data import Dataset, DataLoader
from torchocr.utils.CreateRecAug import cv2pil, pil2cv, RandomBrightness, RandomContrast, \
RandomLine, RandomSharpness, Compress, Rotate, \
Blur, MotionBlur, Salt, AdjustResolution
cla... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (C) 2005-2007 <NAME>. All rights reserved
# Copyright (C) 2008-2013 <NAME>. All rights reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... |
from typing import (
Iterable,
Sequence,
Tuple,
TYPE_CHECKING,
)
import functools
from eth_utils import (
to_tuple,
ValidationError,
)
from eth_typing import (
Hash32,
)
import eth2._utils.bls as bls
from eth2.beacon._utils.hash import (
hash_eth2,
)
from eth2.beacon.enums import (
... |
####
# Implmentation of syllabification rules
####
####
# Global variables and utilities
####
#French orthography
from os import error
ortho_consonants = {'p', 't', 'k', 'b', 'd', 'g',
'f', 's', 'c', 'v', 'z', 'j', 'm',
'n', 'r', 'l', 'h'}
ortho_vowels = {'a', 'à', 'e', '... |
# modules/AdaptiveInterpolationLayer.py
from torch.nn import Module
import torch
from torch.autograd import Variable
from torch.autograd import gradcheck
from .FilterInterpolationLayer import FilterInterpolationLayer,WeightLayer, PixelValueLayer,PixelWeightLayer,ReliableWeightLayer
__all__ = [
'interpolation'
... |
#
# Copyright (c) 2021, NVIDIA CORPORATION. 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 appl... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
import soundfile as sf
import sys
import torch
imp... |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
"""The data layer used during training to train a Fast R-CNN network.
RoIData... |
#!/usr/bin/python
"""This is an AWS IAM analytics utility to gather all related information to an AWS account."""
# Standard libraries imports
import json
import logging
import sys
import time
# 3rd party libraries import
import boto3
import click
client = boto3.client('iam')
logging.basicConfig(filename='output.lo... |
import json
import os
from concurrent import futures
from functools import partial
from glob import glob
import imageio
import numpy as np
from tqdm import tqdm
from ..base import BatchJobOnContainer
from ..config import get_default_extension
from ..util import barrel_correction, open_file, get_logger
logger = get_l... |
import asyncio
import datetime
import functools
import glob
import json
import os
import typing
import uuid
from typing import Optional, Tuple, cast
from asyncio_extras import async_contextmanager
import tornado.ioloop
import tornado.util
from tornado.locks import Event
from typing_extensions import Protocol
from .... |
from tridesclous import *
from tridesclous.online import HAVE_PYACQ
if HAVE_PYACQ:
from tridesclous.online import *
import pyacq
from pyacq.viewers import QOscilloscope, QTimeFreq
from tridesclous.gui import QT
import pyqtgraph as pg
import numpy as np
import time
import os
import shutil
import ... |
# Copyright 2019 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
from abc import ABC, abstractmethod
from typing import MutableSequence
import numpy as np
from numpy.core.fromnumeric import size, transpose
from scipy.signal.ltisys import LinearTimeInvariant
from .model import Model
from scipy import signal
from si.util.metrics import mse, mse_prime
from si.util.im2col import pad2... |
# imports
from opentrons import protocol_api
from opentrons.commands.commands import blow_out
import tkinter as tk
from tkinter import simpledialog
# metadata
metadata = {
'protocolName': 'Prep BioER Deepwell Plate with E32 Extraction Reagents.',
'author': '<NAME> <<EMAIL>>',
'description': 'Making a BioER... |
###############################################################################
# apogee.spec.continuum: tools for dealing with the continuum
###############################################################################
import copy
import numpy
from apogee.spec import cannon
from apogee.tools import toAspcapGrid, toA... |
r"""Functional interface"""
import math
import torch
from torch import Tensor
from typing import List, Dict
def _make_sparse(grad, grad_indices, values):
size = grad.size()
if grad_indices.numel() == 0 or values.numel() == 0:
return torch.empty_like(grad)
return torch.sparse_coo_tensor(grad_indices... |
from enum import Enum
from typing import Tuple
import traceback
import sys
class UnknownCharacter(Exception):
pass
class CodePosition:
def __init__(self, start_line, end_line, start_column, end_column):
self.start_line = start_line
self.end_line = end_line
self.start_... |
from flask.helpers import make_response
from werkzeug.utils import secure_filename
import os, zipfile, tempfile
class argData:
def __init__(self):
self.argsDict = {}
def setArgs(self, dict):
self.argsDict = dict
def getArgs(self):
return self.argsDict
args = argData()
def analy... |
import torch
import torch.nn as nn
from torch.autograd import Function
class GradReverse(Function):
@staticmethod
def forward(ctx, x, lambda_):
ctx.lambda_ = lambda_
return x.view_as(x)
@staticmethod
def backward(ctx, grad_output):
reversed_scaled_grad = torch.neg(ctx.lambd... |
import os
import binascii
from typing import List, Optional, Dict, Union
from numpy import ndarray
from opics.sparam_ops import connect_s
from opics.components import componentModel
from opics.globals import F
import multiprocessing as mp
def solve_tasks(
data: List,
):
"""
Simulates a connection, either ... |
import codecs
import json
import logging
import os
import re
import sys
import tempfile
import time
import urllib
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
try:
urlencode = urllib.urlencode
except AttributeError:
urlencode = urlparse.urlencode
import zipfile
try:
from ... |
"""Progress bar classes for tracking progress of chains."""
import abc
import html
import sys
from timeit import default_timer as timer
try:
from IPython import get_ipython
from IPython.display import display as ipython_display
IPYTHON_AVAILABLE = True
except ImportError:
IPYTHON_AVAILABLE = False
try... |
import pytest
import operator, os
import common_code
def error_if(f, f_symbol, data_field, actual_values, expected_values,
model_name, errors, all_values, frequency_str):
d = actual_values[data_field]
if f_symbol == '<':
# Every time a value is smaller, update archive_value
archive_value = fl... |
import os
import sys
import json
import glob
import random
from alfworld.agents.utils.misc import Demangler, get_templated_task_desc, add_task_to_grammar
import textworld
import textworld.agents
import textworld.gym
import gym
TASK_TYPES = {1: "pick_and_place_simple",
2: "look_at_obj_in_light",
... |
# Copyright (c) 2017 Intel Corporation. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
from collections import defaultdict
import json
import logging
from django.db import models
from django.db.models import Q
from chroma_core.models import ... |
import string
import random
from collections import Counter
import pytest
from mock import patch, call
import numpy as np
from eight_mile.bleu import (
n_grams,
count_n_grams,
find_closest,
corpora_lengths,
max_gold_n_gram_counts,
count_matches,
count_possible,
geometric_mean,
brevit... |
import numpy as np
from torchvision import datasets, transforms
import random
from torch.utils.data import Subset, RandomSampler
def randomSplit(M, N, minV, maxV):
res = []
while N > 0:
l = max(minV, M - (N-1)*maxV)
r = min(maxV, M - (N-1)*minV)
num = random.randint(l, r)
N -= ... |
"""Functionality for representing data on disk of individual models."""
import logging
import numpy as np
import xarray as xr
from ._constants import RADIUS_EARTH
from . import internal_names
from . import utils
def _get_grid_attr(grid_objs, attr_name):
"""Get attribute from the grid_objs file(s)."""
for xd... |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 22 18:32:01 2020
@author: <NAME>
This python script is to be used for all processing to be done regarding calibration of the five-hole probe.
"""
import importing
import numpy as np
import matplotlib.pyplot as plt
'''Assume data coming in is in the format: Pitch... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
#
# author: <NAME>
# created: May 2001
# file: pygsl/gsl_dist/gsl_extension.py
# $Id: gsl_Extension.py,v 1.6 2015/09/27 06:34:23 schnizer Exp $
#
# module for gsl extensions compilation
from distutils.core import setup, Extension
from distutils.errors import DistutilsModuleError, DistutilsExecError
import os
import os... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import tensorflow as tf
from tensorflow.python.ops.rnn_cell import LSTMStateTuple
import tensorlayerx as tlx
from tensorlayerx import logging
from tensorlayerx.decorators import deprecated, deprecated_alias
from tensorlayerx.backend.ops.load_backend import BACKEND
from ..ini... |
from flask_httpauth import HTTPBasicAuth
from model import *
from sqlalchemy import func, text
from flask_sqlalchemy import SQLAlchemy
from flask import Flask, abort, request, jsonify, g, url_for, json, session
from werkzeug.security import generate_password_hash, check_password_hash
from datetime import datetime
def ... |
#!usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import math
from pathlib import Path
import os
import random
from torch.utils.data import DataLoader
import torch
from torch import nn
from torch import optim
import torchvision
from torchvision import transforms
from fastprogress import m... |
import numpy as np
import torch
from torch import nn, optim
from torchvision.utils import make_grid
from torch.autograd import Variable
from torch.autograd import grad as torch_grad
from torch.utils.data import TensorDataset, DataLoader
from WGAN import Generator, Discriminator
'''
Pytorch implementation of the paper ... |
import asyncio
import os
import re
import subprocess
import sys
import threading
import time
if sys.platform == 'win32':
FFMPEG = 'ffmpeg.exe'
else:
FFMPEG = 'ffmpeg'
cmd_base = [
FFMPEG,
'-y', # Overwrite output file without asking. We'll handle this Python
'-nostdin', # Disallow interactive inpu... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 5 13:54:58 2022
@author: sa-tsdj
"""
import string
import functools
import re
import torch
from torchvision import transforms
import numpy as np
from networks.constructor import SequenceNet
from networks.augment.pytorch_randaugment.rand_augment import RandAugment
f... |
#
# This file is part of LiteX.
#
# Copyright (c) 2018-2019 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
import os
import sys
import subprocess
import shutil
from migen.fhdl.structure import _Fragment
from litex.build.generic_platform import *
from litex.build import tools
from litex.build.microsemi impo... |
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import json
import requests
from distutils.util import strtobool
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' GLOBALS/PARAMS '''
APIKEY = demisto.params().get('apikey'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.