Le modèle suivant:Adagrad les variables implicites
import tensorflow as tf
import numpy as np
BATCH_SIZE = 3
VECTOR_SIZE = 1
LEARNING_RATE = 0.1
x = tf.placeholder(tf.float32, [BATCH_SIZE, VECTOR_SIZE],
name='input_placeholder')
y = tf.placeholder(tf.float32, [BATCH_SIZE, VECTOR_SIZE],
name='labels_placeholder')
W = tf.get_variable('W', [VECTOR_SIZE, BATCH_SIZE])
b = tf.get_variable('b', [VECTOR_SIZE], initializer=tf.constant_initializer(0.0))
y_hat = tf.matmul(W, x) + b
predict = tf.add(tf.matmul(W, x), b, name='predict')
total_loss = tf.reduce_mean(y-y_hat, name='total_loss')
train_step = tf.train.AdagradOptimizer(LEARNING_RATE).minimize(total_loss)
X = np.ones([BATCH_SIZE, VECTOR_SIZE])
Y = np.ones([BATCH_SIZE, VECTOR_SIZE])
all_saver = tf.train.Saver()
A la liste suivante des variables:
for el in tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES):
print(el)
<tf.Variable 'W:0' shape=(1, 3) dtype=float32_ref>
<tf.Variable 'b:0' shape=(1,) dtype=float32_ref>
<tf.Variable 'W/Adagrad:0' shape=(1, 3) dtype=float32_ref>
<tf.Variable 'b/Adagrad:0' shape=(1,) dtype=float32_ref>
tenseurs W:0
et b:0
sont évidents, mais où W/Adagrad:0
et b/Adagrad:0
viennent ne sont pas complètement clair. Je ne les vois pas non plus sur tensorboard:
Merci pour l'explication. Je comprends pourquoi Tensorflow a besoin de stocker «W» et «b», mais quel est le point de stockage de Hessian? – user1700890
J'étais générique dans cette réponse. Adagrad est un algorithme d'optimisation assez simple. Je modifie la réponse et essaie de t'expliquer –