self._ask_user_if_test_with_random() // Asks user whether to continue with randomly initialized model. It exits if no is given.
self._log.print3("")
self._log.print3("=========== Initializing network variables ===============")
tf.compat.v1.variables_initializer( var_list = tf.compat.v1.get_collection(tf.compat.v1.GraphKeys.GLOBAL_VARIABLES, scope="net") ).run()
self._log.print3("Model variables were initialized.")
After Change
cnn3d.setup_ops_n_feeds_to_test( self._log,
self._params.indices_fms_per_pathtype_per_layer_to_save )
// Create the saver
collection_vars_net = tf.compat.v1.get_collection(tf.compat.v1.GraphKeys.GLOBAL_VARIABLES, scope="net")
saver_net = tf.compat.v1.train.Saver(var_list=collection_vars_net) // saver_net would suffice
dict_vars_net = {"net_var"+str(i): v for i, v in enumerate(collection_vars_net)}
ckpt_net = tf.train.Checkpoint(**dict_vars_net)
with tf.compat.v1.Session( graph=graphTf, config=tf.compat.v1.ConfigProto(log_device_placement=False, device_count={"CPU":999, "GPU":99}) ) as sessionTf: