Package org.nd4j.autodiff.validation
Class GradCheckUtil
- java.lang.Object
-
- org.nd4j.autodiff.validation.GradCheckUtil
-
public class GradCheckUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GradCheckUtil.ActGradConfig
static class
GradCheckUtil.Subset
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_DEBUG_MODE
static double
DEFAULT_EPS
static boolean
DEFAULT_EXIT_FIRST_FAILURE
static double
DEFAULT_MAX_REL_ERROR
static double
DEFAULT_MIN_ABS_ERROR
static boolean
DEFAULT_PRINT
-
Constructor Summary
Constructors Constructor Description GradCheckUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
checkActivationGradients(GradCheckUtil.ActGradConfig config)
Gradient check the ACTIVATIONS (i.e., ARRAY type SDVariables) as opposed to the parameters of a network (as are tested incheckGradients(SameDiff, Map, double, double, double, boolean, boolean, boolean, boolean, Set, Map, int, Subset)
static boolean
checkGradients(SameDiff sd, Map<String,INDArray> placeholderValues, boolean print, boolean exitOnFirstFailure)
static boolean
checkGradients(SameDiff sd, Map<String,INDArray> placeholderValues, double eps, double maxRelError, double minAbsError, boolean print, boolean exitOnFirstFailure)
static boolean
checkGradients(SameDiff sd, Map<String,INDArray> placeholderValues, double eps, double maxRelError, double minAbsError, boolean print, boolean exitOnFirstFailure, boolean skipValidation, boolean debugMode, Set<String> skipVariables, Map<String,INDArray> gradCheckMask)
static boolean
checkGradients(SameDiff sd, Map<String,INDArray> placeholderValues, double eps, double maxRelError, double minAbsError, boolean print, boolean exitOnFirstFailure, boolean skipValidation, boolean debugMode, Set<String> skipVariables, Map<String,INDArray> gradCheckMask, int maxPerParam, GradCheckUtil.Subset subset)
static boolean
checkGradients(SameDiff sd, Map<String,INDArray> placeholderValues, String... skipVariables)
static boolean
checkGradients(TestCase t)
static void
validateInternalState(SameDiff sd, boolean generateAndCheckGradFn)
-
-
-
Field Detail
-
DEFAULT_PRINT
public static final boolean DEFAULT_PRINT
- See Also:
- Constant Field Values
-
DEFAULT_EXIT_FIRST_FAILURE
public static final boolean DEFAULT_EXIT_FIRST_FAILURE
- See Also:
- Constant Field Values
-
DEFAULT_DEBUG_MODE
public static final boolean DEFAULT_DEBUG_MODE
- See Also:
- Constant Field Values
-
DEFAULT_EPS
public static final double DEFAULT_EPS
- See Also:
- Constant Field Values
-
DEFAULT_MAX_REL_ERROR
public static final double DEFAULT_MAX_REL_ERROR
- See Also:
- Constant Field Values
-
DEFAULT_MIN_ABS_ERROR
public static final double DEFAULT_MIN_ABS_ERROR
- See Also:
- Constant Field Values
-
-
Method Detail
-
checkGradients
public static boolean checkGradients(TestCase t)
-
checkGradients
public static boolean checkGradients(SameDiff sd, Map<String,INDArray> placeholderValues, String... skipVariables)
-
checkGradients
public static boolean checkGradients(SameDiff sd, Map<String,INDArray> placeholderValues, boolean print, boolean exitOnFirstFailure)
-
checkGradients
public static boolean checkGradients(SameDiff sd, Map<String,INDArray> placeholderValues, double eps, double maxRelError, double minAbsError, boolean print, boolean exitOnFirstFailure)
-
checkGradients
public static boolean checkGradients(SameDiff sd, Map<String,INDArray> placeholderValues, double eps, double maxRelError, double minAbsError, boolean print, boolean exitOnFirstFailure, boolean skipValidation, boolean debugMode, Set<String> skipVariables, Map<String,INDArray> gradCheckMask)
-
checkGradients
public static boolean checkGradients(SameDiff sd, Map<String,INDArray> placeholderValues, double eps, double maxRelError, double minAbsError, boolean print, boolean exitOnFirstFailure, boolean skipValidation, boolean debugMode, Set<String> skipVariables, Map<String,INDArray> gradCheckMask, int maxPerParam, GradCheckUtil.Subset subset)
-
checkActivationGradients
public static boolean checkActivationGradients(GradCheckUtil.ActGradConfig config)
Gradient check the ACTIVATIONS (i.e., ARRAY type SDVariables) as opposed to the parameters of a network (as are tested incheckGradients(SameDiff, Map, double, double, double, boolean, boolean, boolean, boolean, Set, Map, int, Subset)
- Parameters:
config
- Configuration for gradient check- Returns:
- True if gradient checks pass
-
validateInternalState
public static void validateInternalState(SameDiff sd, boolean generateAndCheckGradFn)
-
-