Ejemplo n.º 1
0
    def clip_last_batch(self, last_batch, true_size):
        """This method performs last batch clipping.
    Used in cases when dataset is not divisible by the batch size and model
    does not support dynamic batch sizes. In those cases, the last batch will
    contain some data from the "next epoch" and this method can be used
    to remove that data. This method works for both
    dense and sparse tensors. In most cases you will not need to overwrite this
    method.

    Args:
      last_batch (list): list with elements that could be either ``np.array``
          or ``tf.SparseTensorValue`` containing data for last batch. The
          assumption is that the first axis of all data tensors will correspond
          to the current batch size.
      true_size (int): true size that the last batch should be cut to.
    """
        return clip_last_batch(last_batch, true_size)
Ejemplo n.º 2
0
  def clip_last_batch(self, last_batch, true_size):
    """This method performs last batch clipping.
    Used in cases when dataset is not divisible by the batch size and model
    does not support dynamic batch sizes. In those cases, the last batch will
    contain some data from the "next epoch" and this method can be used
    to remove that data. This method works for both
    dense and sparse tensors. In most cases you will not need to overwrite this
    method.

    Args:
      last_batch (list): list with elements that could be either ``np.array``
          or ``tf.SparseTensorValue`` containing data for last batch. The
          assumption is that the first axis of all data tensors will correspond
          to the current batch size.
      true_size (int): true size that the last batch should be cut to.
    """
    return clip_last_batch(last_batch, true_size)