Create Tensorboard Callback

    0

    0

    Ken Malley

    Library: tensorflow

    import tensorflow as tf
    import datetime
    
    def create_tensorboard_callback(dir_name, experiment_name):
      """
      Creates a TensorBoard callback instand to store log files.
      Stores log files with the filepath:
        "dir_name/experiment_name/current_datetime/"
      Args:
        dir_name: target directory to store TensorBoard log files
        experiment_name: name of experiment directory (e.g. efficientnet_model_1)
      """
      log_dir = dir_name + "/" + experiment_name + "/" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
      tensorboard_callback = tf.keras.callbacks.TensorBoard(
          log_dir=log_dir
      )
      print(f"Saving TensorBoard log files to: {log_dir}")
      return tensorboard_callback
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.