tkipf / gcn

Implementation of Graph Convolutional Networks in TensorFlow
MIT License
7.14k stars 2k forks source link

placeholder for featrues #50

Open LeiBAI opened 6 years ago

LeiBAI commented 6 years ago

Hi, Thanks for your work. I noticed that placeholder for features is : tf.sparse_placeholder(tf.float32, shape=tf.constant(features[2], dtype=tf.int64) I can't understand why the shape is tf.constant(features[2] and when I assign this placeholder to a variable like: var = tf.sparse_placeholder(tf.float32, shape=tf.constant(features[2], dtype=tf.int64)) This sentence will raise a typeError, can you give some information about this problem?

Thanks Lei

tkipf commented 6 years ago

Not sure if I understand the problem. Can you give a minimal reproducible example? On Thu 23. Aug 2018 at 05:08 LeiBAI notifications@github.com wrote:

Hi, Thanks for your work. I noticed that placeholder for features is : tf.sparse_placeholder(tf.float32, shape=tf.constant(features[2], dtype=tf.int64) I can't understand why the shape is tf.constant(features[2] and when I assign this placeholder to a variable like: var = tf.sparse_placeholder(tf.float32, shape=tf.constant(features[2], dtype=tf.int64)) This sentence will raise a typeError, can you give some information about this problem?

Thanks Lei

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tkipf/gcn/issues/50, or mute the thread https://github.com/notifications/unsubscribe-auth/AHAcYPO4ku7E799PX_qOQr1e7d-zoSomks5uTiqigaJpZM4WIz2k .

guotong1988 commented 6 years ago

I guess you have not understand the sparse tensor.

hithisisdhara commented 6 years ago

issue with features in placeholders

To understand your code, I am running train.py line by line in an ipython notebook. When I declare placeholders = {---- 'features': tf.sparse_placeholder(tf.float32, shape=tf.constant(features[2], dtype=tf.int64)),

} , the line above throws an error: TypeError: Expected float32, got <1x1433 sparse matrix of type '<type 'numpy.float32'>' with 19 stored elements in LInked List format> of type 'lil_matrix' instead. I don't know how to fix this error. I am not sure if this is an ipython issue, since if I run the train.py through the console, it runs without error. Your help would be appreciated. Thank you, Dhara

tkipf commented 6 years ago

Have you tried an older TensorFlow version (e.g. 0.12)? It is possible that the API changed since this code was published.

hithisisdhara commented 6 years ago

Thank you for the reply. It was an issue with ipython, I was using the conda virtual environment where I installed all the necessary packages through conda. There is a bug in this method. I solved it by installing everything locally and not using any virtual environment. It also works by using virtualenv instead, and initializing ipython kernel within this environment. Thanks again, and thanks for your amazing research, it is very inspiring!