tensorflow 转化问题(吴恩达Convolution+Model+Application)

 F = tf.keras.layers.Flatten(P2)
    # FULLY-CONNECTED without non-linear activation function (not not call softmax).
    # 6 neurons in output layer. Hint: one of the arguments should be "activation_fn=None" 
 Z3 = tf.keras.layers.Dense(F, 6)
AttributeError                            Traceback (most recent call last)
<ipython-input-40-e87412e02b7e> in <module>
      7     X, Y = create_placeholders(64, 64, 3, 6)
      8     parameters = initialize_parameters()
----> 9     Z3 = forward_propagation(X, parameters)
     10     init = tf.global_variables_initializer()
     11     sess.run(init)

<ipython-input-39-995cc2f546d5> in forward_propagation(X, parameters)
     34     P2 = tf.nn.max_pool(A2, ksize=(1, 4, 4, 1), strides=(1, 4, 4, 1), padding='SAME')
     35     # FLATTEN
---> 36     F = tf.keras.layers.Flatten(P2)
     37     # FULLY-CONNECTED without non-linear activation function (not not call softmax).
     38     # 6 neurons in output layer. Hint: one of the arguments should be "activation_fn=None"

~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\layers\core.py in __init__(self, data_format, **kwargs)
    654   def __init__(self, data_format=None, **kwargs):
    655     super(Flatten, self).__init__(**kwargs)
--> 656     self.data_format = conv_utils.normalize_data_format(data_format)
    657     self.input_spec = InputSpec(min_ndim=1)
    658     self._channels_first = self.data_format == 'channels_first'

~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\utils\conv_utils.py in normalize_data_format(value)
    190   if value is None:
    191     value = backend.image_data_format()
--> 192   data_format = value.lower()
    193   if data_format not in {'channels_first', 'channels_last'}:
    194     raise ValueError('The `data_format` argument must be one of '

AttributeError: 'Tensor' object has no attribute 'lower'

  • List item
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值