T
- The output type.public interface OutputConverter<T extends Output<T>> extends com.oracle.labs.mlrg.olcut.config.Configurable, com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>, Serializable
Output
into a Tensor
and vice versa.
Also provides the loss function for this output type, along with the function which converts the TF graph output into a well formed output float (e.g., a softmax for classification, a sigmoid for multi-label, or the identity function for regression).
N.B. TensorFlow support is experimental and may change without a major version bump.
Modifier and Type | Method and Description |
---|---|
List<T> |
convertToBatchOutput(org.tensorflow.Tensor tensor,
ImmutableOutputInfo<T> outputIDInfo)
Converts a
Tensor containing multiple outputs into a list of Output s. |
List<Prediction<T>> |
convertToBatchPrediction(org.tensorflow.Tensor tensor,
ImmutableOutputInfo<T> outputIDInfo,
int[] numValidFeatures,
List<Example<T>> examples)
Converts a
Tensor containing multiple outputs into a list of Prediction s. |
T |
convertToOutput(org.tensorflow.Tensor tensor,
ImmutableOutputInfo<T> outputIDInfo)
Converts a
Tensor into the specified output type. |
Prediction<T> |
convertToPrediction(org.tensorflow.Tensor tensor,
ImmutableOutputInfo<T> outputIDInfo,
int numValidFeatures,
Example<T> example)
Converts a
Tensor into a Prediction . |
org.tensorflow.Tensor |
convertToTensor(List<Example<T>> examples,
ImmutableOutputInfo<T> outputIDInfo)
Converts a list of
Example into a Tensor representing all the outputs
in the list. |
org.tensorflow.Tensor |
convertToTensor(T output,
ImmutableOutputInfo<T> outputIDInfo)
Converts an
Output into a Tensor representing it's output. |
boolean |
generatesProbabilities()
Does this OutputConverter generate probabilities.
|
BiFunction<org.tensorflow.op.Ops,com.oracle.labs.mlrg.olcut.util.Pair<org.tensorflow.op.core.Placeholder<? extends org.tensorflow.types.family.TNumber>,org.tensorflow.Operand<org.tensorflow.types.family.TNumber>>,org.tensorflow.Operand<org.tensorflow.types.family.TNumber>> |
loss()
The loss function associated with this prediction type.
|
<U extends org.tensorflow.types.family.TNumber> |
outputTransformFunction()
Produces an output transformation function that applies the operation to
the graph from the supplied
Ops , taking a graph output operation. |
BiFunction<org.tensorflow.op.Ops,com.oracle.labs.mlrg.olcut.util.Pair<org.tensorflow.op.core.Placeholder<? extends org.tensorflow.types.family.TNumber>,org.tensorflow.Operand<org.tensorflow.types.family.TNumber>>,org.tensorflow.Operand<org.tensorflow.types.family.TNumber>> loss()
<U extends org.tensorflow.types.family.TNumber> BiFunction<org.tensorflow.op.Ops,org.tensorflow.Operand<U>,org.tensorflow.op.Op> outputTransformFunction()
Ops
, taking a graph output operation.
For example this function will apply a softmax for classification, a sigmoid for multi-label, or the identity function for regression.
U
- The type of the graph output.Prediction<T> convertToPrediction(org.tensorflow.Tensor tensor, ImmutableOutputInfo<T> outputIDInfo, int numValidFeatures, Example<T> example)
Tensor
into a Prediction
.tensor
- The tensor to convert.outputIDInfo
- The output info to use to identify the outputs.numValidFeatures
- The number of valid features used by the prediction.example
- The example to insert into the prediction.T convertToOutput(org.tensorflow.Tensor tensor, ImmutableOutputInfo<T> outputIDInfo)
Tensor
into the specified output type.tensor
- The tensor to convert.outputIDInfo
- The output info to use to identify the outputs.List<Prediction<T>> convertToBatchPrediction(org.tensorflow.Tensor tensor, ImmutableOutputInfo<T> outputIDInfo, int[] numValidFeatures, List<Example<T>> examples)
Tensor
containing multiple outputs into a list of Prediction
s.tensor
- The tensor to convert.outputIDInfo
- The output info to use to identify the outputs.numValidFeatures
- The number of valid features used by the prediction.examples
- The example to insert into the prediction.List<T> convertToBatchOutput(org.tensorflow.Tensor tensor, ImmutableOutputInfo<T> outputIDInfo)
Tensor
containing multiple outputs into a list of Output
s.tensor
- The tensor to convert.outputIDInfo
- The output info to use to identify the outputs.org.tensorflow.Tensor convertToTensor(T output, ImmutableOutputInfo<T> outputIDInfo)
Output
into a Tensor
representing it's output.output
- The output to convert.outputIDInfo
- The output info to use to identify the outputs.org.tensorflow.Tensor convertToTensor(List<Example<T>> examples, ImmutableOutputInfo<T> outputIDInfo)
Example
into a Tensor
representing all the outputs
in the list. It accepts a list of Example rather than a list of Output for efficiency reasons.examples
- The examples to convert.outputIDInfo
- The output info to use to identify the outputs.boolean generatesProbabilities()
Prediction
.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.