This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Higher order meshgrid that takes a list of np.linspace type object and greates an output array | |
# Created to generate meshes of input points for PINN training | |
# Adopted from https://stackoverflow.com/questions/1827489/numpy-meshgrid-in-3d | |
# and modified to work in N dimensions, as well as fixed for python3 | |
def multimesh(arrs): | |
lens = list(map(len, arrs)) | |
dim = len(arrs) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import numpy as np | |
from tensorflow.keras.applications.vgg16 import VGG16 | |
# generate 10k random 224x224x3 tensors (to simulate images) | |
dataset = tf.random.normal((10000, 224, 224,3)) | |
# generate 10k one-hot labels for categorical cross entropy loss | |
labels = tf.constant(np.eye(1000)[np.random.choice(1000, 10000)]) |