def METHOD_NAME(shape):
  """Get shape from tensorflow attr 'shape'."""
  dims = None
  try:
    if not shape.unknown_rank:
      dims = [int(d.size) for d in shape.dim]
  except:  # pylint: disable=bare-except
    pass
  return dims