5

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.

5 Answers 5

3

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

Sign up to request clarification or add additional context in comments.

Comments

1

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

1 Comment

Yes that is the step i mentioned in my question, i have read and reread the syntax of the command and how to use it but i still receive the error stated above, "Cant assign to operator", operator is a term used in tensorflow that refers to the individual nodes used in the neural net, that is why i think it is something deeper than the syntax and execution of said command.
0

You need to run tensorboard --logdir=name_of_the_folder in the terminal!

Please refer to this issue: link

Comments

0

Try something like this:

tensorboard --logdir= name_of_the_folder\

Comments

0

In Colab

load_ext tensorboard
tensorboard --logdir='/tmp/tflearn_logs'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.