shenweichen / GraphEmbedding

Implementation and experiments of graph embedding algorithms.
MIT License
3.74k stars 1k forks source link

【Question】NotImplementedError: run SDNE in Python3.8, tf2.11.0 #78

Open YannAdams opened 1 year ago

YannAdams commented 1 year ago

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 tftrainfunction 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 tfloss2nd 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.   
sufefffyz commented 1 year ago

Do you solve the problem?I meet the same error