我正在研究F.Chollet撰写的《用Python深度学习》一书。 https://www.manning.com/books/deep-learning-with-python
我正在尝试遵循代码示例。我刚刚安装了keras,尝试运行此错误消息: 从此笔记本中: https://github.com/fchollet/deep-learning-with-python-notebooks/blob/master/2.1-a-first-look-at-a-neural-network.ipynb
from keras import models
from keras import layers
network = models.Sequential()
network.add(layers.Dense(512, activation='relu', input_shape=(28 * 28,)))
network.add(layers.Dense(10, activation='softmax'))
TypeError跟踪(最近的呼叫 最后)在() 4个网络= models.Sequential() 5 network.add(layers.Dense(512,activation ='relu',input_shape =(28 * 28,))) ----> 6 network.add(layers.Dense(10,activation ='softmax'))
〜/ anaconda3 / lib / python3.6 / site-packages / keras / engine / sequential.py在 添加(自己,图层) 179 self.inputs = network.get_source_inputs(self.outputs [0]) 180 elif self。输出: -> 181 output_tensor = layer(self.outputs [0]) 182如果isinstance(output_tensor,list): 183提高TypeError('顺序模型中的所有图层'
〜/ anaconda3 / lib / python3.6 / site-packages / keras / engine / base_layer.py在 通话(自己,输入内容,**) 455#实际调用该图层, 456#收集输出,蒙版和形状。 -> 457输出= self.call(输入,** kwargs) 第458章 459
〜/ anaconda3 / lib / python3.6 / site-packages / keras / layers / core.py在 通话(自己,输入) 881输出= K.bias_add(输出,self.bias,data_format ='channels_last') 882如果self.activation不是None: -> 883输出= self.activation(输出) 884返回输出 885
〜/ anaconda3 / lib / python3.6 / site-packages / keras / activations.py在 softmax(x,轴) 29提高ValueError('无法将softmax应用于张量为1D') 30 elif ndim == 2: -> 31返回K.softmax(x) 32 elif ndim> 2: 33 e = K.exp(x-K.max(x,axis = axis,keepdims = True))
〜/ anaconda3 / lib / python3.6 / site-packages / keras / backend / tensorflow_backend.py in softmax(x,axis)3229张量3230“”“ -> 3231返回tf.nn.softmax(x,axis = axis)3232 3233
TypeError:softmax()得到了意外的关键字参数'axis'
我想知道我的安装是否有问题?
keras.__version__
2.2.4
如果有人可以给我提供有关研究内容的线索。