This file contains hidden or 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 pickle | |
import tensorflow as tf | |
class TestModule(tf.Module): | |
def __init__(self, model): | |
self.model = model | |
This file contains hidden or 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 pickle | |
import tensorflow as tf | |
def main(): | |
model_1 = tf.keras.Sequential(( | |
tf.keras.layers.Dense(16, activation='relu'), | |
tf.keras.layers.Dense(1, activation='linear'), | |
)) |
This file contains hidden or 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 pickle | |
import tensorflow as tf | |
def main(): | |
x = tf.keras.layers.Input((3, )) | |
y = tf.keras.layers.Dense(5)(x) | |
model_1 = tf.keras.Model(x, y) |
This file contains hidden or 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
from timeit import time | |
import tensorflow as tf | |
def test_fake_data(): | |
matrices = [ | |
tf.random.uniform((6, 6), -1.0, 1.0) | |
for i in range(4) | |
] |
This file contains hidden or 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 | |
batch_size = 32 | |
data = tf.random.uniform((1024, 4)) | |
model = tf.keras.Sequential(( | |
tf.keras.layers.Dense(32, activation='relu'), | |
tf.keras.layers.Dense(2, activation='linear'), | |
)) |
This file contains hidden or 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 tensorflow_probability as tfp | |
def main(): | |
x = tf.Variable(0.5) | |
y = tfp.util.DeferredTensor(x, tf.exp) | |
print(y.numpy()) # y.transform_fn(y.variables).numpy() works. | |
This file contains hidden or 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 random | |
import time | |
import tensorflow as tf | |
from ray import tune | |
from wandb.ray import WandbLogger | |
class ExperimentRunner(tune.Trainable): | |
def _setup(self, variant): |
This file contains hidden or 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 random | |
import time | |
import tensorflow as tf | |
from ray import tune | |
from wandb.ray import WandbLogger | |
class MyLogger(tune.logger.Logger): | |
def _init(self): |
This file contains hidden or 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
#!/bin/bash | |
pid=$1 | |
me="$(basename $0)($$):" | |
if [ -z "$pid" ] | |
then | |
echo "${me} a PID is required as an argument" >&2 | |
exit 2 | |
fi |
This file contains hidden or 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 numpy as np | |
import matplotlib | |
matplotlib.use('TKAgg') | |
from matplotlib import pyplot as plt | |
from matplotlib import animation | |
from .data import WALLS, TRAJECTORIES | |
# First set up the figure, the axis, and the plot element we want to animate |