code: def test_update_get(make_stats, size):
      samples = generate_data(size)
  
      expected_stats = make_stats()
      for sample in samples:
          expected_stats.update(sample)
      expected = expected_stats.get()
  
      actual_stats = make_stats()
      for i in torch.randperm(len(samples)).tolist():
          actual_stats.update(samples[i])
      actual = actual_stats.get()
  
      # Sort samples in case of StackStats.
      sort_samples_in_place(expected)
      sort_samples_in_place(actual)
  
      assert_close(actual, expected)
  
file_path: pyro/tests/ops/test_streaming.py
imports: import functools
  import pytest
  import torch
  from pyro.ops.streaming import CountMeanStats, CountMeanVarianceStats, CountStats, StackStats, StatsOfDict
  from tests.common import assert_close
label_desc: Use image node_id 3 for calling a global function with example usage: test_update_get(make_stats, size) without return types