def _partition_spec(self, shape, partition_info):
    """Build magic (and sparsely documented) shapes_and_slices spec string."""
    if partition_info is None:
      return ''  # Empty string indicates a non-partitioned tensor.
    ssi = tf.Variable.SaveSliceInfo(
        full_name=self._var_name,
        full_shape=partition_info.full_shape,
        var_offset=partition_info.var_offset,
        var_shape=shape)
    return ssi.spec