code: def test_passing_memory_from_call(attention_cls):
      dummy_data = DummyData()
      attention = attention_cls(dummy_data.units, dummy_data.memory)
      weights_before_query = attention.get_weights()
      ref_score = attention([dummy_data.query, dummy_data.state])
  
      all_weights = attention.get_weights()
      config = attention.get_config()
      # Simulate the twice invocation of calls here.
      attention_from_config = attention_cls.from_config(config)
      attention_from_config.build(dummy_data.memory.shape)
      attention_from_config.set_weights(weights_before_query)
      attention_from_config(dummy_data.memory, setup_memory=True)
      attention_from_config.build(
          [dummy_data.query.shape, dummy_data.state.shape]
      )
      attention_from_config.set_weights(all_weights)
      score = attention_from_config(
          [dummy_data.query, dummy_data.state]
      )
  
      np.testing.assert_allclose(ref_score, score)
  
imports: import collections
  from packaging.version import Version
  import pytest
  import numpy
  import tensorflow
  from tensorflow_addons.seq2seq import attention_wrapper
  from tensorflow_addons.seq2seq import basic_decoder
  from tensorflow_addons.seq2seq import sampler
label_desc: Use image node_id 4 for calling a global function with example usage: test_passing_memory_from_call(attention_cls) without return types