def test_cross_entropy_binary_limits(backend_default):
    outputs = np.array([0.5, 1.0, 0.0, 0.0001]).reshape((4, 1))
    targets = np.array(([0.5, 0.0, 1.0, 0.2])).reshape((4, 1))
    eps = np.exp(-50)
    expected_log = np.log(np.maximum(outputs, eps))
    expected_mlog = np.log(np.maximum(1 - outputs, eps))
    expected_result = np.sum((-targets * expected_log) - (1 - targets) * expected_mlog,
                             keepdims=True)
    compare_tensors(CrossEntropyBinary(),
                    outputs, targets, expected_result, tol=1e-5)
dataset/ETHPy150Open NervanaSystems/neon/tests/test_costs.py/test_cross_entropy_binary_limits/original