Repository navigation
SDNE Examples unable to run #30
Copy link
Copy link
Closed
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
shenweichen commentedon Apr 1, 2020
pmullen-pm commentedon Apr 1, 2020
Thank you for your quick response, that does work for me.
hxtruong6 commentedon May 12, 2020
I have the same issue with you.
How can I update code to adapt with
tensorflow 2.x?scott-5 commentedon Jul 30, 2022
There is no version 1.4 of tf.
shenweichen commentedon Apr 18, 2026
Fixed by #83.
sdne_wiki.pyis now importable and testable in smoke mode, and SDNE now avoids symbolic Tensor/NumPy incompatibilities by using TensorFlow-native loss operations with publictensorflow.kerasAPIs. Closing this as resolved.