public class GradientCheckUtil extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
checkGradients(ComputationGraph graph,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray[] inputs,
INDArray[] labels)
Check backprop gradients for a ComputationGraph
|
static boolean |
checkGradients(ComputationGraph graph,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray[] inputs,
INDArray[] labels,
INDArray[] fMask,
INDArray[] lMask) |
static boolean |
checkGradients(ComputationGraph graph,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray[] inputs,
INDArray[] labels,
INDArray[] fMask,
INDArray[] lMask,
Set<String> excludeParams) |
static boolean |
checkGradients(ComputationGraph graph,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray[] inputs,
INDArray[] labels,
INDArray[] fMask,
INDArray[] lMask,
Set<String> excludeParams,
Consumer<ComputationGraph> callEachIter) |
static boolean |
checkGradients(ComputationGraph graph,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray[] inputs,
INDArray[] labels,
INDArray[] fMask,
INDArray[] lMask,
Set<String> excludeParams,
Integer rngSeedResetEachIter) |
static boolean |
checkGradients(MultiLayerNetwork mln,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray input,
INDArray labels)
Check backprop gradients for a MultiLayerNetwork.
|
static boolean |
checkGradients(MultiLayerNetwork mln,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray input,
INDArray labels,
INDArray inputMask,
INDArray labelMask) |
static boolean |
checkGradients(MultiLayerNetwork mln,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray input,
INDArray labels,
INDArray inputMask,
INDArray labelMask,
boolean subset,
int maxPerParam) |
static boolean |
checkGradients(MultiLayerNetwork mln,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray input,
INDArray labels,
INDArray inputMask,
INDArray labelMask,
boolean subset,
int maxPerParam,
Set<String> excludeParams) |
static boolean |
checkGradients(MultiLayerNetwork mln,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray input,
INDArray labels,
INDArray inputMask,
INDArray labelMask,
boolean subset,
int maxPerParam,
Set<String> excludeParams,
Consumer<MultiLayerNetwork> callEachIter) |
static boolean |
checkGradients(MultiLayerNetwork mln,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray input,
INDArray labels,
INDArray inputMask,
INDArray labelMask,
boolean subset,
int maxPerParam,
Set<String> excludeParams,
Integer rngSeedResetEachIter) |
static boolean |
checkGradientsPretrainLayer(Layer layer,
double epsilon,
double maxRelError,
double minAbsoluteError,
boolean print,
boolean exitOnFirstError,
INDArray input,
int rngSeed)
Check backprop gradients for a pretrain layer
NOTE: gradient checking pretrain layers can be difficult...
|
public static boolean checkGradients(MultiLayerNetwork mln, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray input, INDArray labels)
mln
- MultiLayerNetwork to test. This must be initialized.epsilon
- Usually on the order/ of 1e-4 or so.maxRelError
- Maximum relative error. Usually < 1e-5 or so, though maybe more for deep networks or those with nonlinear activationminAbsoluteError
- Minimum absolute error to cause a failure. Numerical gradients can be non-zero due to precision issues.
For example, 0.0 vs. 1e-18: relative error is 1.0, but not really a failureprint
- Whether to print full pass/failure details for each parameter gradientexitOnFirstError
- If true: return upon first failure. If false: continue checking even if
one parameter gradient has failed. Typically use false for debugging, true for unit tests.input
- Input array to use for forward pass. May be mini-batch data.labels
- Labels/targets to use to calculate backprop gradient. May be mini-batch data.public static boolean checkGradients(MultiLayerNetwork mln, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray input, INDArray labels, INDArray inputMask, INDArray labelMask)
public static boolean checkGradients(MultiLayerNetwork mln, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray input, INDArray labels, INDArray inputMask, INDArray labelMask, boolean subset, int maxPerParam)
public static boolean checkGradients(MultiLayerNetwork mln, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray input, INDArray labels, INDArray inputMask, INDArray labelMask, boolean subset, int maxPerParam, Set<String> excludeParams)
public static boolean checkGradients(MultiLayerNetwork mln, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray input, INDArray labels, INDArray inputMask, INDArray labelMask, boolean subset, int maxPerParam, Set<String> excludeParams, Integer rngSeedResetEachIter)
public static boolean checkGradients(MultiLayerNetwork mln, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray input, INDArray labels, INDArray inputMask, INDArray labelMask, boolean subset, int maxPerParam, Set<String> excludeParams, Consumer<MultiLayerNetwork> callEachIter)
public static boolean checkGradients(ComputationGraph graph, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray[] inputs, INDArray[] labels)
graph
- ComputationGraph to test. This must be initialized.epsilon
- Usually on the order of 1e-4 or so.maxRelError
- Maximum relative error. Usually < 0.01, though maybe more for deep networksminAbsoluteError
- Minimum absolute error to cause a failure. Numerical gradients can be non-zero due to precision issues.
For example, 0.0 vs. 1e-18: relative error is 1.0, but not really a failureprint
- Whether to print full pass/failure details for each parameter gradientexitOnFirstError
- If true: return upon first failure. If false: continue checking even if
one parameter gradient has failed. Typically use false for debugging, true for unit tests.inputs
- Input arrays to use for forward pass. May be mini-batch data.labels
- Labels/targets (output) arrays to use to calculate backprop gradient. May be mini-batch data.public static boolean checkGradients(ComputationGraph graph, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray[] inputs, INDArray[] labels, INDArray[] fMask, INDArray[] lMask)
public static boolean checkGradients(ComputationGraph graph, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray[] inputs, INDArray[] labels, INDArray[] fMask, INDArray[] lMask, Set<String> excludeParams)
public static boolean checkGradients(ComputationGraph graph, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray[] inputs, INDArray[] labels, INDArray[] fMask, INDArray[] lMask, Set<String> excludeParams, Integer rngSeedResetEachIter)
public static boolean checkGradients(ComputationGraph graph, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray[] inputs, INDArray[] labels, INDArray[] fMask, INDArray[] lMask, Set<String> excludeParams, Consumer<ComputationGraph> callEachIter)
public static boolean checkGradientsPretrainLayer(Layer layer, double epsilon, double maxRelError, double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray input, int rngSeed)
Copyright © 2018. All rights reserved.