code: def test_split_parts():
      tensor = torch.randn(910, 512)
      serialized_tensor_part = serialize_torch_tensor(
          tensor, allow_inplace=False
      )
      chunks1 = list(
          hivemind.utils.split_for_streaming(
              serialized_tensor_part, 16384
          )
      )
      assert len(chunks1) == int(
          np.ceil(tensor.numel() * tensor.element_size() / 16384)
      )
  
      chunks2 = list(
          hivemind.utils.split_for_streaming(
              serialized_tensor_part, 10_000
          )
      )
      assert len(chunks2) == int(
          np.ceil(tensor.numel() * tensor.element_size() / 10_000)
      )
  
      chunks3 = list(
          hivemind.utils.split_for_streaming(
              serialized_tensor_part, 10**9
          )
      )
      assert len(chunks3) == 1
  
      compressed_tensor_part = serialize_torch_tensor(
          tensor, CompressionType.FLOAT16, allow_inplace=False
      )
      chunks4 = list(
          hivemind.utils.split_for_streaming(
              compressed_tensor_part, 16384
          )
      )
      assert len(chunks4) == int(np.ceil(tensor.numel() * 2 / 16384))
  
      combined1 = hivemind.utils.combine_from_streaming(chunks1)
      combined2 = hivemind.utils.combine_from_streaming(iter(chunks2))
      combined3 = hivemind.utils.combine_from_streaming(chunks3)
      combined4 = hivemind.utils.combine_from_streaming(chunks4)
      for combined in combined1, combined2, combined3:
          assert torch.allclose(
              tensor,
              deserialize_torch_tensor(combined),
              rtol=1e-5,
              atol=1e-8,
          )
  
      assert torch.allclose(
          tensor,
          deserialize_torch_tensor(combined4),
          rtol=1e-3,
          atol=1e-3,
      )
  
      combined_incomplete = hivemind.utils.combine_from_streaming(
          chunks4[:5]
      )
      combined_incomplete2 = hivemind.utils.combine_from_streaming(
          chunks4[:1]
      )
      combined_incomplete3 = hivemind.utils.combine_from_streaming(
          chunks4[:-1]
      )
      for combined in (
          combined_incomplete,
          combined_incomplete2,
          combined_incomplete3,
      ):
          with pytest.raises(RuntimeError):
              deserialize_torch_tensor(combined)
  
imports: import asyncio
  import concurrent.futures
  import multiprocessing
  import random
  import time
  from concurrent.futures import ThreadPoolExecutor
  import numpy
  import pytest
  import torch
  import hivemind
  from hivemind.compression import deserialize_torch_tensor, serialize_torch_tensor
  from hivemind.proto.runtime_pb2 import CompressionType
  from hivemind.utils import BatchTensorDescriptor, DHTExpiration, HeapEntry, MSGPackSerializer, ValueWithExpiration
  from hivemind.utils.asyncio import achain, aenumerate, aiter_with_timeout, amap_in_executor, anext, as_aiter, asingle, attach_event_on_finished, azip, cancel_and_wait, enter_asynchronously
  from hivemind.utils.mpfuture import InvalidStateError
  from hivemind.utils.performance_ema import PerformanceEMA
label_desc: Use image node_id 9 for calling a global function with example usage: test_split_parts() without return types