MCPcopy Create free account
hub / github.com/tensorflow/tensorboard / run

Function run

tensorboard/plugins/hparams/hparams_demo.py:163–191  ·  view source on GitHub ↗

Run a training/validation session. Flags must have been parsed for this function to behave. Args: data: The data as loaded by `prepare_data()`. base_logdir: The top-level logdir to which to write summary data. session_id: A unique string ID for this session. hparams

(data, base_logdir, session_id, hparams)

Source from the content-addressed store, hash-verified

161
162
163def run(data, base_logdir, session_id, hparams):
164 """Run a training/validation session.
165
166 Flags must have been parsed for this function to behave.
167
168 Args:
169 data: The data as loaded by `prepare_data()`.
170 base_logdir: The top-level logdir to which to write summary data.
171 session_id: A unique string ID for this session.
172 hparams: A dict mapping hyperparameters in `HPARAMS` to values.
173 """
174 model = model_fn(hparams=hparams, seed=session_id)
175 logdir = os.path.join(base_logdir, session_id)
176
177 callback = tf.keras.callbacks.TensorBoard(
178 logdir,
179 update_freq=flags.FLAGS.summary_freq,
180 profile_batch=0, # workaround for issue #2084
181 )
182 hparams_callback = hp.KerasCallback(logdir, hparams)
183 ((x_train, y_train), (x_test, y_test)) = data
184 result = model.fit(
185 x=x_train,
186 y=y_train,
187 epochs=flags.FLAGS.num_epochs,
188 shuffle=False,
189 validation_data=(x_test, y_test),
190 callbacks=[callback, hparams_callback],
191 )
192
193
194def prepare_data():

Callers 1

run_allFunction · 0.70

Calls 3

model_fnFunction · 0.85
joinMethod · 0.45
fitMethod · 0.45

Tested by

no test coverage detected