Class EncodingHandler
- java.lang.Object
-
- org.deeplearning4j.optimize.solvers.accumulation.EncodingHandler
-
- All Implemented Interfaces:
Serializable
,MessageHandler
public class EncodingHandler extends Object implements MessageHandler
- See Also:
- Serialized Form
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description EncodingHandler(ThresholdAlgorithm thresholdAlgorithm, ResidualPostProcessor residualPostProcessor, Integer boundary, boolean encodingDebugMode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
applyPostProcessor(int iteration, int epoch, Double lastThreshold, INDArray residuals)
boolean
broadcastUpdates(INDArray updates, int iterationNumber, int epochNumber)
This method does broadcast of given update message across networkINDArray
decodeUpdates(INDArray message)
Deprecated.INDArray
encodeUpdates(int iteration, int epoch, INDArray updates)
protected static String
format(double d)
ThresholdAlgorithm
getAverageThresholdAlgorithm()
This should ONLY be called once all training threads have completedvoid
initialize(@NonNull GradientsAccumulator accumulator)
This method does initial configuration of given MessageHandler instanceprotected void
logThresholdIfReq(boolean denseUpdates, int iter, int epoch)
protected void
residualDebugOutputIfRequired(INDArray residual)
protected void
sendMessage(INDArray message, int iterationNumber, int epochNumber)
This method does loops encoded data back to updates queue
-
-
-
Field Detail
-
THRESHOLD_LOG_FREQ_MS
public static final long THRESHOLD_LOG_FREQ_MS
- See Also:
- Constant Field Values
-
accumulator
protected transient GradientsAccumulator accumulator
-
initialThresholdAlgorithm
protected ThresholdAlgorithm initialThresholdAlgorithm
-
initialResidualPostProcessor
protected ResidualPostProcessor initialResidualPostProcessor
-
boundary
protected Integer boundary
-
encodingDebugMode
protected boolean encodingDebugMode
-
atomicBoundary
protected AtomicInteger atomicBoundary
-
thresholdAlgorithm
protected ThreadLocal<ThresholdAlgorithm> thresholdAlgorithm
-
allThreadThresholdAlgorithms
protected Map<Long,ThresholdAlgorithm> allThreadThresholdAlgorithms
-
residualPostProcessor
protected ThreadLocal<ResidualPostProcessor> residualPostProcessor
-
iterations
protected ThreadLocal<AtomicLong> iterations
-
lastStep
protected ThreadLocal<AtomicLong> lastStep
-
lastThreshold
protected ThreadLocal<org.nd4j.shade.guava.util.concurrent.AtomicDouble> lastThreshold
-
lastSparsityRatio
protected ThreadLocal<org.nd4j.shade.guava.util.concurrent.AtomicDouble> lastSparsityRatio
-
currentThreshold
protected ThreadLocal<org.nd4j.shade.guava.util.concurrent.AtomicDouble> currentThreshold
-
bitmapMode
protected ThreadLocal<AtomicBoolean> bitmapMode
-
lastIterWasDense
protected ThreadLocal<AtomicBoolean> lastIterWasDense
-
lastThresholdLogTime
protected final AtomicLong lastThresholdLogTime
-
formatter
protected static ThreadLocal<DecimalFormat> formatter
-
formatter2
protected static ThreadLocal<DecimalFormat> formatter2
-
-
Constructor Detail
-
EncodingHandler
public EncodingHandler(ThresholdAlgorithm thresholdAlgorithm, ResidualPostProcessor residualPostProcessor, Integer boundary, boolean encodingDebugMode)
-
-
Method Detail
-
initialize
public void initialize(@NonNull @NonNull GradientsAccumulator accumulator)
Description copied from interface:MessageHandler
This method does initial configuration of given MessageHandler instance- Specified by:
initialize
in interfaceMessageHandler
-
applyPostProcessor
public void applyPostProcessor(int iteration, int epoch, Double lastThreshold, INDArray residuals)
-
decodeUpdates
@Deprecated public INDArray decodeUpdates(INDArray message)
Deprecated.
-
sendMessage
protected void sendMessage(INDArray message, int iterationNumber, int epochNumber)
This method does loops encoded data back to updates queue- Parameters:
message
-
-
broadcastUpdates
public boolean broadcastUpdates(INDArray updates, int iterationNumber, int epochNumber)
Description copied from interface:MessageHandler
This method does broadcast of given update message across network- Specified by:
broadcastUpdates
in interfaceMessageHandler
- Returns:
- TRUE if something was sent, FALSE otherwise
-
logThresholdIfReq
protected void logThresholdIfReq(boolean denseUpdates, int iter, int epoch)
-
residualDebugOutputIfRequired
protected void residualDebugOutputIfRequired(INDArray residual)
-
format
protected static String format(double d)
-
getAverageThresholdAlgorithm
public ThresholdAlgorithm getAverageThresholdAlgorithm()
This should ONLY be called once all training threads have completed- Returns:
-
-