def size(self, dim: int=None) -> Union[(torch.Size, int)]:
    '\n        Returns a :Union:`[torch.Size, int]` which represents the size of the tensor.\n            The dimension can be specified.\n\n        Args:\n            dim (int, optional): the dimension over which the size represents.\n                If specified, it returns the size of the given dimension.\n                If not, it returns a subclass of tuple.\n                Default: ``None``\n\n        Returns:\n            A :Union:`[torch.Size, int]` represents the size of the tensor.\n        '
    size = self._metadata.size
    if (dim is None):
        return size
    if ((dim < 0) or (dim >= len(size))):
        raise ValueError(f'Argument ``dim`` must be within the range of tensor dimensions [0, {len(size)})')
    return size[dim]
Returns a :Union:`[torch.Size, int]` which represents the size of the tensor.
    The dimension can be specified.

Args:
    dim (int, optional): the dimension over which the size represents.
        If specified, it returns the size of the given dimension.
        If not, it returns a subclass of tuple.
        Default: ``None``

Returns:
    A :Union:`[torch.Size, int]` represents the size of the tensor.
def size(self, dim: int=None) -> Union[(torch.Size, int)]:
    '\n        Returns a :Union:`[torch.Size, int]` which represents the size of the tensor.\n            The dimension can be specified.\n\n        Args:\n            dim (int, optional): the dimension over which the size represents.\n                If specified, it returns the size of the given dimension.\n                If not, it returns a subclass of tuple.\n                Default: ``None``\n\n        Returns:\n            A :Union:`[torch.Size, int]` represents the size of the tensor.\n        '
    size = self._metadata.size
    if (dim is None):
        return size
    if ((dim < 0) or (dim >= len(size))):
        raise ValueError(f'Argument ``dim`` must be within the range of tensor dimensions [0, {len(size)})')
    return size[dim]