google-deepmind / graph_nets

Build Graph Nets in Tensorflow
https://arxiv.org/abs/1806.01261
Apache License 2.0
5.34k stars 783 forks source link

The data structure of the output of the EncodeProcessDecode model #127

Closed yangyugit closed 3 years ago

yangyugit commented 3 years ago

When I finish the training of EncodeProcessDecode model, I cannot feed the model using the model's output. That I want to predict the next output.

model = models.EncodeProcessDecode(node_output_size=2) ---- model

for iteration in range(last_iteration, num_training_iterations): ----- training last_iteration = iteration train_values = sess.run({ "step": step_op, "loss": loss_op_tr, "input_graph": input_graph_tr, "target_graph_tr": target_graph_tr, "outputs": output_ops_tr})

the_time = time.time() elapsed_time = the_time - last_log_time last_log_time = the_time

losses_tr.append(train_values["loss"]) outputs_tr.append(train_values['outputs'])

print("# {:05d}, T {:.1f}, Ltr {:.4f}".format(iteration, elapsed_time, train_values['loss']))

================THE ERROR================================== input_graph = outputs_tr[-1] predict_graph = model(input_graph,num_processing_steps_tr) ------- do some predicted --------comes out the error: AttributeError: 'list' object has no attribute 'nodes' I think maybe the structure of the output of the model(EncodeProcessDecode) is not right. So the output of sess.run of the model, can not be the input of the trained model.

How can I fix that? Thank you!

yangyugit commented 3 years ago

Well, after having a sleep, I solved it by adding input_graph = student_data[-2:-1] input_graph = utils_tf.data_dicts_to_graphs_tuple(input_graph) predict_graph = model(input_graph,num_processing_steps_tr) predict_graph = sess.run(input_graph) Then the structure of predict_graph is as same as the input_graph...

I am a NOOB of tensorflow and GraphNet(or Interaction Network).... So thanks a lot.... I will still work hard to get more skills and knowledge about DeepLearning.