def yaml(self):
        return yaml.dump(self.serialized, default_flow_style=False,
                         encoding=None)
def update_state(self, y_true, y_pred, sample_weight=None):
    sample_weight = _apply_mask(y_true, sample_weight, self._masked_tokens,
                                self._dtype)
    sample_weight = tf.reshape(sample_weight, [-1])
    super().update_state(sample_weight)