错误提示softmax() got an unexpected keyword argument ‘axis‘
在使用keras是出现softmax() got an unexpected keyword argument ‘axis’
出现这种情况,有几种解决办法,可以调低一下keras的版本
pip install keras==2.1//调至2.2一下
还有更方便的办法就是在tensorflow_backend.py文件中修改此方法里面的参数
在第3221行中
def softmax(x, axis=-1): """Softmax of a tensor. # Arguments x: A tensor or variable. axis: The dimension softmax would be performed on. The default is -1 which indicates the last dimension. # Returns A tensor. """ return tf.nn.softmax(x, axis=axis)
修改后
def softmax(x, axis=-1): """Softmax of a tensor. # Arguments x: A tensor or variable. axis: The dimension softmax would be performed on. The default is -1 which indicates the last dimension. # Returns A tensor. """ return tf.nn.softmax(x, dim=axis)