code: def test_tensor():
      t = ShapeTensor(torch.randn(4, 2), True)
      assert t.real_shape == MutableShape(4, 2)
      assert t.size(0) == 4
      assert t.size(1) == 2
  
      t = ShapeTensor(torch.randn(4, 2, 3))
      assert t.real_shape is None
      assert repr(t) == "ShapeTensor(unknown)"
      t.real_shape = MutableShape(4, 2, nni.choice("c", [2, 3]))
  
      shape = t.shape
      assert shape[0] == 4
      assert shape[1] == 2
      assert shape[2] == 3
      assert isinstance(shape[2], _shape.IntProxy)
      assert shape[2].expression.values == [2, 3]
  
      assert (
          repr(t)
          == "ShapeTensor([4, 2, Categorical([2, 3], label='c')])"
      )
  
imports: import torch
  import torch.nn.functional
  from torch import nn
  import pytest
  import nni
  import nni.nas.profiler.pytorch.utils.shape
  from nni.mutable import MutableList, Categorical
  from nni.nas.nn.pytorch import MutableLinear, MutableConv2d, MutableDropout, MutableMultiheadAttention, ModelSpace, LayerChoice, InputChoice, Repeat
  from nni.nas.profiler.pytorch.utils import shape_inference, submodule_input_output_shapes, ShapeTensor, MutableShape, profiler_leaf_module
label_desc: Use image node_id 8 for calling a global function with example usage: test_tensor() without return types