在使用 cudnnlstm 时,不能使用上层传下来的 Mask,那么可以使用重新定义一个类,去除 Mask
class RemoveMask(keras.layers.Layer):
def __init__(self, return_masked=False, no_mask=False, **kwargs):
super(RemoveMask, self).__init__(**kwargs)
self.supports_masking = True
self.no_mask = no_mask
def compute_mask(self, inputs, mask=None):
return None