tensorflow-gpu-1.13 and after require TF_FORCE_GPU_ALLOW_GROWTH work around tensorflow/tensorflow#24496
Keras-2.2.5
tensorflow-gpu-1.12.0
libcudnn7 7.6.5.32-1+cuda10.0
cuda-libraries-10-0
import numpy as np | |
from scipy import signal | |
def conv2d_simplified(input, weight, bias=None, padding=0): | |
# This is an implemention of torch's conv2d using scipy correlate2d. Only | |
# limited options are supported for simplicity. | |
# Inspired by https://github.com/99991/NumPyConv2D/ | |
c_out, c_in_by_groups, kh, kw = weight.shape | |
if not isinstance(padding, int): | |
raise NotImplementedError() |
import csv | |
def MergeUpdate(dataDict, update): | |
for li in update: | |
#print (li['ElectorNumber'], li['ElectorCreatedMonth'], li['ElectorChangedMonth'], li['ElectorDeletedMonth']) | |
electNum = li['ElectorNumber'].strip() | |
if int(li['ElectorCreatedMonth']) or int(li['ElectorChangedMonth']): |
# A script to group delivery areas into routes of roughly similar size. | |
import csv | |
from sklearn import cluster | |
from pyproj import Proj, transform | |
import numpy as np | |
from matplotlib import pyplot as plt | |
class EqualWeightClustering(object): |
# https://askubuntu.com/a/1337205/294281 | |
import os | |
import stat | |
import glob | |
from pathlib import Path | |
import shutil | |
if __name__=="__main__": | |
ver = "495.29.05" |
#pyellipse by Tim Sheerman-Chase (C) 2021 | |
#Calculate circumference of an ellipse in python (both exact and approximate approaches) | |
#This source code may be used under the CC0 license https://creativecommons.org/publicdomain/zero/1.0/ | |
# | |
#For the best exact circumference, use EllipseCircumAdlaj2012 | |
# | |
#For good approximations that are faster to compute, see EllipseCircumRamanujan2ndApprox and EllipseCircumJacobsenWaadeland1985 | |
# | |
#Incidentally, scipy has a function to exactly calculate it: | |
# C = 4.0*a*special.ellipe(e*e) |
#Using Keras to tackle the Inria aerial image labeling dataset | |
# https://project.inria.fr/aerialimagelabeling/ | |
import os | |
#Work around for https://github.com/tensorflow/tensorflow/issues/24496 | |
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true' | |
# Work around for https://github.com/tensorflow/tensorflow/issues/33024 | |
import tensorflow.compat as compat | |
compat.v1.disable_eager_execution() |
import os | |
#Work around for https://github.com/tensorflow/tensorflow/issues/24496 | |
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true' | |
# Work around for https://github.com/tensorflow/tensorflow/issues/33024 | |
import tensorflow.compat as compat | |
compat.v1.disable_eager_execution() | |
import imageio | |
from sklearn.model_selection import KFold, train_test_split |
#Based on https://machinelearningmastery.com/how-to-develop-a-convolutional-neural-network-from-scratch-for-mnist-handwritten-digit-classification/ | |
import os | |
#Work around for https://github.com/tensorflow/tensorflow/issues/24496 | |
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true' | |
# baseline cnn model for mnist | |
from numpy import mean | |
from numpy import std | |
from matplotlib import pyplot |
import os | |
#Work around for https://github.com/tensorflow/tensorflow/issues/24496 | |
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true' | |
# Work around for https://github.com/tensorflow/tensorflow/issues/33024 | |
import tensorflow.compat as compat | |
compat.v1.disable_eager_execution() | |
# baseline cnn model for mnist | |
import numpy as np |
tensorflow-gpu-1.13 and after require TF_FORCE_GPU_ALLOW_GROWTH work around tensorflow/tensorflow#24496
Keras-2.2.5
tensorflow-gpu-1.12.0
libcudnn7 7.6.5.32-1+cuda10.0
cuda-libraries-10-0