QIFEIDKN / STAGATE

Adaptive Graph Attention Auto-encoder for Spatial Domain Identification of Spatial Transcriptomics
MIT License
35 stars 18 forks source link

`sparse_placeholder` is not compatible with eager execution. #21

Open Gandalf-1127 opened 1 year ago

Gandalf-1127 commented 1 year ago

hi when i try to run tutor1 by tensorflow in pycharm,this issue raises: "RuntimeError: sparse_placeholder is not compatible with eager execution."

i suspect it may due to the tensorflow version.but i found the code above("import tensorflow.compat.v1 as tf").It seems no problem. so..then..i don't konw what's the matter? can anybody help me?

SiaGuo commented 1 year ago

Hi. I've encountered it as well, ant it seems attribute to the version of tensorflow. I've tried to add "tf.compat.v1.disable_eager_execution()" before "def build_placeholders(self):", and it works now. Hope it helps.

SuyangLumiere commented 2 months ago

Hi. I've encountered it as well, ant it seems attribute to the version of tensorflow. I've tried to add "tf.compat.v1.disable_eager_execution()" before "def build_placeholders(self):", and it works now. Hope it helps.

Thanks for your constructive help! Your solution is indeed effective and has resolved the compatibility issue with the eager execution mode that I encountered while using STAGATE. I added tf.compat.v1.disable_eager_execution(), and now everything is running smoothly.

In fact, the initial problem I encountered was that the X in my anndata was in numpy format, which does not require and cannot call the toarray() method. I used sp.csr_matrix to convert it back to a sparse matrix, and then the aforementioned problem occurred. If anyone encounters a similar error, they can try the steps mentioned above.