def standardize_X(shape, X):
	if not numpy_array(X):
		X = np.asarray(X)

	if len(shape) == 4 and len(X.shape) == 2:
		return X.reshape(-1, shape[2], shape[3], shape[1]).transpose(0, 3, 1, 2)
	else:
		return X
Esempio n. 2
0
def standardize_X(shape, X):
	if not numpy_array(X):
		X = np.asarray(X)

	if len(shape) == 4 and len(X.shape) == 2:
		return X.reshape(-1, shape[2], shape[3], shape[1]).transpose(0, 3, 1, 2)
	else:
		return X
Esempio n. 3
0
def standardize_Y(shape, Y):
    if not numpy_array(Y):
        Y = np.asarray(Y)
    if len(Y.shape) == 1:
        Y = Y.reshape(-1, 1)
    if len(Y.shape) == 2 and len(shape) == 2:
        if shape[-1] != Y.shape[-1]:
            return one_hot(Y, n=shape[-1])
        else:
            return Y
    else:
        return Y
def standardize_Y(shape, Y):
	if not numpy_array(Y):
		Y = np.asarray(Y)
	if len(Y.shape) == 1:
		Y = Y.reshape(-1, 1)
	if len(Y.shape) == 2 and len(shape) == 2:
		if shape[-1] != Y.shape[-1]:
			return one_hot(Y, n=shape[-1])
		else:
			return Y
	else:
		return Y
Esempio n. 5
0
def ZeroOneScale(X):
    if not numpy_array(X):
        X = np.asarray(X)
    return X / 255.
Esempio n. 6
0
def Standardize(X):
    if not numpy_array(X):
        X = np.asarray(X)
    return X / 127.5 - 1.
Esempio n. 7
0
def ImgToConv(X):
    if not numpy_array(X):
        X = np.asarray(X)
    return X.transpose(0, 3, 1, 2)
Esempio n. 8
0
def FlatToImg(X, w, h, c):
    if not numpy_array(X):
        X = np.asarray(X)
    return X.reshape(-1, w, h, c)
Esempio n. 9
0
def ZeroOneScale(X):
    if not numpy_array(X):
        X = np.asarray(X)
    return X / 255.
Esempio n. 10
0
def Standardize(X):
    if not numpy_array(X):
        X = np.asarray(X)
    return X / 127.5 - 1.
Esempio n. 11
0
def ImgToConv(X):
    if not numpy_array(X):
        X = np.asarray(X)
    return X.transpose(0, 3, 1, 2)
Esempio n. 12
0
def FlatToImg(X, w, h, c):
	if not numpy_array(X):
		X = np.asarray(X)	
	return X.reshape(-1, w, h, c)