In the Softmax2D layer below, the forward pass does not change the output shape, but get_output_shape_for does. It gave me an error using Tensorflow backend. I had to change get_output_shape_for to an identity function (just returning input_shape with no change)
def call(self, x,mask=None):
e = K.exp(x - K.max(x, axis=self.axis, keepdims=True))
s = K.sum(e, axis=self.axis, keepdims=True)
return e / s
def get_output_shape_for(self, input_shape):
axis_index = self.axis % len(input_shape)
return tuple([input_shape[i] for i in range(len(input_shape)) \
if i != axis_index ])
In the Softmax2D layer below, the forward pass does not change the output shape, but get_output_shape_for does. It gave me an error using Tensorflow backend. I had to change get_output_shape_for to an identity function (just returning input_shape with no change)