Closed ameya98 closed 4 years ago
Hi, you need to make sure your GraphsTuple contains tensors and not numpy arrays (which is what the utils_np method returns inside the GraphsTuple).
You could instead convert each networkx graph to a data dict using utils_np.networkx_to_data_dict
, and then into GraphsTuple via utils_tf.data_dicts_to_graphs_tuple
.
Of directly convert everything inside of the numpy GraphsTuple into a tensor using:
graphs_tuple = tree.map_structure(lambda x: tf.constant(x) if x is not None else None, graphs_tuple_np)
Hope this helps!
I can confirm this works! Thanks a lot!
graphs_tuple = utils_tf.data_dicts_to_graphs_tuple([utils_np.networkx_to_data_dict(graph) for graph in graphs_nx])
Here, I create NetworkX graphs, and convert them to GraphsTuple.
Now, I define the model:
But, if I call:
I get the following error:
Seems like the
graph.nodes
attribute is a tuple when it should be a tf.Tensor. This is TensorFlow 2, btw. Any help?