You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
【Question】NotImplementedError: run SDNE in Python3.8, tf2.11.0 #78
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Traceback (most recent call last):
File "d:/pyproject/graph_projects/GraphEmbedding/examples/sdne_wiki.py", line 50, in
model.train(batch_size=1024, epochs=40, verbose=2)
File "D:\anaconda3\envs\emb38\lib\site-packages\ge-0.0.0-py3.8.egg\ge\models\sdne.py", line 126, in train
File "D:\anaconda3\envs\emb38\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1846, in train_on_batch
logs = self.train_function(iterator)
File "D:\anaconda3\envs\emb38\lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\57438\AppData\Local\Temp_autograph_generated_file88ea3gk0.py", line 15, in tf__train_function
retval = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)
File "C:\Users\57438\AppData\Local\Temp_autograph_generated_file3jc4tox5.py", line 11, in tf__loss_2nd
b = ag__.converted_call(ag__.ld(np).ones_like, (ag__.ld(y_true),), None, fscope)
File "<array_function internals>", line 200, in ones_like
File "D:\anaconda3\envs\emb38\lib\site-packages\numpy\core\numeric.py", line 281, in ones_like
res = empty_like(a, dtype=dtype, order=order, subok=subok, shape=shape)
File "<array_function internals>", line 200, in empty_like
NotImplementedError: in user code:
File "D:\anaconda3\envs\emb38\lib\site-packages\ge-0.0.0-py3.8.egg\ge\models\sdne.py", line 36, in loss_2nd *
b_ = np.ones_like(y_true)
File "<__array_function__ internals>", line 200, in ones_like **
File "D:\anaconda3\envs\emb38\lib\site-packages\numpy\core\numeric.py", line 281, in ones_like
res = empty_like(a, dtype=dtype, order=order, subok=subok, shape=shape)
File "<__array_function__ internals>", line 200, in empty_like
NotImplementedError: Cannot convert a symbolic tf.Tensor (IteratorGetNext:2) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported.
SDNE now avoids NumPy operations on symbolic tensors in its losses, uses public tensorflow.keras APIs, and is covered by the updated Python/TensorFlow CI matrix. Closing this as resolved.
Activity
sufefffyz commentedon Feb 28, 2023
Do you solve the problem?I meet the same error
shenweichen commentedon Apr 18, 2026
Fixed by #83.
SDNE now avoids NumPy operations on symbolic tensors in its losses, uses public
tensorflow.kerasAPIs, and is covered by the updated Python/TensorFlow CI matrix. Closing this as resolved.