objectives.py 文件源码

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

项目:NumpyDL 作者: oujago 项目源码 文件源码
def backward(self, outputs, targets):
        """SoftmaxCategoricalCrossEntropy backward propagation.

        .. math::  dE = p - t

        Parameters
        ----------
        outputs : numpy 2D array
            Predictions in (0, 1), such as softmax output of a neural network,
            with data points in rows and class probabilities in columns.
        targets : numpy 2D array 
            Either targets in [0, 1] matching the layout of `outputs`, or
            a vector of int giving the correct class index per data point.

        Returns
        -------
        numpy 1D array
        """
        outputs = np.clip(outputs, self.epsilon, 1 - self.epsilon)
        return outputs - targets
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号