Package stream.nebula.operators
Class InferModelOperator
- java.lang.Object
-
- stream.nebula.operators.Operator
-
- stream.nebula.operators.InferModelOperator
-
public class InferModelOperator extends Operator
Operator
class that encodes theQuery.inferModel(java.io.InputStream, java.lang.String)
method.This class follows the builder pattern. Methods such as
Query.inferModel(java.io.InputStream, java.lang.String)
andInferModelOperator.InferModelOn.on(stream.nebula.expression.FieldExpression...)
return helper classesInferModelOperator.InferModelOn
andInferModelOperator.InferModelAs
which manipulate the state of thisInferModelOperator
instance; finallyInferModelOperator.InferModelAs.as(stream.nebula.expression.TypedFieldExpression...)
returns the originalQuery
instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
InferModelOperator.InferModelAs
Helper inner class to set the output attributes in theInferModelOperator.InferModelAs.as(stream.nebula.expression.TypedFieldExpression...)
method, which contain the result of the TensorFlow model.class
InferModelOperator.InferModelOn
Helper inner class to set the input attributes which are passed to the TensorFlow model in theInferModelOperator.InferModelOn.on(stream.nebula.expression.FieldExpression...)
method.
-
Field Summary
-
Fields inherited from class stream.nebula.operators.Operator
childOperator
-
-
Constructor Summary
Constructors Constructor Description InferModelOperator(@NonNull Operator childOperator, @NonNull java.io.InputStream model, @NonNull java.lang.String name, @NonNull Query query)
Create a newInferModelOperator
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<FieldExpression>
getInputAttributes()
Access the input attributes.byte[]
getModel()
Access the TensorFlow model as a byte array.java.lang.String
getName()
Access the model name.java.util.List<TypedFieldExpression>
getOutputAttributes()
Access the output attributes.-
Methods inherited from class stream.nebula.operators.Operator
getChildOperator
-
-
-
-
Constructor Detail
-
InferModelOperator
public InferModelOperator(@NonNull Operator childOperator, @NonNull java.io.InputStream model, @NonNull java.lang.String name, @NonNull Query query) throws java.io.IOException
Create a newInferModelOperator
.- Parameters:
childOperator
- The previous operator in the operator chain ofQuery
instance.model
- An input stream containing the TensorFlow model.name
- The name of the model. Used internally as the filename under which the model is temporarily stored on the worker. It is the responsibility of the client code that this name is unique.query
- TheQuery
instance on whichQuery.joinWith(stream.nebula.runtime.Query)
was called.- Throws:
java.lang.IllegalArgumentException
- Ifmodel
is null.java.io.IOException
- If the input stream cannot be read.
-
-
Method Detail
-
getModel
public byte[] getModel()
Access the TensorFlow model as a byte array.- Returns:
- The TensorFlow model.
-
getName
public java.lang.String getName()
Access the model name.- Returns:
- The model name.
-
getInputAttributes
public java.util.List<FieldExpression> getInputAttributes()
Access the input attributes.- Returns:
- The list of input attributes.
-
getOutputAttributes
public java.util.List<TypedFieldExpression> getOutputAttributes()
Access the output attributes.- Returns:
- The list of output attributes.
-
-