Package org.deeplearning4j.parallelism
Class InplaceParallelInference
- java.lang.Object
-
- org.deeplearning4j.parallelism.ParallelInference
-
- org.deeplearning4j.parallelism.InplaceParallelInference
-
public class InplaceParallelInference extends ParallelInference
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
InplaceParallelInference.ModelHolder
protected static class
InplaceParallelInference.ModelSelector
-
Nested classes/interfaces inherited from class org.deeplearning4j.parallelism.ParallelInference
ParallelInference.Builder, ParallelInference.ObservablesProvider
-
-
Field Summary
Fields Modifier and Type Field Description protected List<InplaceParallelInference.ModelHolder>
holders
protected Object
locker
protected InplaceParallelInference.ModelSelector
selector
-
Fields inherited from class org.deeplearning4j.parallelism.ParallelInference
batchLimit, DEFAULT_BATCH_LIMIT, DEFAULT_INFERENCE_MODE, DEFAULT_NUM_WORKERS, DEFAULT_QUEUE_LIMIT, inferenceMode, loadBalanceMode, model, nanos, queueLimit, workers
-
-
Constructor Summary
Constructors Constructor Description InplaceParallelInference()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.deeplearning4j.nn.api.Model[]
getCurrentModelsFromWorkers()
This method returns Models used in workers at this moment PLEASE NOTE: This method is NOT thread safe, and should NOT be used anywhere but testsprotected void
init()
<T> T
output(@NonNull org.deeplearning4j.nn.api.ModelAdapter<T> adapter, org.nd4j.linalg.api.ndarray.INDArray[] input, org.nd4j.linalg.api.ndarray.INDArray[] inputMasks, org.nd4j.linalg.api.ndarray.INDArray[] labelsMasks)
This method does forward pass and returns output provided by OutputAdapterorg.nd4j.linalg.api.ndarray.INDArray[]
output(org.nd4j.linalg.api.ndarray.INDArray[] input, org.nd4j.linalg.api.ndarray.INDArray[] inputMasks)
Generate predictions/outputs from the network, optionally using input masks for predictionsvoid
updateModel(@NonNull org.deeplearning4j.nn.api.Model model)
This method allows to update Model used for inference in runtime, without queue reset
-
-
-
Field Detail
-
holders
protected List<InplaceParallelInference.ModelHolder> holders
-
selector
protected InplaceParallelInference.ModelSelector selector
-
locker
protected final Object locker
-
-
Method Detail
-
init
protected void init()
- Overrides:
init
in classParallelInference
-
updateModel
public void updateModel(@NonNull @NonNull org.deeplearning4j.nn.api.Model model)
Description copied from class:ParallelInference
This method allows to update Model used for inference in runtime, without queue reset- Overrides:
updateModel
in classParallelInference
-
getCurrentModelsFromWorkers
protected org.deeplearning4j.nn.api.Model[] getCurrentModelsFromWorkers()
Description copied from class:ParallelInference
This method returns Models used in workers at this moment PLEASE NOTE: This method is NOT thread safe, and should NOT be used anywhere but tests- Overrides:
getCurrentModelsFromWorkers
in classParallelInference
- Returns:
-
output
public org.nd4j.linalg.api.ndarray.INDArray[] output(org.nd4j.linalg.api.ndarray.INDArray[] input, org.nd4j.linalg.api.ndarray.INDArray[] inputMasks)
Description copied from class:ParallelInference
Generate predictions/outputs from the network, optionally using input masks for predictions- Overrides:
output
in classParallelInference
- Parameters:
input
- Input to the networkinputMasks
- Input masks for the network. May be null.- Returns:
- Output from the network
-
output
public <T> T output(@NonNull @NonNull org.deeplearning4j.nn.api.ModelAdapter<T> adapter, org.nd4j.linalg.api.ndarray.INDArray[] input, org.nd4j.linalg.api.ndarray.INDArray[] inputMasks, org.nd4j.linalg.api.ndarray.INDArray[] labelsMasks)
This method does forward pass and returns output provided by OutputAdapter- Type Parameters:
T
-- Parameters:
adapter
-input
-inputMasks
-- Returns:
-
-