Python中的常见错误
一、
SyntaxError: Non-ASCII character ‘\xe5’ in file /home/wby/PycharmProjects/TensorflowStudy/test01.py
**解决方案:**在代码第一行加上# coding=UTF-8
# coding=UTF-8
二、
IndentationError: expected an indented block
**解决方案:**使用Tab建进行缩进
三、
TypeError: init() got an unexpected keyword argument ‘shape’
出现该问题的原因(这里使用的写法是旧版tensorflow的写法):
v = tf.get_variable("v",initializer=tf.zeros_initializer(shape=[1]))
解决方案:
v = tf.get_variable("v",initializer=tf.zeros_initializer()(shape=[1]))