keras 使用经验
- tensorflow.keras与keras:TypeError: objectof type 'xxx' has no len()
- Module 'gast' has no attribute 'Num'
- K.batch_dot 的版本变化
TypeError: 'range' object does not support item assignment
random_order = list(range(len(total_data))) # range 返回的结果需要用list
np.random.shuffle(random_order)
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
- [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'