yaojian95 / foreground_small_scales

Simulate small scales of foreground using ForSE
https://foreground-small-scales.readthedocs.io/
0 stars 0 forks source link

save the tensorflow model to be used in pysm on the fly #3

Open yaojian95 opened 1 year ago

yaojian95 commented 1 year ago

https://www.tensorflow.org/tutorials/keras/save_and_load#save_the_entire_model

yaojian95 commented 1 year ago

When saving in TensorFlow format, all objects referenced by the network are saved in the same format as tf.train.Checkpoint, including any Layer instances or Optimizer instances assigned to object attributes. For networks constructed from inputs and outputs using tf.keras.Model(inputs, outputs), Layer instances used by the network are tracked/saved automatically. For user-defined classes which inherit from tf.keras.Model, Layer instances must be assigned to object attributes, typically in the constructor. See the documentation of tf.train.Checkpoint and tf.keras.Model for details.

While the formats are the same, do not mix save_weights and tf.train.Checkpoint. Checkpoints saved by Model.save_weights should be loaded using Model.load_weights. Checkpoints saved using tf.train.Checkpoint.save should be restored using the corresponding tf.train.Checkpoint.restore. Prefer tf.train.Checkpoint over save_weights for training checkpoints.

yaojian95 commented 1 year ago

INPORTANT: recomposing the patches onto the full-sky healpix maps needs long time