'Tensor' object has no attribute 'lower'

前端 未结 1 1264
名媛妹妹
名媛妹妹 2020-12-11 01:04

I am fine-tuning a MobileNet with 14 new classes. When I add new layers by:

x=mobile.layers[-6].output
x=Flatten(x)
predictions = Dense(14, activation=\'soft         


        
相关标签:
1条回答
  • 2020-12-11 01:49

    The tensor must be passed to the layer when you are calling it, and not as an argument. Therefore it must be like this:

    x = Flatten()(x)  # first the layer is constructed and then it is called on x
    

    To make it more clear, it is equivalent to this:

    flatten_layer = Flatten()  # instantiate the layer
    x = flatten_layer(x)       # call it on the given tensor
    
    0 讨论(0)
提交回复
热议问题