-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
32 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS). | ||
# Under the terms of Contract DE-NA0003525 with NTESS, | ||
# the U.S. Government retains certain rights in this software. | ||
"""This example demonstrates how to use the PyRIID implementations of ARAD. | ||
""" | ||
import sys | ||
import tensorflow as tf | ||
from riid.models.neural_nets.arad import ARADv1TF, ARADv2TF | ||
|
||
if len(sys.argv) == 2: | ||
import matplotlib | ||
matplotlib.use("Agg") | ||
|
||
|
||
def show_summaries(model): | ||
model_type = type(model).__name__ | ||
print(model_type) | ||
|
||
model.encoder.summary() | ||
model.decoder.summary() | ||
model.autoencoder.summary() | ||
|
||
# The following requires `graphviz` (system software) and `pydot` (Python package) | ||
try: | ||
tf.keras.utils.plot_model( | ||
model.autoencoder, | ||
f"{model_type}.png", | ||
show_shapes=True, | ||
rankdir="LR", | ||
expand_nested=True, | ||
) | ||
except Exception: | ||
pass | ||
|
||
|
||
v1_model = ARADv1TF() | ||
show_summaries(v1_model) | ||
v2_model = ARADv2TF() | ||
show_summaries(v2_model) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.