text stringlengths 6.04k 39.5k |
|---|
"""Testing for the tree module."""
# =============================================================================
# Imports
# =============================================================================
# Standard
from itertools import product, chain
# Third party
import numpy as np
import pytest
from sklearn.exc... |
# Copyright (c) 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, so... |
"""
Preprocessing Functions for Tensorflow Keras FCN Image Segmentation Models.
"""
import tensorflow as tf
################################################################################
# List image and mask filepaths function
################################################################################
def l... |
from datetime import datetime, date
from discord import Embed
from discord.ext.commands import Cog, command, Paginator
from imdb import IMDb
from random import choice, randint
from requests import get
from cogs.errors import get_error_message
from cogs.globals import loop
from util.database.database import database
f... |
import dataclasses
import enum
import sphinx.application
import sphinx.environment
from typing import *
T = TypeVar('T')
class Converter:
"""
Converters are used to parse and validate directive and global options.
They are used as a more powerful substitute for helper functions declared
in `rst.di... |
import torch.nn as nn
import copy
import torch
from torch.nn.init import xavier_uniform_
import numpy as np
import torch.nn.functional as F
from model_graph.decoder import TransformerDecoder,TransformerDecoderSent
from model_graph.graph_transformer import GraphTransformer
from model_graph.encoder import RelationEncoder... |
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import json
import os
import re
from typing import List, Tuple, Sequence, Dict, Iterator, Optional
import boto3
import requests # type: ignore
import yaml # type: ignore
REGION = "us-east-1"
ORG_NAME = "<NAME>"
R53_STACK_NAME = "nextflow-r5... |
from collections import defaultdict
from copy import deepcopy
from enum import Enum
from pybbn.graph.edge import JtEdge
from pybbn.graph.graph import Ug
from pybbn.graph.node import SepSet, Clique, BbnNode
from pybbn.graph.potential import Potential, PotentialEntry, PotentialUtil
from pybbn.graph.variable import Varia... |
import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_raises
from ... |
import logging
from collections import ChainMap
from typing import Dict, Tuple, Optional, Union, Iterable
import numpy as np
from autoconf import cached_property
from autofit import exc
from autofit.graphical.factor_graphs.abstract import AbstractNode
from autofit.graphical.factor_graphs.factor import Factor
from aut... |
import contextlib
import asyncio
import glfw
import skia
import math
import io
import os
import re
import hashlib
from urllib.parse import urlparse
from OpenGL import GL
import requests
import twitter_session
import av
from dataclasses import dataclass
import PIL.Image
from typing import BinaryIO, Dict, Union
from sqli... |
'''
bso-v1
threshold condition
'''
import numpy as np
import os
from .dist_bso import MasterClient, WorkerClient, RelayClient
from .es_bso import run_master, run_worker, SharedNoiseTable, setup, RunningStat
from .utils import get_ssh_dict, close_server_redis
import logging
logger = logging.getLogger(__name_... |
import json
import logging
import requests
from django.conf import settings
from django.contrib.gis.db.models.functions import Distance
from django.contrib.gis.geos import GEOSGeometry, Point
from django.core.exceptions import MultipleObjectsReturned
from django.db import transaction
from django.db.models import Q
fro... |
#!/usr/bin/python
import os, sys
import json
import numpy as np
import re
import copy
"""
Name: <NAME>
ID: 16342613
Github:
I have included manual implementations of 5 different problems. The copy library was used to create a deep copy of the
input grid.
"""
### YOUR CODE HERE: write at least three functions... |
# -*- coding: utf-8 -*-
# Copyright (C) 2020-2022 by SCICO Developers
# All rights reserved. BSD 3-clause License.
# This file is part of the SCICO package. Details of the copyright and
# user license can be found in the 'LICENSE' file distributed with the
# package.
"""SciPy optimization algorithms.
.. raw:: html
... |
# -*- coding: utf-8
""" Test the file recognizer capabilities.
"""
from __future__ import print_function, unicode_literals
import contextlib
import gzip
import os
import shutil
import socket
import sys
from io import open
from functools import partial
import nose
from grin import FileRecognizer, GZIP_MAGIC
pri... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
" Selected Units Head."
import torch
import torch.nn as nn
import torch.nn.functional as F
from alphastarmini.lib import utils as L
from alphastarmini.lib.hyper_parameters import Arch_Hyper_Parameters as AHP
from alphastarmini.lib.hyper_parameters import Sta... |
#encoding=utf-8
# modified from https://github.com/huggingface/transformers/blob/master/src/transformers/modeling_bart.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import json
import random
from typing import NamedTuple, Optional, Iterable, Tuple
from transformers imp... |
from HDPython.base import v_classType_t,varSig,InOut_t,join_str,HDPython_base,InoutFlip, v_copy
import HDPython.v_function as ah_func
import HDPython.hdl_converter as hdl
from HDPython.object_factory import impl_constructor
#from HDPython.tests.ex4 import memo
def _get_connector(symb):
if symb._Inout == InOut... |
# SPDX-FileCopyrightText: Copyright 2021, <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileType: SOURCE
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the license found in the LICENSE.txt file in the root directory
# of this source tree.
# =======
#... |
"""
Dubins path planner sample code
author <NAME>(@Atsushi_twi)
The MIT License (MIT)
Copyright (c) 2016 - 2021 <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, incl... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 26 12:06:07 2013
Copyright (c) 2013-2014, CEA/DSV/I2BM/Neurospin. All rights reserved.
@author: <NAME>, <NAME>
@email: <EMAIL>, <EMAIL>
@license: BSD 3-clause.
"""
from six import with_metaclass
import abc
import numpy as np
from .utils import TOLERANCE
from .utils ... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
"""
Signal
======
The signal module constains all kinds of signal processing related functions.
.. inheritance-diagram:: acoustics.signal
Filtering
*********
.. autofunction:: butter_bandpass_filter
.. autofunction:: convolve
Windowing
*********
.. autofunction:: window_scaling_factor
.. autofunction:: apply_wi... |
import numpy as np
import gudhi as gd
from numpy.lib.stride_tricks import as_strided
import tensorflow as tf
from tensorflow.python.framework import ops
import timeit
def compute_dgm(f, card, hom_dim):
"""
Computes the persistence diagram of an image.
:param f: image
:param card: maximum number of bar... |
"""MIT License.
Copyright (c) 2020-2021 Faholan
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, publish, ... |
import json
import multiprocessing as mp
import os
import pickle
import sys
from multiprocessing import Pool
from pathlib import Path
import cv2
import numpy as np
from aiisp_tool.utils.oss_helper import OSSHelper
from imageio import imread, imwrite
from tqdm import tqdm
# if write data to oss
WRITE_TO_OSS = True
OSS... |
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2019 Apple Inc. All Rights Reserved.
#
import os
import time
import argparse
import numpy as np
import torch
import torch.optim
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
import torchvision.models as models
import torch.utils.... |
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from abc import ABC, abstractmethod
class Indicator(ABC):
# abstract Indicator class
# outlines functions required by indicator classes
def __init__(self, ax, xlims):
# All indicators have these attributes initialized
# Make sur... |
import pandas as pd
import numpy as np
import json
import requests
import os.path
import itertools
from time import sleep
base_url = 'https://comtrade.un.org/api/get?'
def download_trade_data(filename, human_readable=False, verbose=True,
period='recent', frequency='A', reporter='USA', partner='all', product='to... |
# Copyright 2018 Hewlett Packard Enterprise Development LP
#
# 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... |
#%% IMPORTS
import time
import imageio
import glob
import os
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from skimage.morphology import remove_small_objects
from IPython.display import clear_output
import monai
from li... |
import SimpleITK as sitk
import paddle
import os.path
import matplotlib.pyplot as plt
# import torch.nn
# from skimage import measure, morphology
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import numpy as np
import scipy.ndimage
import paddle.nn.functional as F
import paddle.fluid as fluid
from paddle.flui... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 13 18:03:09 2021
@author: <NAME>
"""
import numpy as np
from mpl_toolkits.basemap import Basemap
from numpy import pi, sin, cos
from ppigrf import igrf,igrf_gc,RE
from datetime import datetime
from plotly.graph_objs import *
import dash
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology.
# SPDX-FileCopyrightText: © 2021 <NAME> <<EMAIL>>
# NOTICE: authors should document their contributions in concisely in NOTICE
# with details inline in source files... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""Crossword Layout
"""
class IntRect:
"""Integer Rectangle, [left, right), [top, bottom)"""
def __init__(self, left=0, top=0, right=1, bottom=1):
self.left = left
self.top = top
self.right = right
self.bottom = bottom
@proper... |
"""
Classes to simplify and standardize the process of drawing samples from the posterior distribution in
Bayesian inference problems.
"""
import numpy as np
import scipy as sp
class Quad_Sampler(object):
"""
Class for drawing samples from an arbitrary one-dimensional probability distribution using nu... |
# Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import math
import numpy as np
import cv2
import yaml
from test_for_MIDAS import midas_predict
from matplotlib import pyplot as plt
from scipy.optimize import leastsq
def pixel2cam(_p, _K):
return np.array([(_p[0] - _K[0, 2]) / _K[0, 0], (_p[1] - _K[1, 2]) / _K[1, 1]])
def cam2pixel(_p, _K):
return np.array... |
"""
Implementation of hist-varvar
Histograms are used to find an approximate best split per feature.
This was first used in LightGBM, and we took ideas from the reimplementation
here:
https://github.com/ogrisel/pygbm
most of which are explained in this video:
https://www.youtube.com/watch?v=cLpIh8Aiy2w
... |
import xml.etree.ElementTree as ET
import pickle
import os
import re
import sys
import shutil
import math
from os import listdir, getcwd
from os.path import join
import cv2
import numpy as np
car = ["saloon_car", "suv", "van", "pickup"]
other = ["shop_truck", "unknown"]
bicycle = ["bicycle", "motorcycle"]
targettypes... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 11 11:07:56 2019
@author: snagappa
"""
import numpy as np
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import data_loader
import data_... |
#!/usr/bin/env python3
import argparse
import json
import sys
from subprocess import Popen, PIPE
from odf.draw import Image, Frame
from odf.opendocument import OpenDocumentSpreadsheet
from odf.style import Style, TableColumnProperties, TableRowProperties, TextProperties
from odf.table import Table, TableRow, TableCel... |
""" 4.4 OAUTH 2 for devices
Applications that run on devices with limited input capabilities
(such as game consoles, video cameras, and printers) can access a
Compliant API on behalf of a user, but the user must have separate
access to a computer or device with richer input capabilities.
The flow i... |
# Copyright 2019 ChangyuLiu 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... |
"""Gaussian Process classes enabling variational inference of a single GP in GPcalibration."""
# standard imports
import numpy as np
import tensorflow as tf
import gpflow
# Turn off tensorflow deprecation warnings
try:
from tensorflow.python.util import module_wrapper as deprecation
except ImportError:
from t... |
from datetime import datetime
from flask import (
Blueprint,
current_app,
flash,
jsonify,
redirect,
render_template,
request,
url_for
)
from flask_login import (
current_user,
login_user,
login_required,
logout_user
)
from .models import (
Campaign,
Character,
... |
import pygame
import sys
import time
import random
import src
class Square(pygame.sprite.Sprite):
def __init__(self, x, y, screen_height, screen_width, image):
'''
Initalizes Square attributes
args:
x:(int) a number, x coordinate on screen
y:(int) a number, y... |
#1 завдання
import random
number = random.randrange(0,101)
print(number)
#2 завдання
numb = int(input("Введіть рандомне число від 0 до 10: "))
numb2 = random.randrange(0,11)
print("Випадає число: " ,numb2)
if numb == numb2:
print("Ти вийграв!!!")
else:
print("Ти програв =(")
#3 завдання
pryclad = 100 - 50
pri... |
"""
Policy and value networks used in LOLA experiments.
"""
import copy
import tensorflow as tf
import tensorflow.contrib.layers as layers
from tensorflow.python.ops import math_ops
from functools import partial
from .utils import *
class Pnetwork:
"""
Recurrent policy network used in Coin Game experiments.
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import random
import numpy as np
from collections import deque
import os
import torch
from torch import nn, tensor
import torch.nn.functional as F
import torch.optim as optim
from curious_agent.agents.agent import Agent
from curious_agent.models.dqn_model import DQN
from... |
# Original algorithm was published by <NAME> and colleagues as EmptyDrops (Lun, A. et al. Distinguishing cells from empty droplets in droplet-based single-cell RNA sequencing data.)
# This implementation is based on the code in cellranger v3.0 by 10x Genomics
# Copyright 2018 10X Genomics, Inc.
#
# Permission is here... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Battelle Energy Alliance, LLC. All rights reserved.
###################################################################################################
# Process queued files reported by pcap_watcher.py, using either moloch-capture or zeek to proces... |
import os
import torch.nn.functional as F
import torch
import numpy as np
import torch.nn as nn
def reset_checks(state):
for mode_i, (mode, dataset) in enumerate(zip(state["net_mode"],state["dataset_mode"])):
state["last_measured"][mode_i] = 0
def init(state,event):
event.rng_save()
if state["du... |
#!/usr/bin/env python
# coding: utf-8
# # SentencePiece and BPE
# ## Introduction to Tokenization
# In order to process text in neural network models it is first required to **encode** text as numbers with ids, since the tensor operations act on numbers. Finally, if the output of the network is to be words, it is r... |
"""Project: Eskapade - A python-based package for data analysis.
Class: HistogramFillerBase
Created: 2017/03/21
Description:
Algorithm to fill histogrammar sparse-bin histograms.
It is possible to do cleaning of these histograms by
rejecting certain keys or removing inconsistent data types.
Timestamp... |
import operator
""" Spec """
def GetIndexLevel(index_name, remaining_indices):
# Omit index if it only occurs once in the mapping.
# if all_indices.count(index_name) == 0:
# return None
cnt = remaining_indices.count(index_name)
if cnt:
return cnt - 1
else:
return None
re... |
# -*- coding: utf-8 -*-
from __future__ import division
"""
roi_primitives.py
========================
Module containing wrapper classes to work with ROI objects
Requirements
==================================
- the path to Python library that ships with OMERO.server
References
==========
* Model Overview: http://... |
import bisect
from copy import deepcopy
from Bio.Seq import Seq
from mutalyzer_crossmapper import Coding, Genomic, NonCoding
from mutalyzer_mutator.util import reverse_complement
from ..description_model import (
variant_to_description,
variants_to_description,
yield_sub_model,
)
from ..reference import (... |
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
import numpy as np
from utils import *
from taskcv_loader import CVDataLoader
from basenet... |
"""A representation of the configuration form we expect to receive from EpiViz.
The hope is that this form will do as much validation and precondition checking
as is feasible within the constraint that it must be able to validate a full
EpiViz parameter document in significantly less than one second. This is
because it... |
#!/usr/bin/env python
import os
import yaml
import string
import re
import wx
import wx.adv
from datetime import date, timedelta
from cash_flow.transaction import Transaction
from cash_flow.transaction_store import TransactionStore
from cash_flow.cash_flow import CashFlow
def wxDate2pyDate(wxdate):
return date(wx... |
import gzip
import os
import re
import subprocess
import sys
import numpy as np
def multitask_bed_generation(
target_beds_file,
feature_size=1000,
merge_overlap=200,
out_prefix="features",
chrom_lengths_file=None,
db_act_file=None,
db_bed=None,
ignore_auxiliary=False,
no_db_activi... |
#!/usr/bin/env python
__copyright__ = """
Machine Learning for Distributed Acoustic Sensing data (MLDAS)
Copyright (c) 2020, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of
any required approvals from the U.S. Dept. of Energy). All rights reserved.
If ... |
"""
autorecon1.py
=================
Description:
Author:
Usage:
"""
import sys
import os
import errno
import nipype
from nipype.interfaces.utility import Function, IdentityInterface
import nipype.pipeline.engine as pe # pypeline engine
from nipype.interfaces.freesurfer import *
def verify_inputs(T1sList):
##T... |
#! /usr/bin/env python
import rospy
import numpy as np
import scipy.optimize
import openravepy as orpy
import tf.transformations as tr
X_AXIS = np.array([1., 0., 0.])
Y_AXIS = np.array([0., 1., 0.])
Z_AXIS = np.array([0., 0., 1.])
class Plane(object):
"""Represents a plane defined by a normal vector through the giv... |
'''
Created on Dec 23, 2014
@author: <NAME>
'''
import string
import hashlib
from datetime import datetime
from nltk import *
class TweetProcess:
"""class for processing the textual content of a tweet"""
def __init__(self,tweet):
"""Constructor method for TweetTextProcess"""
#json fo... |
import numpy as np
import joblib
import torch
from torch import nn
from torch.autograd import Variable
from .gru import GRUCell, GRUODECell
class ForecastRNN(nn.Module):
"""
Helper for pytorch reimplementation
Uses variable sized/depth GRU with linear layer to get output right
"""
def __init__(s... |
from __future__ import absolute_import
# development system imports
import os
import random
import uuid
from datetime import date, datetime, timedelta
from decimal import Decimal
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.humanize.templatetags import human... |
"""
"""
import csv
import datetime
import gzip
import os
import time
import numpy as np
import tensorflow as tf
import qdraw.dataset as dataset
import qdraw.dataset_iterator as dataset_iterator
def build_model(data):
"""
"""
FLAGS = tf.app.flags.FLAGS
# NOTE: choose model
if FLAGS.model == 'mob... |
from __future__ import division, print_function
import os
import sys
import time
from collections import defaultdict, deque
from functools import partial
from builtins import map, range
import re
import six
import pandas as pd
from tgirt_map.trim_function import fastp_trimming, atropos_trimming
class sample_object():
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# Для отлова всех исключений, которые в слотах Qt могут "затеряться" и привести к тихому падению
def log_uncaught_exceptions(ex_cls, ex, tb):
import traceback
text = '{}: {}:\n'.format(ex_cls.__name__, ex)
text += ''.join(traceback.fo... |
# -*- coding: utf-8 -*-
from tkinter import *
from tkinter import ttk, messagebox
from sqlite3 import Error, connect
import os
def agenda():
"""
#### Estabelece a conexão com o banco de dados Agenda.db
"""
dirdb = os.path.dirname(__file__)
nomedb = dirdb + '/Agenda.db'
con = connect(nomedb... |
import sys
import gym.spaces
import itertools
import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as layers
from collections import namedtuple
from dqn_utils import *
OptimizerSpec = namedtuple("OptimizerSpec", ["constructor", "kwargs", "lr_schedule"])
# Taken from SO answer ht... |
# coding=utf8
"""
rss.py - Willie RSS Module
Copyright 2012, <NAME>, yanovich.net
Licensed under the Eiffel Forum License 2.
http://willie.dfbta.net
"""
from __future__ import unicode_literals
from datetime import datetime
import time
import re
import socket
import feedparser
from willie.module import commands, int... |
"""
MultiCall - a class which inherits its methods from a Tkinter widget (Text, for
example), but enables multiple calls of functions per virtual event - all
matching events will be called, not only the most specific one. This is done
by wrapping the event functions - event_add, event_delete and event_info.
MultiCall r... |
"""Implements direct fidelity estimation.
Fidelity between the desired pure state rho and the actual state sigma is
defined as:
F(rho, sigma) = Tr (rho sigma)
It is a unit-less measurement between 0.0 and 1.0. The following two papers
independently described a faster way to estimate its value:
Direct Fidelity Estima... |
"""Repository."""
# pylint: disable=broad-except, bad-continuation, no-member
import pathlib
import json
import os
import tempfile
import zipfile
from integrationhelper import Validate, Logger
from aiogithubapi import AIOGitHubException
from .manifest import HacsManifest
from ..helpers.misc import get_repository_name
f... |
# Copyright (c) 2020
# Author: xiaoweixiang
from __future__ import absolute_import, unicode_literals
import io
import os
import sys
import warnings
import functools
from collections import defaultdict
from functools import partial
from functools import wraps
from importlib import import_module
from distutils.error... |
"""Utilities to download a file. Heavily copied from MNE-python."""
import os
import os.path as op
from subprocess import check_output
from six.moves import urllib
from zipfile import ZipFile
import tarfile
import logging
from math import log, ceil
import time
import sys
import shutil
import tempfile
import ftplib
from... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__doc__ = r"""
Created on 22/03/2020
"""
import copy
import json
import logging
import numpy
import pycocotools.mask
import torch
import torch._six
import torchvision
from collections import defaultdict, namedtuple
from dateti... |
#!/usr/bin/env python
''' Tool for sorting imports alphabetically, and automatically separated into sections.
Copyright (C) 2013 <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 r... |
# coding:utf-8
from gen_captcha import gen_captcha_text_and_image
from constants import IMAGE_HEIGHT
from constants import IMAGE_WIDTH
from constants import MAX_CAPTCHA
from constants import CHAR_SET_LEN
import numpy as np
import tensorflow as tf
import sys
import matplotlib.pyplot as plt
"""
cnn在图像大小是2的倍数时性能最高, 如果你用... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import pytest
import spack.directives
import spack.fetch_strategy
import spack.repo
from spack.paths import mo... |
"""Abstract Syntax Tree handler"""
# These are imported into our module namespace for the benefit of parser.py.
# pylint: disable=unused-import
import itertools
import sys
# pylint: enable=unused-import
import textwrap
from ast import (
AST,
Add,
And,
AnnAssign,
Assert,
Assign,
AsyncFor,
... |
#
# Copyright (c) 2017 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Imported by pytest at the start of every test session.
# Fixture Goals
Fixtures herein are made available to every test collected by pytest. They are
designed with the following goals in mind:
- Running ... |
import argparse
import logging
import os
import random
import socket
import sys
import traceback
import numpy as np
import psutil
import setproctitle
import torch
import wandb
from mpi4py import MPI
# add the FedML root directory to the python path
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../.... |
from __future__ import unicode_literals
from future.builtins import int, str
from json import dumps
from django.contrib.auth.decorators import login_required
from django.contrib.messages import info
from django.urls import reverse
from django.db.models import Sum
from django.http import Http404, HttpResponse
from dja... |
import torch.nn as nn
import torch.nn.functional as F
import torch.distributions as distributions
import numpy as np
import torch
from aux.common import DummyNormalizer, DummyStateScaler, CustomStateScaler
# Making a cache of random actors so that the code is a bit streamlined and cleaner at this point. Changing oth... |
import signal
import sys
import unittest
import warnings
from unittest import mock
import asyncio
from asyncio import base_subprocess
from asyncio import subprocess
from test.test_asyncio import utils as test_utils
from test import support
if sys.platform != 'win32':
from asyncio import unix_events
... |
'''
'''
import keras
import tensorflow as tf
from keras.models import Model
from keras import backend as K
from keras.layers import Input, merge, Conv2D, ZeroPadding2D, UpSampling2D, Dense, concatenate, Conv2DTranspose
from keras.layers.pooling import MaxPooling2D, GlobalAveragePooling2D, MaxPooling2D
from keras.lay... |
import collections
import redis
import numpy as np
from representations import StateAction
import random
from textworld.core import EnvInfos
GraphInfo = collections.namedtuple('GraphInfo', 'objs, ob_rep, act_rep, graph_state, graph_state_rep, admissible_actions, admissible_actions_rep')
def load_vocab(env):
with ... |
# type: ignore
import typing
from typing import Callable, Tuple, Union
import operator
from functools import reduce
from itertools import chain, zip_longest
from mat2py.common.backends import numpy as np
class End:
def __init__(self, expr=None):
self.expr = expr if expr is not None else [None]
def ... |
# Copyright 2020 The Microsoft DeepSpeed Team
"""
DeepSpeed runner is the main front-end to launching multi-worker
training jobs with DeepSpeed. By default this uses pdsh to parallel
ssh into multiple worker nodes and launch all the necessary processes
per rank for training.
"""
import os
import sys
import json
import... |
# 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
#
# Unless required by applicab... |
import sqlite3
from .validations import type_pos_int, type_non_neg_int, expect_in, expect_type, expect_len_range, cast_expect_type
from .shared_exceptions import StatusMessageException
def _process_values(values, processors, column_list, context):
if not values or not processors:
return values
if is... |
# from collections import defaultdict
import datetime
import json
import logging
import os
# import re
import time
import uuid
from functools import partial
from pathlib import Path
# from django.conf import settings
from django.db import models as m
from django.contrib.auth.models import AbstractUser, UserManager as ... |
# 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
from chroma_core.services.job_scheduler.job_scheduler_client import JobSchedulerClient
from django.db.models import Q
... |
#
# Copyright (c) 2021, NVIDIA 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.