code: def test_streaming_memory_efficient():
      for backend in ["torch"]:
          torch.manual_seed(1234)
          set_efficient_attention_backend(backend)
          tr = StreamingTransformer(
              16, 4, 2, causal=True, dropout=0.0, custom=True
          )
          tr_mem_efficient = StreamingTransformer(
              16, 4, 2, dropout=0.0, memory_efficient=True, causal=True
          )
          tr.load_state_dict(tr_mem_efficient.state_dict())
          tr.eval()
          tr_mem_efficient.eval()
          steps = 12
          x = torch.randn(3, steps, 16)
  
          ref = tr(x)
  
          with tr_mem_efficient.streaming():
              outs = []
              # frame_sizes = [2] + [1] * (steps - 2)
              frame_sizes = [1] * steps
  
              for frame_size in frame_sizes:
                  frame = x[:, :frame_size]
                  x = x[:, frame_size:]
                  outs.append(tr_mem_efficient(frame))
  
          out = torch.cat(outs, dim=1)
          delta = torch.norm(out - ref) / torch.norm(out)
          assert delta < 1e-6, delta
  
file_path: audiocraft/tests/modules/test_transformer.py
imports: from itertools import product
  import pytest
  import torch
  from audiocraft.modules.transformer import StreamingMultiheadAttention, StreamingTransformer, set_efficient_attention_backend
label_desc: Use image node_id 6 for calling a global function with example usage: test_streaming_memory_efficient() without return types