class_docstr: Log writer to write vdl records to log file.
  
  The class `LogWriter` provides APIs to create record file and add records to
  it. The class updates log file asynchronously without slowing down training.
class_docstr_tok: ["Log","writer","to","write","vdl","records","to","log","file",".","The","class","`","LogWriter","`","provides","APIs","to","create","record","file","and","add","records","to","it",".","The","class","updates","log","file","asynchronously","without","slowing","down","training","."]
docstr: Add a model graph to vdl graph file.
  Args:
      model (paddle.nn.Layer): Model to draw.
      input_spec (list[paddle.static.InputSpec|Tensor]): Describes the input                 of the saved model's forward arguments.
      verbose (bool): Whether to print some graph statistic information in console.
  Note:
      Paddlepaddle is required to use add_graph interface.
  Example:
      import paddle
      import paddle.nn as nn
      import paddle.nn.functional as F
      from visualdl import LogWriter
      class MyNet(nn.Layer):
          def __init__(self):
              super(MyNet, self).__init__()
              self.conv1 = nn.Conv2D(in_channels=1, out_channels=20, kernel_size=5, stride=1, padding=2)
              self.max_pool1 = nn.MaxPool2D(kernel_size=2, stride=2)
              self.conv2 = nn.Conv2D(in_channels=20, out_channels=20, kernel_size=5, stride=1, padding=2)
              self.max_pool2 = nn.MaxPool2D(kernel_size=2, stride=2)
              self.fc = nn.Linear(in_features=980, out_features=10)
          def forward(self, inputs):
              x = self.conv1(inputs)
              x = F.relu(x)
              x = self.max_pool1(x)
              x = self.conv2(x)
              x = F.relu(x)
              x = self.max_pool2(x)
              x = paddle.reshape(x, [x.shape[0], -1])
              x = self.fc(x)
              return x
      net = MyNet()
      with LogWriter(logdir="./log/graph_test/") as writer:
          writer.add_graph(
              model=net,
              input_spec=[paddle.static.InputSpec([-1, 1, 28, 28], 'float32')],
              verbose=True)
code: def add_graph(self, model, input_spec, verbose=False, **kwargs):
      """
          Add a model graph to vdl graph file.
          Args:
              model (paddle.nn.Layer): Model to draw.
              input_spec (list[paddle.static.InputSpec|Tensor]): Describes the input \
                  of the saved model's forward arguments.
              verbose (bool): Whether to print some graph statistic information in console.
          Note:
              Paddlepaddle is required to use add_graph interface.
          Example:
              import paddle
              import paddle.nn as nn
              import paddle.nn.functional as F
              from visualdl import LogWriter
              class MyNet(nn.Layer):
                  def __init__(self):
                      super(MyNet, self).__init__()
                      self.conv1 = nn.Conv2D(in_channels=1, out_channels=20, kernel_size=5, stride=1, padding=2)
                      self.max_pool1 = nn.MaxPool2D(kernel_size=2, stride=2)
                      self.conv2 = nn.Conv2D(in_channels=20, out_channels=20, kernel_size=5, stride=1, padding=2)
                      self.max_pool2 = nn.MaxPool2D(kernel_size=2, stride=2)
                      self.fc = nn.Linear(in_features=980, out_features=10)
                  def forward(self, inputs):
                      x = self.conv1(inputs)
                      x = F.relu(x)
                      x = self.max_pool1(x)
                      x = self.conv2(x)
                      x = F.relu(x)
                      x = self.max_pool2(x)
                      x = paddle.reshape(x, [x.shape[0], -1])
                      x = self.fc(x)
                      return x
              net = MyNet()
              with LogWriter(logdir="./log/graph_test/") as writer:
                  writer.add_graph(
                      model=net,
                      input_spec=[paddle.static.InputSpec([-1, 1, 28, 28], 'float32')],
                      verbose=True)
          """
      try:
          is_pir = kwargs.get("is_pir", False)
          result = translate_graph(
              model, input_spec, verbose, is_pir=is_pir
          )
      except Exception as e:
          print("Failed to save model graph, error: {}".format(e))
          raise e
      graph_file_name = bfile.join(
          self.logdir,
          "vdlgraph.%010d.log%s" % (time.time(), self._filename_suffix),
      )
      writer = bfile.BFile(graph_file_name, "w")
      writer.write(result)
      writer.close()
  
imports: import os
  import time
  import numpy
  from visualdl.component.base_component import audio
  from visualdl.component.base_component import embedding
  from visualdl.component.base_component import histogram
  from visualdl.component.base_component import hparam
  from visualdl.component.base_component import image
  from visualdl.component.base_component import meta_data
  from visualdl.component.base_component import pr_curve
  from visualdl.component.base_component import roc_curve
  from visualdl.component.base_component import scalar
  from visualdl.component.base_component import scalars
  from visualdl.component.base_component import text
  from visualdl.component.graph import translate_graph
  from visualdl.io import bfile
  from visualdl.server.log import logger
  from visualdl.utils.figure_util import figure_to_image
  from visualdl.utils.img_util import merge_images
  from visualdl.utils.md5_util import md5
  from visualdl.writer.record_writer import RecordFileWriter
label_desc: Use image node_id 18 for calling the LogWriter obj's underlying member method code with example usage: obj.add_graph(model, input_spec, verbose) without return types