class_docstr: Tests for :mod:`pykeen.utils`.
class_docstr_tok: ["Tests","for",":","mod",":","`","pykeen.utils","`","."]
docstr: Test caching of ``get_optimal_sequence()``.
docstr_tok: ["Test","caching","of","``","get_optimal_sequence","(",")","``","."]
code: def test_get_optimal_sequence_caching(self):
      """Test caching of ``get_optimal_sequence()``."""
      _, generator, _ = set_random_seed(seed=42)
      for shapes in _generate_shapes(
          iterations=10, generator=generator
      ):
          # get optimal sequence
          first_time = timeit.default_timer()
          get_optimal_sequence(*shapes)
          first_time = timeit.default_timer() - first_time
  
          # check caching
          samples, second_time = timeit.Timer(
              stmt="get_optimal_sequence(*shapes)",
              globals=dict(
                  get_optimal_sequence=get_optimal_sequence,
                  shapes=shapes,
              ),
          ).autorange()
          second_time /= samples
  
          assert second_time < first_time
  
imports: import functools
  import itertools
  import operator
  import random
  import string
  import timeit
  import unittest
  from typing import Iterable, Tuple
  import numpy
  import pytest
  import torch
  from pykeen.utils import _weisfeiler_lehman_iteration, _weisfeiler_lehman_iteration_approx, calculate_broadcasted_elementwise_result_shape, clamp_norm, combine_complex, compact_mapping, compose, estimate_cost_of_sequence, flatten_dictionary, get_optimal_sequence, get_until_first_blank, iter_weisfeiler_lehman, logcumsumexp, project_entity, set_random_seed, split_complex, tensor_product, tensor_sum
label_desc: Use image node_id 7 for calling the TestUtils obj's underlying member method code with example usage: obj.test_get_optimal_sequence_caching() without return types