【学习笔记】Week1_Programming Assignments_Convolutional Model: application

1、Tensorflow 需要为输入数据创建 Placeholders(占位符),这些数据将会在运行 Session(会话)时被 fed(喂)到 Model(模型)中

2、Tensorflow:tf.placeholder

    创建占位符,例

# GRADED FUNCTION: create_placeholders

def create_placeholders(n_H0, n_W0, n_C0, n_y):
    """
    Creates the placeholders for the tensorflow session.
    
    Arguments:
    n_H0 -- scalar, height of an input image
    n_W0 -- scalar, width of an input image
    n_C0 -- scalar, number of channels of the input
    n_y -- scalar, number of classes
        
    Returns:
    X -- placeholder for the data input, of shape [None, n_H0, n_W0, n_C0] and dtype "float"
    Y -- placeholder for the input labels, of shape [None, n_y] and dtype "float"
    """

    ### START CODE HERE ### (≈2 lines)
    X = tf.placeholder(tf.float32, shape = [None, n_H0, n_W0, n_C0], name = 'X')
    Y = tf.placeholder(tf.float32, shape = [None, n_y], name = 'Y')
    ### END CODE HERE ###
    
    return X, Y

猜你喜欢

转载自blog.csdn.net/megazhan/article/details/80190462