code: def test_clip_partial_gradients_norm(self) -> None:
      # test partial clipping
      param_1 = Variable(torch.tensor([1.0, 2.0]), requires_grad=True)
  
      keyed_optimizer = DummyKeyedOptimizer(
          {"param_1": param_1}, {}, [{"params": [param_1]}]
      )
  
      gradient_clipping_optimizer = GradientClippingOptimizer(
          optimizer=keyed_optimizer,
          max_gradient=1.0,
          clipping=GradientClipping.NORM,
      )
  
      gradient_clipping_optimizer.zero_grad()
  
      param_1.grad = torch.tensor([2.0, 4.0])
      gradient_clipping_optimizer.step()
  
      norm = 2.0**2 + 4.0**2
      expected_grad = torch.tensor([2.0, 4.0]) * norm ** (-0.5)
      # pyre-fixme[6]: For 1st argument expected `Tensor` but got `Optional[Tensor]`.
      self.assertTrue(torch.allclose(param_1.grad, expected_grad))
  
file_path: torchrec/torchrec/optim/tests/test_clipping.py
imports: import unittest
  from unittest.mock import MagicMock, patch
  import torch
  from torch.autograd import Variable
  from torchrec.optim.clipping import GradientClipping, GradientClippingOptimizer
  from torchrec.optim.test_utils import DummyKeyedOptimizer
label_desc: Use image node_id 3 for calling the TestGradientClippingOptimizer obj's underlying member method code with example usage: obj.test_clip_partial_gradients_norm() without return types