def _last_index ( x , default_dim ) : if x . get_shape ( ) . ndims is not None : return len ( x . get_shape ( ) ) - 1 else : return default_dim
how to get last element of an2d array in python
Returns the last dimension s index or default_dim if x has no shape .
def _last_index(x, default_dim):
  """Returns the last dimension's index or default_dim if x has no shape."""
  if x.get_shape().ndims is not None:
    return len(x.get_shape()) - 1
  else:
    return default_dim