def get_tf_tensor_shape(tensor):
  """Get tensor shape, if there is unkown tensor, set it as None"""
  shape = []
  try:
    shape = tensor.get_shape().as_list()
    if any(s is None for s in shape):
      return None
    return shape
  except Exception:  # pylint: disable=broad-except
    shape = None
  return shape