code: def nested_shape(array_or_tuple, seen=None):
      """Figure out the shape of tensors possibly embedded in tuples
      i.e
      [0,0] returns (2)
      ([0,0], [0,0]) returns (2,2)
      (([0,0], [0,0]),[0,0]) returns ((2,2),2)
      """
      if seen is None:
          seen = set()
      if hasattr(array_or_tuple, "size"):
          # pytorch tensors use V.size() to get size of tensor
          return list(array_or_tuple.size())
      elif hasattr(array_or_tuple, "get_shape"):
          # tensorflow uses V.get_shape() to get size of tensor
          return array_or_tuple.get_shape().as_list()
      elif hasattr(array_or_tuple, "shape"):
          return array_or_tuple.shape
  
      seen.add(id(array_or_tuple))
      try:
          # treat object as iterable
          return [
              nested_shape(item, seen) if id(item) not in seen else 0
              for item in list(array_or_tuple)
          ]
      except TypeError:
          # object is not actually iterable
          # LB: Maybe we should throw an error?
          return []
  
imports: import itertools
  from functools import reduce
  from operator import mul
  from typing import List
  import wandb
  from wandb import util
  from wandb.data_types import Node
label_desc: Use image node_id 1 for calling a global function with example usage: nested_shape(array_or_tuple, seen) and returns: list, unknown, array_or_tuple, list, array_or_tuple