sequence_loss是nlp算法中非常重要的一个函数.rnn,lstm,attention都要用到这个函数.看下面代码: # coding: utf-8 import numpy as np import tensorflow as tf from tensorflow.contrib.seq2seq import sequence_loss logits_np = np.array([ [[0.5, 0.5, 0.5, 0.5], [0.5, 0.5, 0.5, 0.5], [0.5,…