code: def test_serialize():
      num = Number()
      tensor = torch.tensor([[1]])
      assert num.serialize(tensor) == 1
      assert isinstance(num.serialize(tensor.to(torch.float32)), float)
      assert isinstance(num.serialize(tensor.to(torch.float64)), float)
      assert isinstance(num.serialize(tensor.to(torch.int16)), int)
      assert isinstance(num.serialize(tensor.to(torch.int32)), int)
      assert isinstance(num.serialize(tensor.to(torch.int64)), int)
      assert isinstance(
          num.serialize(tensor.to(torch.complex64)), complex
      )
  
      tensor = torch.tensor([1, 2])
      with pytest.raises(ValueError):
          # only one element tensors can be converted to Python scalars
          num.serialize(tensor)
  
imports: import pytest
  import torch
  from flash.core.serve.types import Number
  from flash.core.utilities.imports import _TOPIC_SERVE_AVAILABLE
label_desc: Use image node_id 1 for calling a global function with example usage: test_serialize() without return types