Tensorflow 代码出错问题记录
- TypeError: unsupported operand type(s) for *: ‘int’ and ‘Dimension’
修改:将出现错误地方的使用了整数的地方添加int();
原因:使用了Tensor的shape直接取使用,这是不可以的,应当改为int(x.shape[1])这样。 - TypeError: Value passed to parameter ‘input’ has DataType float64 not in list of allowed values: float16, float32
修改:使用tf.cast(x, dtype=tf.float32) 将数据类型统一。 - 如果出现OOM的错误警告:一种情况是:GPU正在运行别的程序;另外一种情况是:训练的参数过大,或者batchsize过大导致的。