code: def test_embeddings_trainable_params_update(self):
      for params, init_case in itertools.product(
          self.PARAMS, self.cases()
      ):
          emb = Embeddings(**init_case)
          for n, p in emb.named_parameters():
              if "weight" in n and p.dim() > 1:
                  xavier_uniform_(p)
          trainable_params = {
              n: p for n, p in emb.named_parameters() if p.requires_grad
          }
          if len(trainable_params) > 0:
              old_weights = deepcopy(trainable_params)
              dummy_in = self.dummy_inputs(params, init_case)
              res = emb(dummy_in)
              pretend_loss = res.mean()
              pretend_loss.backward()
              dummy_optim = torch.optim.SGD(
                  trainable_params.values(), 1
              )
              dummy_optim.step()
              for param_name in old_weights.keys():
                  self.assertTrue(
                      trainable_params[param_name]
                      .ne(old_weights[param_name])
                      .any(),
                      param_name + " " + init_case.__str__(),
                  )
  
file_path: OpenNMT-py/onmt/tests/test_embeddings.py
imports: import unittest
  from onmt.modules.embeddings import Embeddings
  import itertools
  from copy import deepcopy
  import torch
  from torch.nn.init import xavier_uniform_
  from onmt.tests.utils_for_tests import product_dict
label_desc: Use image node_id 7 for calling the TestEmbeddings obj's underlying member method code with example usage: obj.test_embeddings_trainable_params_update() without return types