Tensorflow 错误记录

Tensorflow 代码出错问题记录

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

猜你喜欢

转载自blog.csdn.net/Jingnian_destiny/article/details/83857027