code: def test_sanitize_params():
      """Verify sanitize params converts various types to loggable strings."""
      params = {
          "float": 0.3,
          "int": 1,
          "string": "abc",
          "bool": True,
          "list": [1, 2, 3],
          "np_bool": np.bool_(False),
          "np_int": np.int_(5),
          "np_double": np.double(3.14159),
          "namespace": Namespace(foo=3),
          "layer": torch.nn.BatchNorm1d,
          "tensor": torch.ones(3),
      }
      params = _sanitize_params(params)
  
      assert params["float"] == 0.3
      assert params["int"] == 1
      assert params["string"] == "abc"
      assert params["bool"] is True
      assert params["list"] == "[1, 2, 3]"
      assert params["np_bool"] is False
      assert params["np_int"] == 5
      assert params["np_double"] == 3.14159
      assert params["namespace"] == "Namespace(foo=3)"
      assert (
          params["layer"]
          == "<class 'torch.nn.modules.batchnorm.BatchNorm1d'>"
      )
      assert torch.equal(params["tensor"], torch.ones(3))
  
file_path: pytorch-lightning/tests/tests_fabric/utilities/test_logger.py
imports: from argparse import Namespace
  from dataclasses import dataclass
  import numpy
  import torch
  from lightning.fabric.utilities.logger import _add_prefix, _convert_params, _flatten_dict, _sanitize_callable_params, _sanitize_params
label_desc: Use image node_id 4 for calling a global function with example usage: test_sanitize_params() without return types