How can we use a layer from tf.contrib.layers
in keras ?
I tried to mix the tf layer inside my other keras layers.
input = Input(shape=state_shape)
conv = Conv2D(64, (6, 6), strides=(1, 1), activation='relu')(input)
spatial_softmax = tf.contrib.layers.spatial_softmax(conv, name='spatial_softmax', data_format='NHWC')
fc = Dense(128, activation='relu')(spatial_softmax)
fc = Dense(128, activation='relu')(fc)
output = Dense(action_size, activation='softmax')(fc)
Model(inputs=input, outputs=output)
But when I run the code I get the following error
AttributeError: 'Tensor' object has no attribute '_keras_history'
Any idea?
Thanks!
Edit: It's not the same question as here, I am asking for a layer with trainable weights and not a deterministic layer. Do the gradients will backprop to the layer ?