text stringlengths 6.04k 39.5k |
|---|
import tensorflow as tf
import tensorflow_addons as tfa
from models.gated_scnn.gated_shape_cnn.model.layers import gradient_mag
@tf.function(experimental_relax_shapes=True)
def _generalised_dice(y_true, y_pred, eps=0.0, from_logits=True):
"""
:param y_true [b, h, w, c]:
:param y_pred [b, h, w, c]:
:par... |
import jsonlines
import re
from tqdm import tqdm
import os
from score_parser_spans import load_spans
import argparse
import stanza
import logging
def get_config():
"""
Configuration for which token processing will be computed.
"""
config_parser = argparse.ArgumentParser()
config_parser.add_argumen... |
#!/usr/bin/env python3
#coding: utf-8
import requests
import json
import re
from clir_texts import CLIRtexts
import sys
import io
import os
from urllib.parse import parse_qs, quote
import locale
lstripchars = '!"“#$%&\'’)*+,-–./:;=?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
rstripchars = '!"„#$%&\'’(*+,-–./:;=?@[\\]^_`{|}~ \t\n\r\... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 18 09:53:27 2016
@author: dreadnought
"Brevity required, prurience preferred"
"""
import sys
import json
from PyQt4 import QtGui
import pyqtgraph as pg
from three_step_first_ui import Ui_Form
import numpy as np
import scipy.interpolate as spi
import matplotlib.pyplot a... |
"""
Filter reads based on quality scores
"""
import collections
import csv
import itertools
import logging
import os
import sys
import time
from Bio import SeqIO
try:
from Bio import trie, triefind
except ImportError:
trie = None
triefind = None
from Bio.SeqIO import QualityIO
from seqmagick import filef... |
# -*- coding: utf-8 -*-
import copy
from subprocess import Popen, PIPE
import subprocess
import os
import math
import wave
import contextlib
import shutil, pipes
import re
import sys
import stat
import hashlib
import locale
import operator as op
from os.path import normpath
from itertools import takewhile
# you need... |
from utils import *
from random import choice
def read_snap_shot_volume_one_hour(fname):
leida_time_volume = {}
data = pd.read_csv(fname, encoding="gbk",keep_default_na=False)
slice_data = data.iloc[:,0]
for i in range(len(slice_data)):
time_snap = int(data.iloc[i][0].split(":")[0])
... |
from ._databucket import dataHolder
import os
import copy
import numpy as np
import pandas as pd
import seaborn as sns
from tqdm.notebook import tqdm
import matplotlib.pyplot as plt
from IPython.display import display
from warnings import filterwarnings
from statsmodels.tsa.stattools import kpss
from statsmodels.tsa.s... |
#! python3
# -*- coding: utf-8 -*-
"""
:Purpose: get log backup job and complete the job.
:author: Lei.Wang,
:copyright: Orientsoft Co., Ltd.
:comments: ErrorCode -1xxx
"""
import paramiko
import sys
import os
import traceback
import re
import subprocess
from datetime import datetime
import pymongo
from bson ... |
import io
import os
import json
import base64
import numpy as np
import matplotlib.pyplot as plt
import math
from PIL import Image
coco_dataset = {"person": 1, "bicycle": 2, "car": 3, "motorcycle": 4, "airplane": 5, "bus": 6,
"train": 7, "truck": 8, "boat": 9, "traffic light": 10, "fire hydrant": 11, "street sign": 12... |
import json
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from djblets.db.query import LocalDataQuerySet
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import (webapi_login_required,
webapi_request_fie... |
import os
import io
import re
import time
import logging
import requests
import pdfplumber
import subprocess
import numpy as np
import pandas as pd
import urllib.request
from bs4 import BeautifulSoup
from io import BytesIO, StringIO
from html.parser import HTMLParser
from haystack.preprocessor.utils import convert_file... |
"""
This is the workhorse of the scenario demos.
"""
import json
import asyncio
import logging
import requests
from time import monotonic
from datetime import datetime, timedelta
import uvicorn
from pydantic import BaseModel
from fastapi import FastAPI, HTTPException
from scenarios.apartment.apartment import Apartmen... |
# -*- coding: utf-8 -*-
import argparse
import re
import binascii
class FSM():
"""This class represents the FSM read from model. It contains the states, initial state and transition matrix."""
def __init__(self, states, transMatrix, initial, protofile):
self.states = states
self.transMatrix = ... |
# /*
# * Copyright (c) 2019,2020,2021 Xilinx Inc. All rights reserved.
# *
# * Author:
# * <NAME> <<EMAIL>>
# * <NAME> <<EMAIL>>
# *
# * SPDX-License-Identifier: BSD-3-Clause
# */
from enum import IntEnum
class REQ_USAGE(IntEnum):
REQ_NO_RESTRICTION = 0
REQ_SHARED = 1
REQ_NONSHARED = 2
REQ_TI... |
# Authors: CommPy contributors
# License: BSD 3-Clause
import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as splg
__all__ = ['build_matrix', 'get_ldpc_code_params', 'ldpc_bp_decode', 'write_ldpc_params',
'triang_ldpc_systematic_encode']
_llr_max = 500
def build_matrix(ldpc_code_param... |
import numpy as np
import pprint as pp
import torch
from torch_geometric.data import DataLoader
# from nets.critic_network import CriticNetwork
from options import get_options
from train import get_inner_model, evaluate
from policy.attention_model import AttentionModel
from policy.ff_model import FeedForwardModel
f... |
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019-2020 shmilee
'''
Some tools for Core.
'''
import numpy as np
from .glogger import getGLogger
__all__ = ['max_subarray', 'line_fit', 'curve_fit',
'argrelextrema', 'intersection_4points',
'near_peak', 'high_envelope',
'fft', 'fft2', 'savgo... |
###
#
# Lenovo Redfish Library - AccountClient Class
#
# Copyright Notice:
#
# Copyright 2020 Lenovo 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... |
"""collect: extensions to create frequently used collections of objects."""
import collections
class GenIsUsed(object):
def __init__(self,parent,callers=[]):
self.c = callers
self.pa = parent._inx.iref_by_sect[parent.uid].a
def __call__(self):
if len(self.c ) == 0:
return True
for c in self... |
import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import RandomForestRegressor
from sklearn.utils import shuffle
from joblib import dump, load
from scoring import score_prediction
from feature_engineering ... |
"""
Metadata Navigator
==================
metadatanavigator.py
======
All the logic behind the tool.
The init script will handle config and command line arguments and call the specific functions to configure the tool.
For both modes (interative/pipe) the init script (mnavigator.py) will call the function mnavigator... |
import os
import requests
import bibtexparser
import tempfile
from pprint import pprint
from time import strptime
import pybtex
import pybtex.database.input.bibtex
import pybtex.plugin
import biblib.bib
import xml.etree.ElementTree as ET
from bs4 import BeautifulSoup
import re
import frontmatter
import unicodedata
imp... |
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
"""The Dataset is stored in a csv file, so we can use TFLearn load_csv() function to load the data from
file into a python list. We specify 'target_column' argument to indicate that our labels (survived or not)
are located in the first column (id: 0). The function will return a tuple: (data, labels)."""
import os
imp... |
import torch
from torch import nn
from torch.nn import functional as F
import logging
class GatedConv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation=1):
super(GatedConv2d, self).__init__()
self.conv = nn.Conv2d(in_channels, 2 * out_channels, ke... |
import numpy as np, os, itertools
import pandas as pd
from rpy2 import robjects
import rpy2.robjects.numpy2ri
rpy2.robjects.numpy2ri.activate()
import rpy2.robjects.pandas2ri
from rpy2.robjects.packages import importr
from selection.adjusted_MLE.cv_MLE import (sim_xy,
selInf... |
"""
Methods to facilitate the formulation and solution to a specific flavor of the
Hospital/Resident matching problem used for matching
`Hidden Genius Project (HGP) <https://www.hiddengeniusproject.org/>`_ mentors
to mentees.
The conventional hopsital/resident matching problem requires a secondary
procedure for handli... |
from __future__ import print_function
import itertools
import logging
import sys
from collections import defaultdict
from functools import reduce
import numpy as np
from orderedset import OrderedSet
from acc_utils.errors import CompilerError
from acc_utils.model_utils import div_ceil
from config import cfg
from gene... |
from __future__ import print_function
import copy
import numpy as np
import rospy
import torch
import actionlib
from collections import deque
from enum import Enum, unique
from semnav.learning import get_net, merge_input_tensors
from semnav.learning.behavior_net.behavior_evaluator import BehaviorEvaluator
from semn... |
""" Tests for fields """
import six
import zlib
from datetime import datetime, date
import json
from decimal import Decimal
from flywheel.fields.types import DictType, register_type, DateTimeType, UTC
from flywheel import (Field, Composite, Model, NUMBER, BINARY, STRING_SET,
NUMBER_SET, BINARY_S... |
from zeit.cms.content.cache import content_cache, cached_on_content
from zeit.cms.content.property import ObjectPathAttributeProperty
from zeit.cms.i18n import MessageFactory as _
from zeit.content.cp.interfaces import (
IAutomaticTeaserBlock, ICenterPage, ITeaserBlock)
import gocept.lxml.interfaces
import grokcore... |
import logging
from datasets.dataset import Dataset
from util import run_system_command, fcall, ensure_path
from util import load_dataset, parse_line_csv, parse_csv
from util import remove_folder, multi_process
from pprint import pprint as pp
import xml.etree.ElementTree as ET
import os
from sys import platform
from p... |
import numpy as np
import numpy.matlib
import pdb
import pickle
import os
import datetime as dt
import glob
import matplotlib.dates as mdates
import matplotlib.colors
import matplotlib.pyplot as plt
from argparse import ArgumentParser
"""
Plot multi-frequency returns as a function of altitude and time
"""
def save_d... |
import asyncio
import hashlib
import logging
import tempfile
import aiohttp
import aiohttp_socks
import synapse.exc as s_exc
import synapse.common as s_common
import synapse.lib.cell as s_cell
import synapse.lib.base as s_base
import synapse.lib.const as s_const
import synapse.lib.share as s_share
import synapse.lib... |
# coding=utf-8
import numpy as np
import scipy.linalg
from ..dataset import DataSet
from . import BaseNode
from ..utils import get_samplerate
import itertools
def create_sin_cos_matrix(freqs, nharmonics, sample_rate, nsamples):
'''
Construct matrix labels with on the columns sines and cosines of th... |
from collections import OrderedDict
import os
from pathlib import Path
import shutil
import moviepy.audio.fx.all as afx
import pyperclip
import pysrt
from hew.util import (
format_timedelta, format_timedelta_range, remove_tags, Scheme,
tempfile_path, downloads_path, sha1of)
scheme = Scheme()
@scheme
def t... |
import torch
import torch.nn.functional as F
from torch.autograd import Function
import numpy as np
from utils.general import chamfer_dist, chamfer_dist_mask
from utils.quaternion import q_to_euler
class HLoss(Function):
@staticmethod
def forward(ctx, p1_vec, p2_vec, p1_loss, p1_act):
output = (1 - p... |
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import numpy as np
import os
import tensorflow as tf
from ..utils.circular_buffer import CircularBuffer
__author__ = '<NAME>'
class Trainer(object):
def __init__(self,
model,
opti... |
from abc import ABC, abstractmethod
from msdm.algorithms.entregpolicyiteration import entropy_regularized_policy_iteration
from msdm.core.problemclasses.mdp import TabularPolicy
from torch.utils.data.dataloader import DataLoader
from dataset import TrajectoryDataset, FeaturesDataset
import torch
import numpy as np
from... |
##########################################################################
# MediPy - Copyright (C) Universite de Strasbourg
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for de... |
#! /usr/bin/python
#
# gridwords.py
#
# Usage:
# gridwords.py
#
# Create and fill crossword puzzle grids.
#
import logging
import os
import re
import sys
import tkinter as tk
# Import functions from local modules
from handle_files import open_file, save_file
from indices import Entry, updateClueIndices, spreadInd... |
#!/usr/bin/python3
#######################
# Py3dEngine
#######################
# Copyright (c) 2019 <NAME>., MIT License
#######################
import pyglet
from pyglet.gl import *
from pyglet.window import key, mouse
import sys
sys.setrecursionlimit(10000)
import math
import random
random.see... |
# Copyright (c) 2014, <NAME>
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
'''
Unit tests for the FetchTokeniser and FetchParser classes
'''
from __future__ import unicode_literals
from datetime import datetime
from textwrap import dedent
from imapclient.fixed_offs... |
#
# Author: <NAME>
# Date: 23.02.2021
#
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Conv2D, Layer, UpSampling2D, BatchNormalization, MaxPool2D, Conv2DTranspose, ReLU, LayerNormalization
from tensorflow.keras.regularizers import l2
class RandomizedLayerNormalization(L... |
import os, random, shutil
import numpy as np
import math
import yaml
import time
import pickle
import traceback
import socket
import psutil
import random
from gym_env.feature_processors.enums import *
def openai_sample(pd):
noise = np.random.uniform(pd + 1e-8)
mask = np.where(pd == 0.0, 0, 1)
pd_with_nois... |
"""
Image segmentation task
This program loads manually labbelled wave image data and classify
each pixel in the image into "breaking" (1) or "no-breaking" (0).
The data needs to be in a folder which has sub-folders "images" and "masks"
For example:
```
└───data
├───images
├───masks
```
The n... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from six import string_types
import re
import datetime
import unidecode
class RFCGeneral(object):
"""
General Functions for RFC, Mexican Tax ID Code (Registro Federal de Contribuyentes),
Variables:
general_regex:
a regex upon which all valid RF... |
# Copyright 2020 The Feverbase Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
# -*- coding: utf-8 -*-
from struct import *
BLENDMODES = {
'pass through' : 'pass',
'normal' : 'norm',
'dissolve' : 'diss',
'darken' : 'dark',
'multiply' : 'mul ',
'color burn' : 'idiv',
'linear burn' : 'lbrn',
'darker color' : 'dkCl',
'lighten' : 'lite',
'screen' ... |
# !/usr/bin/python
# -*- coding:utf-8 -*-
# @author : GaiusPluto
# @time : 2022/1/23 8:58
# @version : 1.0
import base64
import hashlib
import json
import os
from urllib import parse
import uuid
import oss2
import pyDes
import requests
from Crypto.Cipher import AES
from send_msg.send_wechat import send
# from C... |
import re
import ast
from dissect.cstruct.compiler import Compiler
from dissect.cstruct.exceptions import ParserError
from dissect.cstruct.expression import Expression
from dissect.cstruct.types.base import Array
from dissect.cstruct.types.structure import Structure, Field, Union
from dissect.cstruct.types.flag import ... |
import os
import copy
import torch
import random
import json
import numpy as np
from data_reader.utils import _naive_tokenize, _tokenize, _find_subword_indices
import config
import warnings
warnings.filterwarnings("ignore")
def get_files(typ='train'):
if typ == 'train':
files = [os.path.join(config.DATA_DI... |
from __future__ import division
import pandas as pd
import numpy as np
import multiprocessing
import sys
import time
import click
import operator
from .stats import (lookup_values_from_error_table, error_statistics,
mean_and_std_dev, final_err_table, summary_err_table,
posterior_... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Preprocess ieee-fraud-detection dataset.
(https://www.kaggle.com/c/ieee-fraud-detection).
Train shape:(590540,394),identity(144233,41)--isFraud 3.5%
Test shape:(506691,393),identity(141907,41)
############### TF Version: 1.13.1/Python Version: 3.7 ###############
"""
imp... |
"""`language_code_utils.py` - utilty methods for dealing with fasttext language codes.
Some of the less common language code mappings were found in the iso639 library:
https://github.com/noumar/iso639
"""
import logging
from typing import Any, Tuple
from numpy import array
LOG = logging.getLogger(__name__)
LOG.addHan... |
### https://github.com/zhiwehu/Python-programming-exercises/blob/master/100%2B%20Python%20challenging%20programming%20exercises.txt
def Q1():
'''
Question:
Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5,
between 2000 and 3200 (both included).... |
'''
Traffic Assignment in python.
'''
import math
import csv
_MAX_LABEL_COST = 10000
g_node_list = []
g_agent_list = []
g_link_list = []
g_internal_node_id_dict = {}
g_external_node_id_dict = {}
g_number_of_nodes = 0
g_number_of_links = 0
g_number_of_agents = 0
class Node:
def __init__(self):
... |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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... |
#!/usr/bin/env python4
# This is the basic aaalgo tensorflow model training framework.
import errno
import os
import sys
import subprocess
AARDVARK_HOME = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(AARDVARK_HOME, 'zoo/slim'))
from abc import ABC, abstractmethod
os.environ['TF_CPP_MIN_LOG_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 15 21:53:56 2021
@author: bmoseley
"""
# This module defines trainer classes for FBPINNs and PINNs. It is the main entry point for training FBPINNs and PINNs
# To train a FBPINN / PINN, use a Constants object to setup the problem and define its hyp... |
import os
import shutil
import lasio
import openpyxl
import xlwt
import xlrd
from copy2 import copy2
from openpyxl import Workbook
from openpyxl.styles import Alignment, Font, PatternFill
from pandas import DataFrame
from openpyxl.utils.dataframe import dataframe_to_rows
from openpyxl.utils import get_column_letter
fr... |
import os
import sys
use_cntk = True
if use_cntk:
try:
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
base_directory = os.path.split(sys.executable)[0]
os.environ['PATH'] += ';' + base_directory
import cntk
os.environ['KERAS_BACKEND'] = 'cntk'
except ImportError:
prin... |
#!/usr/bin/env python3
"""Fasta oneLine <-> N, trim, rm sequences, build tree."""
import argparse
import sys
import os
import re
import subprocess
from collections import Counter, defaultdict
__author__ = '<NAME>, 2018'
# genetic code if translation is needed
nta = {"TTT": "F", "TTC": "F", "TTA": "L", "TTG": "L",
... |
# codes in this file are reproduced from https://github.com/GraphNAS/GraphNAS with some changes.
from torch_geometric.nn import (
GATConv,
GCNConv,
ChebConv,
SAGEConv,
GatedGraphConv,
ARMAConv,
SGConv,
)
import torch_geometric.nn
import torch
from torch import nn
import torch.nn.functional ... |
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import cv2
from skimage.feature import hog
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
import os
from glob import glob
def print_image_properties(image):
print("Shape:\t\t"... |
import warnings
warnings.filterwarnings("ignore")
import os
import math
import numpy as np
import tensorflow as tf
import pandas as pd
import argparse
import json
from sklearn.model_selection import StratifiedKFold
from sklearn.preprocessing import StandardScaler
from sklearn.manifold import TSNE
from scipy.stats imp... |
import sys
import keras
import numpy as np
import pandas as pd
import tensorflow as tf
import timeit
import time
import datetime
from matplotlib import pyplot
import matplotlib.pyplot as plt
import seaborn as sns
import influxdb_client
from influxdb import InfluxDBClient
from sklearn import preprocessing... |
import json
import os
import time
import tensorflow as tf
from tqdm import trange
from config import MovieQAConfig
from legacy.get_dataset import MovieQAData
from model import VLLabMemoryModel
from utils import data_utils as du
from utils import func_utils as fu
config = MovieQAConfig()
class TrainManager(object):... |
"""
Author: <NAME> <<EMAIL>>
LIT: Lightweight Iterative Trainer
"""
import os
import time
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.cuda
import torch.optim
import torch.utils.data
from tqdm import tqdm
from model_pa... |
# -*- coding: UTF8
'''
Created on 19.08.2015
@author: mEDI
'''
__defaultUpdateTime__ = 1000 * 30
import logging
import sys
try:
from _version import __buildid__, __version__, __builddate__, __toolname__, __useragent__
except ImportError:
__buildid__ = "UNKNOWN"
__version__ = "UNKNOWN"
... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... |
from dbConnector import dbConnector
from telegram.ext import CommandHandler, MessageHandler, Updater, Filters, ConversationHandler, CallbackQueryHandler
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
from pyparsing import *
#from staszek import staszek
import logging
import sys
import os
from r... |
import struct
import socket
import os.path
from binaryninja.architecture import Architecture
from binaryninja.binaryview import BinaryView
from binaryninja.enums import (BranchType, InstructionTextTokenType,
SegmentFlag, SectionSemantics)
from binaryninja.function import RegisterInfo, In... |
# Copyright 2015 Brocade Communications System, 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
#
#... |
#!/usr/bin/env python
import rospy
import numpy as np
import math
import time
import mpl_toolkits.axes_grid1
import matplotlib.pyplot as plt
import matplotlib.animation as anim
import matplotlib.gridspec as gridspec
from mpl_toolkits.mplot3d import proj3d
from sensor_msgs.msg import JointState
from mpl_toolkits import ... |
"""Utilities to interpret the pipeline poller obset information and generate product filenames
The function, interpret_obset_input, parses the file generated by the pipeline
poller, and produces a tree listing of the output products. The function,
parse_obset_tree, converts the tree into product catagories.
"""
impo... |
#!/usr/bin/env python3
from torch.nn.parallel import DistributedDataParallel as DDP
from gibson2.utils.assets_utils import get_scene_path
from torch.utils.tensorboard import SummaryWriter
from gibson2.envs.igibson_env import iGibsonEnv
from gibson2.utils.utils import parse_config
import torch.multiprocessing as mp
imp... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 5 21:32:52 2017
@author: hsd
"""
import numpy as np
from scipy import stats
import ReadData
##################################################
### tools
##################################################
def LongThresCrossing(ts, thres):
cnt = 0
pair_flag = 1
... |
from cryptography.fernet import Fernet
import http.server
import requests
from socket import *
import threading
import time
import base64
import json
import typing
import copy
import traceback
from peerbase.peer_utils import *
import random
import hashlib
from concurrent.futures import ThreadPoolExecutor
def process_... |
"""
Implementation of paper: "Rethink Dilated Convolution for Real-time Semantic Segmentation", https://arxiv.org/pdf/2111.09957.pdf
Based on original implementation: https://github.com/RolandGao/RegSeg, cloned 23/12/2021, commit c07a833
"""
from typing import List
import torch
import torch.nn as nn
from super_gradien... |
# https://python-course.eu/advanced-python/generators-iterators.php
"""
Generators are a special kind of function, which enable us to implement or generate iterators.
Mostly, iterators are implicitly used, like in the for-loop of Python.
"""
# An list is not an iterator, but can be used as an iterable
import random... |
#!/usr/bin/env python3
####################################################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
#############################################... |
# -*- coding: utf-8 -*-
"""
Tensors
In mathematics, a tensor is an algebraic object that describes a (multilinear) relationship between sets of algebraic objects related to a vector space. Objects that tensors may map between include vectors and scalars, and even other tensors.
There are many types of tensors, inclu... |
# Copyright (c) 2017 The Khronos Group 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 ... |
from __future__ import unicode_literals
import requests
import re
import json
from munch import Munch
from .steamid import SteamID
from .session import session, check_http_error
from . import utils
from . import enums
import logging
logger = logging.getLogger(__name__)
# chat constants taken from chat.js
POLL_DEFAULT_... |
"""
The ``mlflow.projects`` module provides an API for running MLflow projects locally or remotely.
"""
import json
import yaml
import os
import logging
import warnings
import mlflow.projects.databricks
import mlflow.tracking as tracking
from mlflow.entities import RunStatus
from mlflow.exceptions import ExecutionExce... |
# 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, ... |
"""
# *****************************************************************
# (C) Copyright IBM Corp. 2021. 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... |
#!python
import json
# comment.
classes = []
def generate_bindings(path):
global classes
classes = json.load(open(path))
icalls = set()
for c in classes:
# print c['name']
used_classes = get_used_classes(c)
header = generate_class_header(used_classes, ... |
import os
import numpy as np
import pandas as pd
import itertools
from matplotlib import pyplot as plt
from datetime import date, timedelta
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import KFold
from sklearn.model_selection import RepeatedKFold
from sklearn.metrics import ... |
# Copyright (c) 2018 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 app... |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
This file contains components with some default boilerplate logic user may need
in training / testing. They will not work for everyone, but many users may find them useful.
The behavior of functions/classes in this file ... |
"Test pyparse, coverage 96%."
from idlelib import pyparse
import unittest
from collections import namedtuple
class ParseMapTest(unittest.TestCase):
def test_parsemap(self):
keepwhite = {ord(c): ord(c) for c in ' \t\n\r'}
mapping = pyparse.ParseMap(keepwhite)
self.assertEqual(... |
# Copyright 2022 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... |
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
import warnings
import numpy as np
import pandas as pd
from pandas.core.dtypes.common import (
is_float_dtype,
... |
# B/RK analyzer main event loop
#
#
# <NAME>, 2020
# <EMAIL>
import uproot
import uproot_methods
import h5py
import copy
import numpy as np
from tqdm import tqdm
from termcolor import colored
import iceplot
from icenet.tools.io import *
from icenet.tools import aux
from icenet.tools import prints
import icebrk.fea... |
# Copyright (c) 2019-2020, <NAME>
# License: MIT-License
# Created: 2019-02-18
from typing import TYPE_CHECKING, KeysView, ItemsView, Any, Union, Dict, List
from ezdxf.lldxf.const import SUBCLASS_MARKER, DXFKeyError
from ezdxf.lldxf.attributes import DXFAttr, DXFAttributes, DefSubclass
from ezdxf.audit import AuditErro... |
from pytorch_pretrained_biggan import BigGAN, BigGANConfig, truncated_noise_sample
import torch
import torchvision
from torchvision.transforms import ToPILImage
from torchvision.utils import make_grid
from torch.optim import SGD, Adam
import numpy as np
import pandas as pd
from imageio import imread
import matplotlib.p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.