code: def test_partial_powers(barbell, num_powers, weighted):
      raw_adj = barbell.to_adjacency_matrix(weighted=weighted)
      Aadj = normalize_adj(raw_adj, symmetric=False).todense()
      actual_powers = [Aadj]
      for _ in range(num_powers - 1):
          actual_powers.append(actual_powers[-1].dot(Aadj))
  
      generator = AdjacencyPowerGenerator(
          barbell, num_powers=num_powers, weighted=weighted
      )
      dataset = generator.flow(batch_size=1)
      for i, (x, y) in enumerate(
          dataset.take(barbell.number_of_nodes())
      ):
          partial_powers = x[1].numpy()
          for j in range(num_powers):
              print(i, j)
              np.testing.assert_allclose(
                  partial_powers[:, j, :],
                  actual_powers[j][i, :],
                  rtol=1e-5,
                  atol=1e-8,
              )
  
file_path: stellargraph/tests/mapper/test_adjacency_generators.py
imports: from stellargraph.core.utils import normalize_adj
  from stellargraph.mapper.adjacency_generators import AdjacencyPowerGenerator
  from ..test_utils.graphs import barbell
  import tensorflow
  import numpy
  import pytest
label_desc: Use image node_id 7 for calling a global function with example usage: test_partial_powers(barbell, num_powers, weighted) without return types