class_docstr: Monitoring task that creates a sensible TensorBoard for a model.
  
  Monitors all the model's parameters for which their name matches with `keywords_to_monitor`.
  By default, "kernel" and "likelihood" are elements of `keywords_to_monitor`.
  
  Example::
  
      keyword = "kernel", parameter = "kernel.lengthscale" => match
      keyword = "variational", parameter = "kernel.lengthscale" => no match
class_docstr_tok: ["Monitoring","task","that","creates","a","sensible","TensorBoard","for","a","model",".","Monitors","all","the","model","'s","parameters","for","which","their","name","matches","with","`","keywords_to_monitor","`",".","By","default",",","``","kernel","''","and","``","likelihood","''","are","elements","of","`","keywords_to_monitor","`",".","Example",":",":","keyword","=","``","kernel","''",",","parameter","=","``","kernel.lengthscale","''","=",">","match","keyword","=","``","variational","''",",","parameter","=","``","kernel.lengthscale","''","=",">","no","match"]
docstr: :param log_dir: directory in which to store the tensorboard files.
      Can be a nested: for example, './logs/my_run/'.
  :param model: model to be monitord.
  :param max_size: maximum size of arrays (incl.) to store each
      element of the array independently as a scalar in the TensorBoard.
      Setting max_size to -1 will write all values. Use with care.
  :param keywords_to_monitor: specifies keywords to be monitored.
      If the parameter's name includes any of the keywords specified it
      will be monitored. By default, parameters that match the `kernel` or
      `likelihood` keyword are monitored.
      Adding a "*" to the list will match with all parameters,
      i.e. no parameters or variables will be filtered out.
  :param left_strip_character: certain frameworks prepend their variables with
      a character. GPflow adds a '.' and Keras add a '_', for example.
      When a `left_strip_character` is specified it will be stripped from the
      parameter's name. By default the '.' is left stripped, for example:
      ".likelihood.variance" becomes "likelihood.variance".
docstr_tok: [":","param","log_dir",":","directory","in","which","to","store","the","tensorboard","files",".","Can","be","a","nested",":","for","example",",","'.\/logs\/my_run\/","'",".",":","param","model",":","model","to","be","monitord",".",":","param","max_size",":","maximum","size","of","arrays","(","incl",".",")","to","store","each","element","of","the","array","independently","as","a","scalar","in","the","TensorBoard",".","Setting","max_size","to","-1","will","write","all","values",".","Use","with","care",".",":","param","keywords_to_monitor",":","specifies","keywords","to","be","monitored",".","If","the","parameter","'s","name","includes","any","of","the","keywords","specified","it","will","be","monitored",".","By","default",",","parameters","that","match","the","`","kernel","`","or","`","likelihood","`","keyword","are","monitored",".","Adding","a","``","*","''","to","the","list","will","match","with","all","parameters",",","i.e",".","no","parameters","or","variables","will","be","filtered","out",".",":","param","left_strip_character",":","certain","frameworks","prepend","their","variables","with","a","character",".","GPflow","adds","a","'",".","'","and","Keras","add","a","'","_","'",",","for","example",".","When","a","`","left_strip_character","`","is","specified","it","will","be","stripped","from","the","parameter","'s","name",".","By","default","the","'",".","'","is","left","stripped",",","for","example",":","``",".likelihood.variance","''","becomes","``","likelihood.variance","''","."]
code: def __init__(
      self,
      log_dir: str,
      model: BayesianModel,
      *,
      max_size: int = 3,
      keywords_to_monitor: List[str] = ["kernel", "likelihood"],
      left_strip_character: str = ".",
  ) -> None:
      """
      :param log_dir: directory in which to store the tensorboard files.
          Can be a nested: for example, './logs/my_run/'.
      :param model: model to be monitord.
      :param max_size: maximum size of arrays (incl.) to store each
          element of the array independently as a scalar in the TensorBoard.
          Setting max_size to -1 will write all values. Use with care.
      :param keywords_to_monitor: specifies keywords to be monitored.
          If the parameter's name includes any of the keywords specified it
          will be monitored. By default, parameters that match the `kernel` or
          `likelihood` keyword are monitored.
          Adding a "*" to the list will match with all parameters,
          i.e. no parameters or variables will be filtered out.
      :param left_strip_character: certain frameworks prepend their variables with
          a character. GPflow adds a '.' and Keras add a '_', for example.
          When a `left_strip_character` is specified it will be stripped from the
          parameter's name. By default the '.' is left stripped, for example:
          ".likelihood.variance" becomes "likelihood.variance".
      """
      super().__init__(log_dir)
      self.model = model
      self.max_size = max_size
      self.keywords_to_monitor = keywords_to_monitor
      self.summarize_all = "*" in self.keywords_to_monitor
      self.left_strip_character = left_strip_character
  
imports: from io import BytesIO
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
  import numpy
  import tensorflow
  from ..base import AnyNDArray, Parameter
  from ..models import BayesianModel
  from ..utilities import parameter_dict
  from .base import MonitorTask
label_desc: Use image node_id 1 to create a new ModelToTensorBoard object from inherited base classes: ToTensorBoard with example: obj = ModelToTensorBoard(log_dir, model)