私はTensorFlowを使って素早く神経網を作る方法について、このtutorialを読んでいます。変数はtf.trainable_variablesにどのように追加されますか?
しかし、その仕組みについてもっと理解したかったのです。それらのどれも以来、私はAdamOptimizerを変更するmatricies知っている方法を把握したい
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=prediction, labels=y))
optimizer = tf.train.AdamOptimizer().minimize(cost)
を実行し、最終的に、その後
def neural_network_model(data):
hidden_1_layer = {'weights':tf.Variable(tf.random_normal([n_nodes_hl0, n_nodes_hl1])),
'biases':tf.Variable(tf.random_normal([n_nodes_hl1]))}
hidden_2_layer = {'weights':tf.Variable(tf.random_normal([n_nodes_hl1, n_nodes_hl2])),
'biases':tf.Variable(tf.random_normal([n_nodes_hl2]))}
hidden_3_layer = {'weights':tf.Variable(tf.random_normal([n_nodes_hl2, n_nodes_hl3])),
'biases':tf.Variable(tf.random_normal([n_nodes_hl3]))}
output_layer = {'weights':tf.Variable(tf.random_normal([n_nodes_hl3, n_classes])),
'biases':tf.Variable(tf.random_normal([n_classes]))}
l1 = tf.add(tf.matmul(data,hidden_1_layer['weights']), hidden_1_layer['biases'])
l1 = tf.nn.relu(l1)
l2 = tf.add(tf.matmul(l1,hidden_2_layer['weights']), hidden_2_layer['biases'])
l2 = tf.nn.relu(l2)
l3 = tf.add(tf.matmul(l2,hidden_3_layer['weights']), hidden_3_layer['biases'])
l3 = tf.nn.relu(l3)
output = tf.matmul(l3,output_layer['weights']) + output_layer['biases']
return output
と:コードで
、我々はとニューラルネットを定義します最小化関数に渡されます。
だから、私はAdamOptimizerを見上げるとminimize
は、オプションのパラメータを持っていることが判明:
var_list: Optional list or tuple of Variable objects to update to minimize loss. Defaults to the list of variables collected in the graph under the key GraphKeys.TRAINABLE_VARIABLES.
だから私は、その後GraphKeys.TRAINABLE_VARIABLESを見上げるとが見つかりました:
When passed trainable=True, the Variable() constructor automatically adds new variables to the graph collection GraphKeys.TRAINABLE_VARIABLES. This convenience function returns the contents of that collection.
は、だから私は、その後の検索をしました私のコードでtrainable
という言葉は何も見つかりませんでした。
AdamOptimizerは、どのように最適化するために変更する必要があるのか、世界でどのようになっていますか?