code: def test_tensor_compression(
      size=(128, 128, 64), alpha=5e-08, beta=0.0008
  ):
      torch.manual_seed(0)
      X = torch.randn(*size)
      assert torch.allclose(
          deserialize_torch_tensor(
              serialize_torch_tensor(X, CompressionType.NONE)
          ),
          X,
      )
      error = (
          deserialize_torch_tensor(
              serialize_torch_tensor(X, CompressionType.MEANSTD_16BIT)
          )
          - X
      )
      assert error.square().mean() < alpha
      error = (
          deserialize_torch_tensor(
              serialize_torch_tensor(X, CompressionType.FLOAT16)
          )
          - X
      )
      assert error.square().mean() < alpha
      error = (
          deserialize_torch_tensor(
              serialize_torch_tensor(X, CompressionType.QUANTILE_8BIT)
          )
          - X
      )
      assert error.square().mean() < beta
      error = (
          deserialize_torch_tensor(
              serialize_torch_tensor(X, CompressionType.UNIFORM_8BIT)
          )
          - X
      )
      assert error.square().mean() < beta
      error = (
          deserialize_torch_tensor(
              serialize_torch_tensor(X, CompressionType.BLOCKWISE_8BIT)
          )
          - X
      )
      assert error.square().mean() < beta
  
      zeros = torch.zeros(5, 5)
      for compression_type in CompressionType.values():
          assert (
              deserialize_torch_tensor(
                  serialize_torch_tensor(zeros, compression_type)
              )
              .isfinite()
              .all()
          )
  
imports: import multiprocessing
  from ctypes import c_int32
  import pytest
  import torch
  import torch.nn
  import hivemind
  from hivemind.compression import CompressionBase, CompressionInfo, Float16Compression, NoCompression, PerTensorCompression, RoleAdaptiveCompression, SizeAdaptiveCompression, Uniform8BitQuantization, deserialize_torch_tensor, serialize_torch_tensor
  from hivemind.compression.adaptive import AdaptiveCompressionBase
  from hivemind.proto.runtime_pb2 import CompressionType
  from hivemind.utils.streaming import combine_from_streaming, split_for_streaming
  from test_utils.dht_swarms import launch_dht_instances
label_desc: Use image node_id 1 for calling a global function with example usage: test_tensor_compression(size, alpha, beta) without return types