public virtual Tensor SoftmaxBackward(Tensor x, Tensor outputgrad) { var s = SoftmaxForward(x).Reshape(-1, 1); var d = K.Diag(s) - K.Dot(s, s.Transpose()); return(outputgrad * K.Sum(d, -1).Reshape(x.Shape)); }