class_docstr: Factorization Machines base class.
docstr: Calculates weights gradient.
docstr_tok: ["Calculates","weights","gradient","."]
code: def _calculate_weights_gradients(
      self, x: dict, g_loss: float
  ) -> dict:
      """Calculates weights gradient."""
  
imports: from __future__ import annotations
  import abc
  import collections
  import numbers
  from collections.abc import Iterable
  import numpy
  from river import optim, utils
label_desc: Use image node_id 14 for calling the BaseFM obj's underlying member method code with example usage: obj._calculate_weights_gradients(x, g_loss) without return types