code: def test_optimizer_adagrad():
      """test the wrapping functionality around keras optimizer"""
      adagrad = optimizers.get(Adagrad(learning_rate=0.0001))
      adagrad.set_partitioned_training()
      ent = tf.Variable(
          np.array([[1, 2], [3, 4]], dtype=np.float32), trainable=True
      )
      rel = tf.Variable(
          np.array([[1, 2], [3, 4]], dtype=np.float32), trainable=True
      )
  
      with tf.GradientTape() as tape:
          loss = tf.reduce_sum(ent * rel)
  
      adagrad.minimize(loss, ent, rel, tape)
      curr_weights = adagrad.get_weights()
      # step + 2 hyperparams * 2 trainable vars
      assert len(curr_weights) == (
          1
          + adagrad.get_hyperparam_count() * adagrad.num_optimized_vars
      ), "Adagrad: Lengths dont match!"
  
      adagrad.set_weights(curr_weights)
      new_weights = adagrad.get_weights()
  
      # test whether all params are same
      out = [np.all(i == j) for i, j in zip(curr_weights, new_weights)]
      assert np.all(out), "Adagrad: Weights are not the same!"
  
file_path: AmpliGraph/tests/ampligraph/latent_features/test_optimizers.py
imports: from ampligraph.latent_features import optimizers
  import pytest
  import tensorflow
  import numpy
  from tensorflow.keras.optimizers import Adagrad, Adam
label_desc: Use image node_id 2 for calling a global function with example usage: test_optimizer_adagrad() without return types