keras-team / keras-contrib

Keras community contributions
MIT License
1.59k stars 653 forks source link

bug in CRF method 'add_boundary_energy'? #539

Open vandeb69 opened 4 years ago

vandeb69 commented 4 years ago

Dear, In the CRF class method add_boundary_energy, shouldn't https://github.com/keras-team/keras-contrib/blob/3fc5ef709e061416f4bc8a92ca3750c824b5d2b0/keras_contrib/layers/crf.py#L403 be replaced with: end_mask = K.cast(K.greater(mask, self.shift_left(mask)), K.floatx()) ?

If mask is [[0., 1., 1., 1., 1., 0.]], end_mask would be [[1., 0., 0., 0., 0., 0.]] in stead of the intended [[0., 0., 0., 0., 1., 0.]]

FanYaning commented 3 years ago

https://github.com/tensorflow/addons/blob/master/tensorflow_addons/layers/crf.py#L184