def nrows(self):
    """Returns the number of rows created by this `RowPartition`.

    Returns:
      scalar integer Tensor
    """
    if self._nrows is not None:
      return self._nrows
    nsplits = tensor_shape.dimension_at_index(self._row_splits.shape, 0)
    if nsplits.value is None:
      return array_ops.shape(self._row_splits, out_type=self.dtype)[0] - 1
    else:
      return constant_op.constant(nsplits.value - 1, dtype=self.dtype)