shenweichen / GraphEmbedding

Implementation and experiments of graph embedding algorithms.
MIT License
3.63k stars 990 forks source link

SDNE Examples unable to run #30

Open pmullen-pm opened 4 years ago

pmullen-pm commented 4 years ago

I've tried tensorflow versions 1.15 and >2 and get this error. Were there breaking changes to this repo? If you or anyone else don't get these errors could you share you environment configuration?

(py3SDNE3) mac0632:examples patrick.mullen$ python sdne_wiki.py
WARNING:tensorflow:From /Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
Traceback (most recent call last):
  File "sdne_wiki.py", line 49, in <module>
    model = SDNE(G, hidden_size=[256, 128],)
  File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/ge-0.0.0-py3.7.egg/ge/models/sdne.py", line 93, in __init__
  File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/ge-0.0.0-py3.7.egg/ge/models/sdne.py", line 101, in reset_model
  File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/training/tracking/base.py", line 457, in _method_wrapper
    result = method(self, *args, **kwargs)
  File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 373, in compile
    self._compile_weights_loss_and_weighted_metrics()
  File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/training/tracking/base.py", line 457, in _method_wrapper
    result = method(self, *args, **kwargs)
  File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 1652, in _compile_weights_loss_and_weighted_metrics
    self.total_loss = self._prepare_total_loss(masks)
  File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 1712, in _prepare_total_loss
    per_sample_losses = loss_fn.call(y_true, y_pred)
  File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/keras/losses.py", line 216, in call
    return self.fn(y_true, y_pred, **self._fn_kwargs)
  File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/ge-0.0.0-py3.7.egg/ge/models/sdne.py", line 36, in loss_2nd
  File "<__array_function__ internals>", line 6, in ones_like
  File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/numpy-1.18.2-py3.7-macosx-10.14-x86_64.egg/numpy/core/numeric.py", line 278, in ones_like
    res = empty_like(a, dtype=dtype, order=order, subok=subok, shape=shape)
  File "<__array_function__ internals>", line 6, in empty_like
  File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 736, in __array__
    " array.".format(self.name))
NotImplementedError: Cannot convert a symbolic Tensor (2nd_target:0) to a numpy array.
shenweichen commented 4 years ago

hi please try tf 1.4

Weichen Shen

wcshen1994@163.com |

Signature is customized by Netease Mail Master

On 04/01/2020 05:26, Patrick Mullen wrote:

I've tried tensorflow versions 1.15 and >2 and get this error. Were there breaking changes to this repo? If you or anyone else don't get these errors could you share you environment configuration?

(py3SDNE3) mac0632:examples patrick.mullen$ python sdne_wiki.py WARNING:tensorflow:From /Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.init (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version. Instructions for updating: If using Keras pass _constraint arguments to layers. Traceback (most recent call last): File "sdne_wiki.py", line 49, in model = SDNE(G, hidden_size=[256, 128],) File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/ge-0.0.0-py3.7.egg/ge/models/sdne.py", line 93, in init File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/ge-0.0.0-py3.7.egg/ge/models/sdne.py", line 101, in reset_model File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/training/tracking/base.py", line 457, in _method_wrapper result = method(self, args, *kwargs) File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 373, in compile self._compile_weights_loss_and_weighted_metrics() File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/training/tracking/base.py", line 457, in _method_wrapper result = method(self, args, kwargs) File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 1652, in _compile_weights_loss_and_weighted_metrics self.total_loss = self._prepare_total_loss(masks) File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 1712, in _prepare_total_loss per_sample_losses = loss_fn.call(y_true, y_pred) File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/keras/losses.py", line 216, in call return self.fn(y_true, y_pred, self._fn_kwargs) File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/ge-0.0.0-py3.7.egg/ge/models/sdne.py", line 36, in loss_2nd File "<__array_function__ internals>", line 6, in ones_like File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/numpy-1.18.2-py3.7-macosx-10.14-x86_64.egg/numpy/core/numeric.py", line 278, in ones_like res = empty_like(a, dtype=dtype, order=order, subok=subok, shape=shape) File "<__array_function__ internals>", line 6, in empty_like File "/Users/patrick.mullen/aws/py3SDNE3/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 736, in array " array.".format(self.name)) NotImplementedError: Cannot convert a symbolic Tensor (2nd_target:0) to a numpy array.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

pmullen-pm commented 4 years ago

Thank you for your quick response, that does work for me.

hxtruong6 commented 4 years ago

I have the same issue with you. How can I update code to adapt with tensorflow 2.x?

scott-5 commented 1 year ago

There is no version 1.4 of tf.