code: def test_tensorboard_log_graph(tmp_path, example_input_array):
      """Test that log graph works with both model.example_input_array and if array is passed externally."""
      # TODO(fabric): Test both nn.Module and LightningModule
      # TODO(fabric): Assert _apply_batch_transfer_handler is calling the batch transfer hooks
      model = BoringModel()
      if example_input_array is not None:
          model.example_input_array = None
  
      logger = TensorBoardLogger(tmp_path)
      logger._experiment = Mock()
      logger.log_graph(model, example_input_array)
      if example_input_array is not None:
          logger.experiment.add_graph.assert_called_with(
              model, example_input_array
          )
      logger._experiment.reset_mock()
  
      # model wrapped in `FabricModule`
      wrapped = _FabricModule(model, precision=Mock())
      logger.log_graph(wrapped, example_input_array)
      if example_input_array is not None:
          logger.experiment.add_graph.assert_called_with(
              model, example_input_array
          )
  
imports: import logging
  import os
  from argparse import Namespace
  from unittest import mock
  from unittest.mock import Mock
  import numpy
  import pytest
  import torch
  from lightning.fabric.loggers import TensorBoardLogger
  from lightning.fabric.loggers.tensorboard import _TENSORBOARD_AVAILABLE
  from lightning.fabric.wrappers import _FabricModule
  from tests_fabric.test_fabric import BoringModel
label_desc: Use image node_id 11 for calling a global function with example usage: test_tensorboard_log_graph(tmp_path, example_input_array) without return types