Loading

keras 使用经验

  1. tensorflow.keras与keras:TypeError: objectof type 'xxx' has no len()
  2. Module 'gast' has no attribute 'Num'
  3. K.batch_dot 的版本变化
  4. TypeError: 'range' object does not support item assignment
random_order = list(range(len(total_data)))  # range 返回的结果需要用list
np.random.shuffle(random_order)
  1. TypeError: Using a tf.Tensor as a Python bool is not allowed.: v_in_dim = input_shape[2][-1].value 不加value,是一个 <class 'tensorflow.python.framework.tensor_shape.Dimension'> 类型的变量,需要加.value
import tensorflow as tf
from keras import backend as K
K.arange(K.shape(K.constant([1]))[0])

keras.backend.arange does not allow tensor start,要么使用keras,要么使用tf.range

  1. [UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above. [Op:Conv2D]]
# 加入下面这两行!
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '/gpu:0'
posted @ 2021-01-31 18:34  戴墨镜的长颈鹿  阅读(69)  评论(0编辑  收藏  举报