Class DatasetOptional

java.lang.Object
org.tensorflow.framework.data.DatasetOptional

public class DatasetOptional extends Object
An optional represents the result of a dataset getNext operation that may fail, when the end of the dataset has been reached.
  • Field Details

    • tf

      protected Ops tf
  • Constructor Details

    • DatasetOptional

      public DatasetOptional(Ops tf, Operand<?> optionalVariant, List<Class<? extends TType>> outputTypes, List<Shape> outputShapes)
      Creates a DatasetOptional dataset
      Parameters:
      tf - the TensorFlow Ops
      optionalVariant - the tensor that represents the dataset.
      outputTypes - a list of output types produced by this data set.
      outputShapes - a list of output shapes produced by this data set.
    • DatasetOptional

      protected DatasetOptional(DatasetOptional other)
      Creates a Dataset that is a copy of another Dataset
      Parameters:
      other - the other Dataset
  • Method Details

    • getOptionalVariant

      public Operand<?> getOptionalVariant()
      Gets the optional variant for this Dataset
      Returns:
      the optional variant for this Dataset
    • hasValue

      public Operand<TBool> hasValue()
      Gets the indicator of whether this optional has a value.
      Returns:
      the indicator of whether this optional has a value.
    • getValue

      public List<Operand<?>> getValue()
      Returns the value of the dataset element represented by this optional, if it exists.
      Returns:
      the value of the dataset element represented by this optional, if it exists.
    • fromComponents

      public static DatasetOptional fromComponents(Ops tf, List<Operand<?>> components, List<Class<? extends TType>> outputTypes, List<Shape> outputShapes)
      Creates a DatasetOptional from components.
      Parameters:
      tf - the TensorFlow Ops
      components - the components that constitute the DatasetOptional
      outputTypes - a list of output types produced by this data set.
      outputShapes - a list of output shapes produced by this data set.
      Returns:
      a a DatasetOptional
    • getOpsInstance

      public Ops getOpsInstance()
      Gets the TensorFlow Ops instance for this dataset
      Returns:
      the TensorFlow Ops instance for this dataset