Changing to the cross_entropy_with_max

This commit is contained in:
Aayush Garg 2016-04-28 02:49:24 -07:00
Родитель 3e755ed3f2
Коммит e991b8fee1
2 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -12,7 +12,7 @@ is computed as follows: for each element in the output tensor, its gradient with
given input tensor is computed, then, the resulting tensors are added up.
"""
def crossentropy_with_softmax(target_values, feature_values, name=None):
def cross_entropy_with_softmax(target_values, feature_values, name=None):
"""
This operator computes the cross entropy over the softmax of the `feature_values`.
This op expects the `feature_values` as unscaled, it computes softmax over
@ -20,10 +20,10 @@ def crossentropy_with_softmax(target_values, feature_values, name=None):
already computed before passing to this operator will be incorrect.
Example:
>>> crossentropy_with_softmax([0., 0., 0., 1.], [1., 1., 1., 1.])
>>> cross_entropy_with_softmax([0., 0., 0., 1.], [1., 1., 1., 1.])
#[1.3862]
>>> crossentropy_with_softmax([0.35, 0.15, 0.05, 0.45], [1, 2., 3., 4.])
>>> cross_entropy_with_softmax([0.35, 0.15, 0.05, 0.45], [1, 2., 3., 4.])
#[1.840]
Args:

Просмотреть файл

@ -14,7 +14,7 @@ import pytest
from .ops_test_utils import unittest_helper, C, AA, I, precision, PRECISION_TO_TYPE
from ...graph import *
from ...reader import *
from ..evaluation import crossentropy_with_softmax
from ..evaluation import cross_entropy_with_softmax
TARGET_OUT_PAIRS = [
([[0., 0., 0., 1]], [[1., 2., 3., 4.]]),
@ -39,7 +39,7 @@ def test_op_crossentropywithsoftmax(target_values, feature_values, device_id, pr
input_target = I([target_values], has_dynamic_axis=True)
input_features = I([feature_values], has_dynamic_axis=True)
op_node = crossentropy_with_softmax(input_target, input_features)
op_node = cross_entropy_with_softmax(input_target, input_features)
#Forward pass test
#==================