0

I keep getting this syntax error when it runs the line:

global merged_summary_op = tf.merge_all_summaries()
                         ^
SyntaxError: invalid syntax

Could anyone help me with this problem? Thank you!

AChampion
  • 29,683
  • 4
  • 59
  • 75
Ada Li
  • 1
  • 1
  • 2
  • 1
    You can only have one, a `global` statement or `assignment` statement not both. Split across 2 lines. – AChampion Jul 10 '18 at 02:10
  • @EvandroPaula not sure this is a good dup, as this seems more about the use of `global` rather than the specific syntax error, which is because of mixing multiple statements in one line. – AChampion Jul 10 '18 at 02:14
  • Thank you guys, I am gonna try splitting them now. – Ada Li Jul 10 '18 at 02:45
  • @AChampion I flag it as **possible** duplicate just because the root of question is how the global keyword works in Python. – Evandro de Paula Jul 10 '18 at 02:57

1 Answers1

0

you are trying to assign some value to a Variable name

variable naming will not support white spaces

 global merged_summary_op    
 merged_summary_op = tf.merge_all_summaries()

You must need to follow some rules to do it

  1. declare the variable as a global variable first
  2. Then assign the value to it
abhi krishnan
  • 821
  • 6
  • 20