def int_shape(x):
  """Returns the shape of a Keras tensor or a Keras variable as a tuple of
  integers or None entries.

  Arguments
  ---------
  x: Tensor or variable.

  Returns
  -------
  A tuple of integers (or None entries).
  """
  shape = x.get_shape()
  return tuple([i.__int__() for i in shape])