public class InferenceSession extends AbstractSession<INDArray,DifferentialFunction>
AbstractSession.FrameIter, AbstractSession.VarId
availableForExec, availableForExecSet, execConstInputs, execInputs, execInputsAllIter, frameParents, nodeOutputs, OUTER_FRAME, sameDiff, subgraph, tensorArrays
Constructor and Description |
---|
InferenceSession(SameDiff sameDiff) |
Modifier and Type | Method and Description |
---|---|
DifferentialFunction |
getAndParameterizeOp(String opName,
AbstractSession.FrameIter frameIter,
Set<AbstractSession.VarId> opInputs,
Set<AbstractSession.VarId> allIterInputs,
Set<String> constAndPhInputs,
Map<String,INDArray> placeholderValues)
Get the parameterized op to execute - for example, the op/DifferentialFunction with all inputs set
|
protected INDArray |
getArray(SDVariable sdv,
Collection<AbstractSession.VarId> opInputs,
Collection<AbstractSession.VarId> allIterInputs) |
INDArray |
getConstantOrVariable(String variableName)
Get the constant or variable output - for example, constant array or constant shape.
|
INDArray[] |
getOutputs(DifferentialFunction op,
AbstractSession.FrameIter outputFrameIter,
Set<AbstractSession.VarId> opInputs,
Set<AbstractSession.VarId> allIterInputs,
Set<String> constAndPhInputs,
List<Listener> listeners,
At at,
MultiDataSet batch)
Execute the op - calculate INDArrays, or shape info, etc
|
INDArray[] |
getOutputsHelper(DifferentialFunction op,
AbstractSession.FrameIter outputFrameIter,
Set<AbstractSession.VarId> opInputs,
Set<AbstractSession.VarId> allIterInputs,
Set<String> constAndPhInputs) |
protected Map<String,INDArray> |
preprocessPlaceholders(Map<String,INDArray> placeholders)
Preprocess the placeholder values, if required.
|
addToExecInputs, allInputsAvailable, contains, get, get, initSubgraph, lookup, newVarId, newVarId, output, output, updateDescendentsForExec
public InferenceSession(@NonNull SameDiff sameDiff)
protected Map<String,INDArray> preprocessPlaceholders(Map<String,INDArray> placeholders)
AbstractSession
preprocessPlaceholders
in class AbstractSession<INDArray,DifferentialFunction>
placeholders
- Placeholders to preprocess.public INDArray[] getOutputs(DifferentialFunction op, AbstractSession.FrameIter outputFrameIter, Set<AbstractSession.VarId> opInputs, Set<AbstractSession.VarId> allIterInputs, Set<String> constAndPhInputs, List<Listener> listeners, At at, MultiDataSet batch)
AbstractSession
getOutputs
in class AbstractSession<INDArray,DifferentialFunction>
op
- Operation to exit. This should be parameterized (i.e., all inputs set)outputFrameIter
- The frame and iteration of the outputsopInputs
- The specific input arrays for the oppublic INDArray[] getOutputsHelper(DifferentialFunction op, AbstractSession.FrameIter outputFrameIter, Set<AbstractSession.VarId> opInputs, Set<AbstractSession.VarId> allIterInputs, Set<String> constAndPhInputs)
public INDArray getConstantOrVariable(String variableName)
AbstractSession
getConstantOrVariable
in class AbstractSession<INDArray,DifferentialFunction>
variableName
- The name of the variable to get the constant forpublic DifferentialFunction getAndParameterizeOp(String opName, AbstractSession.FrameIter frameIter, Set<AbstractSession.VarId> opInputs, Set<AbstractSession.VarId> allIterInputs, Set<String> constAndPhInputs, Map<String,INDArray> placeholderValues)
AbstractSession
getAndParameterizeOp
in class AbstractSession<INDArray,DifferentialFunction>
opName
- Name of the opframeIter
- The frame and iteration of the op outputsopInputs
- The inputs to the op (excluding constants/placeholders) - for the specific frame + iterationallIterInputs
- The inputs - those that are not iteration-specific (mainly Enter op vars, which might be used in all iterations but are only executed once on iter 0)constAndPhInputs
- The constant and placeholder inputs - used for all frames/iterationsprotected INDArray getArray(SDVariable sdv, Collection<AbstractSession.VarId> opInputs, Collection<AbstractSession.VarId> allIterInputs)
Copyright © 2019. All rights reserved.