J'essaie de lancer un Tensorflow Distributed et d'obtenir l'erreur suivante. Mon code ressemble à ceci:Tensorflow - Le graphique est finalisé et ne peut pas être modifié
sv = tf.train.Supervisor(is_chief=(task_index == 0), logdir="/tmp/train_logs", init_op=init_op,
summary_op=summary_op, saver=saver, global_step=global_step, save_model_secs=600)
with sv.managed_session(server.target) as sess:
step = 0
while not sv.should_stop() and step < nnc.steps:
mini_batches = random_mini_batches(x_train, y_train, mini_batch_size)
for mini_batch in mini_batches:
(batch_x, batch_y) = mini_batch
_, step = sess.run([train_op, global_step], feed_dict={x: batch_x, y: batch_y})
Quand je reçois l'erreur, il a échoué sur la fonction random_mini_batches
. Mais je ne comprends absolument pas comment et pourquoi. random_mini_batches
fonction est une fonction écrite en pure python + numpy sans rien en rapport avec TensorFlow. x_train
et y_train
n'étaient pas utilisés auparavant.
Voici l'erreur que je reçois:
File "/Users/curr_user/PycharmProjects/curr_project/src/nn.py", line 36, in random_mini_batches
num_complete_minibatches = int(math.floor(m/mini_batch_size)) # number of mini batches of size mini_batch_size
File "/Users/curr_user/tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/math_ops.py", line 880, in r_binary_op_wrapper
x = ops.convert_to_tensor(x, dtype=y.dtype.base_dtype, name="x")
File "/Users/curr_user/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 611, in convert_to_tensor
as_ref=False)
File "/Users/curr_user/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 676, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/Users/curr_user/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 121, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/Users/curr_user/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 106, in constant
attrs={"value": tensor_value, "dtype": dtype_value}, name=name).outputs[0]
File "/Users/curr_user/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2582, in create_op
self._check_not_finalized()
File "/Users/curr_user/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2290, in _check_not_finalized
raise RuntimeError("Graph is finalized and cannot be modified.")
Toute aide serait très appréciée! Merci
Merci, vous semblez avoir raison. – user3489820