code: def test_get_grad_scaler_from_precision(self) -> None:
      grad_scaler = get_grad_scaler_from_precision(
          torch.float32, torch.nn.Linear(2, 2)
      )
      self.assertIsNone(grad_scaler)
  
      grad_scaler = get_grad_scaler_from_precision(
          torch.float16, torch.nn.Linear(2, 2)
      )
      self.assertTrue(isinstance(grad_scaler, GradScaler))
  
      with patch(
          "torchtnt.utils.precision._is_fsdp_module", return_value=True
      ):
          grad_scaler = get_grad_scaler_from_precision(
              torch.float16, torch.nn.Linear(2, 2)
          )
          self.assertTrue(isinstance(grad_scaler, ShardedGradScaler))
  
file_path: tnt/tests/utils/test_precision.py
imports: import unittest
  from unittest.mock import patch
  import torch
  from torch.cuda.amp.grad_scaler import GradScaler
  from torch.distributed.fsdp.sharded_grad_scaler import ShardedGradScaler
  from torchtnt.utils.precision import convert_precision_str_to_dtype, get_grad_scaler_from_precision
label_desc: Use image node_id 3 for calling the PrecisionTest obj's underlying member method code with example usage: obj.test_get_grad_scaler_from_precision() without return types