class_docstr: A tensor with mutable shape information.
  Inspired by `Ideal FLOPS counter <https://dev-discuss.pytorch.org/t/the-ideal-pytorch-flop-counter-with-torch-dispatch/505>`__.
class_docstr_tok: ["A","tensor","with","mutable","shape","information",".","Inspired","by","`","Ideal","FLOPS","counter","<","https",":","\/\/dev-discuss.pytorch.org\/t\/the-ideal-pytorch-flop-counter-with-torch-dispatch\/505",">","`","__","."]
docstr: Overrides the size method of Tensor as it's most important to us.
  
  It should behave similarly to the original size method,
  except the return value could be a tuple and each element is an :class:`IntProxy`.
  
  Since the return value of size is often used as integers in user code,
  we must return a tuple of :class:`IntProxy` instead of raw mutable expressions,
  so that they can be seamlessly used in user code.
docstr_tok: ["Overrides","the","size","method","of","Tensor","as","it","'s","most","important","to","us",".","It","should","behave","similarly","to","the","original","size","method",",","except","the","return","value","could","be","a","tuple","and","each","element","is","an",":","class",":","`","IntProxy","`",".","Since","the","return","value","of","size","is","often","used","as","integers","in","user","code",",","we","must","return","a","tuple","of",":","class",":","`","IntProxy","`","instead","of","raw","mutable","expressions",",","so","that","they","can","be","seamlessly","used","in","user","code","."]
code: def size(
      self, dim: int | None = None
  ) -> IntProxy | int | tuple[IntProxy | int, ...]:
      """Overrides the size method of Tensor as it's most important to us.
  
      It should behave similarly to the original size method,
      except the return value could be a tuple and each element is an :class:`IntProxy`.
  
      Since the return value of size is often used as integers in user code,
      we must return a tuple of :class:`IntProxy` instead of raw mutable expressions,
      so that they can be seamlessly used in user code.
      """
      # These branches can't be merged together because
      # `tensor.size()`` is not equivalent to `tensor.size(None)``.
      if dim is None:
          original_size = self.elem.size()
          if self.real_shape is None:
              # The real shape is unknown. We can't do anything.
              return original_size
          assert len(original_size) == len(self.real_shape)
          return tuple(
              IntProxy(s, e)
              for s, e in zip(original_size, self.real_shape)
          )
      else:
          original_size = self.elem.size(dim)
          if self.real_shape is None:
              return original_size
          original_size = self.elem.size(dim)
          return IntProxy(original_size, self.real_shape[dim])
  
imports: from __future__ import annotations
  import functools
  import logging
  import traceback
  from typing import Union, Tuple, Callable, Iterable, Any, NamedTuple, Dict, cast, overload
  import torch
  from torch import nn
  from torch.utils.hooks import RemovableHandle
  from nni.mutable import MutableExpression, Mutable, LabeledMutable, Sample, SampleValidationError
  from nni.mutable.mutable import _mutable_equal
  from .misc import is_leaf_module, argument_in_spec
label_desc: Use image node_id 5 for calling the ShapeTensor obj's underlying member method code with example usage: obj.size(dim) and returns: tuple, IntProxy, original_size, original_size