標籤:

用tf.placeholder構建features, labels容器

函數

"""函數:創建images placeholders for features and lables arraysn"""nimport tensorflow as tfndef create_placeholders_images(n_H0, n_W0, n_C0, n_y):n """n 創建images placeholders for features and lables arraysnn Arguments:n n_H0 -- int, 圖片高n n_W0 -- int, 圖片寬n n_C0 -- int, channelsn n_y -- int, 類別數量nn Returns:n X -- placeholder of features [None, n_H0, n_W0, n_C0], dtype "float"n Y -- placeholder of labels [None, n_y], dtype "float"n """nn X = tf.placeholder(dtype = "float", shape=[None, n_H0, n_W0, n_C0])n Y = tf.placeholder(dtype = "float", shape=[None, n_y])nnn return X, Yn

測試

import tensorflow as tfnfrom create_placeholder import create_placeholders_imagesnX, Y = create_placeholders_images(64, 64, 3, 6)nXnYn

文檔

import tensorflow as tfnfrom inspect import getsourcelines, getmodulentf.placeholderndir(tf.placeholder) # nothing special insidenhelp(tf.placeholder)ngetsourcelines(tf.placeholder)ngetmodule(tf.placeholder)n

推薦閱讀:

TAG:TensorFlow |