Package org.deeplearning4j.util
Class ValidationUtils
- java.lang.Object
-
- org.deeplearning4j.util.ValidationUtils
-
public class ValidationUtils extends Object
Validation methods for array sizes/shapes and value non-negativeness- Author:
- Ryan Nett
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int[]
validate1(int[] data, String paramName)
Reformats the input array to a length 1 array.static int[]
validate1NonNegative(int[] data, String paramName)
Reformats the input array to a length 1 array and checks that all values are >= 0.static int[]
validate2(int[] data, boolean allowSz1, String paramName)
Reformats the input array to a length 2 array.static int[]
validate2NonNegative(int[] data, boolean allowSz1, String paramName)
Reformats the input array to a length 2 array and checks that all values are >= 0.static int[][]
validate2x2(int[][] data, String paramName)
Reformats the input array to a 2x2 array.static int[][]
validate2x2NonNegative(int[][] data, String paramName)
Reformats the input array to a 2x2 array and checks that all values are >= 0.static int[]
validate3(int[] data, String paramName)
Reformats the input array to a length 3 array.static int[]
validate3NonNegative(int[] data, String paramName)
Reformats the input array to a length 3 array and checks that all values >= 0.static int[]
validate4(int[] data, String paramName)
Reformats the input array to a length 4 array.static int[]
validate4NonNegative(int[] data, String paramName)
Reformats the input array to a length 4 array and checks that all values >= 0.static int[]
validate6(int[] data, String paramName)
Reformats the input array to a length 6 array.static int[]
validate6NonNegative(int[] data, String paramName)
Reformats the input array to a length 6 array and checks that all values >= 0.static void
validateNonNegative(double data, String paramName)
Checks that the values is >= 0.static void
validateNonNegative(int[] data, String paramName)
Checks that all values are >= 0.static void
validateNonNegative(int data, String paramName)
Checks that the values is >= 0.
-
-
-
Method Detail
-
validateNonNegative
public static void validateNonNegative(int data, String paramName)
Checks that the values is >= 0.- Parameters:
data
- An intparamName
- The param name, for error reporting
-
validateNonNegative
public static void validateNonNegative(double data, String paramName)
Checks that the values is >= 0.- Parameters:
data
- An intparamName
- The param name, for error reporting
-
validateNonNegative
public static void validateNonNegative(int[] data, String paramName)
Checks that all values are >= 0.- Parameters:
data
- An arrayparamName
- The param name, for error reporting
-
validate1NonNegative
public static int[] validate1NonNegative(int[] data, String paramName)
Reformats the input array to a length 1 array and checks that all values are >= 0. If the array is length 1, returns the array- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 1 that represents the input
-
validate1
public static int[] validate1(int[] data, String paramName)
Reformats the input array to a length 1 array. If the array is length 1, returns the array- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 1 that represents the input
-
validate2NonNegative
public static int[] validate2NonNegative(int[] data, boolean allowSz1, String paramName)
Reformats the input array to a length 2 array and checks that all values are >= 0. If the array is length 1, returns [a, a] If the array is length 2, returns the array.- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 2 that represents the input
-
validate2
public static int[] validate2(int[] data, boolean allowSz1, String paramName)
Reformats the input array to a length 2 array. If the array is length 1, returns [a, a] If the array is length 2, returns the array.- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 2 that represents the input
-
validate2x2NonNegative
public static int[][] validate2x2NonNegative(int[][] data, String paramName)
Reformats the input array to a 2x2 array and checks that all values are >= 0. If the array is 2x1 ([[a], [b]]), returns [[a, a], [b, b]] If the array is 1x2 ([[a, b]]), returns [[a, b], [a, b]] If the array is 2x2, returns the array- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 2 that represents the input
-
validate2x2
public static int[][] validate2x2(int[][] data, String paramName)
Reformats the input array to a 2x2 array. If the array is 2x1 ([[a], [b]]), returns [[a, a], [b, b]] If the array is 1x2 ([[a, b]]), returns [[a, b], [a, b]] If the array is 2x2, returns the array- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 2 that represents the input
-
validate3NonNegative
public static int[] validate3NonNegative(int[] data, String paramName)
Reformats the input array to a length 3 array and checks that all values >= 0. If the array is length 1, returns [a, a, a] If the array is length 3, returns the array.- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 3 that represents the input
-
validate3
public static int[] validate3(int[] data, String paramName)
Reformats the input array to a length 3 array. If the array is length 1, returns [a, a, a] If the array is length 3, returns the array.- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 3 that represents the input
-
validate4NonNegative
public static int[] validate4NonNegative(int[] data, String paramName)
Reformats the input array to a length 4 array and checks that all values >= 0. If the array is length 1, returns [a, a, a, a] If the array is length 2, return [a, a, b, b] If the array is length 4, returns the array.- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 4 that represents the input
-
validate4
public static int[] validate4(int[] data, String paramName)
Reformats the input array to a length 4 array. If the array is length 1, returns [a, a, a, a] If the array is length 2, return [a, a, b, b] If the array is length 4, returns the array.- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 4 that represents the input
-
validate6NonNegative
public static int[] validate6NonNegative(int[] data, String paramName)
Reformats the input array to a length 6 array and checks that all values >= 0. If the array is length 1, returns [a, a, a, a, a, a] If the array is length 3, return [a, a, b, b, c, c] If the array is length 6, returns the array.- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 6 that represents the input
-
validate6
public static int[] validate6(int[] data, String paramName)
Reformats the input array to a length 6 array. If the array is length 1, returns [a, a, a, a, a, a] If the array is length 3, return [a, a, b, b, c, c] If the array is length 6, returns the array.- Parameters:
data
- An arrayparamName
- The param name, for error reporting- Returns:
- An int array of length 6 that represents the input
-
-