Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TensorBoard --logdir="path/to/log" (cannot assign to operator)

I wrote my first tensorflow code and i am trying to visualize it with tensorboard but i am hitting a wall that alot of other people seem to be hitting: (Syntaxerror: Cannot assign to operator)

when trying to run: (tensorboard --logdir=path/to/logs/directory)

and i cant find any post on any site that works out the issue. For clarification these are examples of the threads i have looked at and i believe they cover the things i have tried so far, but i found many threads that were simply empty.

tensorboard shows a SyntaxError: can't assign to operator

Creating log directory in tensorboard

Tensorboard SyntaxError: invalid syntax

https://github.com/tensorflow/tensorflow/issues/3688

To start from the beginning, I ran into this error (Syntaxerror: Cannot assign to operator) and thought i made a typo so i confirmed that i was using the correct code, then i began a search to find an answer and found alot of responses that gave things to try so i considered/tried them, including: Moving where the log files are stored, moving where the code used to create the logs inside of the original tensorflow python file is located, restarting the pc (idk?) but it didnt work, right clicking and using the open with command on the log file and specifying that it should be run in terminal with "x" commands, so on and so forth, it seems that most answers are touching on basic things, having tensorflow set up correctly or using commands correctly, but i think this is a deeper issue due to the overwhelming lack of suggestions and the fact that of all the videos i have watched on using tensorboard, tensorflow/tensorboard while trying to fix this, no video even hints that this step is one that can lead to error, implying that it is not a simple/common error. Any help, suggestions, or even suggestions on where i can look for suggestions would definitely be appreciated.

Edit: Im still at this, i found an example file for tensorflow that is designed to be run so that you can see tensorboard without writing any code and it gives exact code to type into terminal, it still gives me the same error though i did notice one thing, this is the code"tensorboard --logdir=/tmp/tensorflow/mnist" but if i run that i get a syntax error because of the first forward slash, if i remove it i get the original "Cant assign to operator" error.

like image 613
Desync013 Avatar asked Aug 25 '17 04:08

Desync013


2 Answers

You are either running the command from an interactive python shell or from ipython/jupyter-notebook.

If you are running it from ipython/jupyter-notebook, you can insert ! at the beginning of the command to run a native system command.

Thus in this case you can run:

!tensorboard --logdir=name_of_the_folder

Alternatively, you have to run this command from the terminal as :

tensorboard --logdir=name_of_the_folder

like image 186
Tshilidzi Mudau Avatar answered Nov 07 '22 07:11

Tshilidzi Mudau


Do you have a folder where the file "events.out.tfevents.1500944459.ADMIN-PC" something like this was created using tf.summary.FileWriter? If yes, from the top directory of that folder, you open cmd (no python idle, command prompt) write

tensorboard --logdir=name_of_the_folder
like image 1
Pablo Gonzalez Avatar answered Nov 07 '22 06:11

Pablo Gonzalez