model_lstm_build.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:tensorflow-CWS-LSTM 作者: elvinpoon 项目源码 文件源码
def error(self):
        mistakes = tf.not_equal(
            tf.argmax(self._target, 2), tf.argmax(self.prediction, 2))
        mistakes = tf.cast(mistakes, tf.float32)
        mask = tf.sign(tf.reduce_max(self._target, reduction_indices=2))
        mistakes *= mask
        # Average over actual sequence lengths.
        mistakes = tf.reduce_sum(mistakes, reduction_indices=1)
        mistakes /= tf.cast(self._length, tf.float32)
        return tf.reduce_mean(mistakes)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号