Created
February 1, 2020 14:21
-
-
Save hartikainen/7722add319eba9fc59d0a54dc6b9b4a4 to your computer and use it in GitHub Desktop.
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'), | |
)) | |
_ = model_1(tf.random.uniform((15, 3))) | |
model_2 = pickle.loads(pickle.dumps(model_1)) | |
for w1, w2 in zip(model_1.get_weights(), model_2.get_weights()): | |
tf.debugging.assert_equal(w1, w2) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment