示例#1
0
def test_Elu(tmpdir):
    data = np.asarray([[-1, -0.5, 0, 1, 2]], dtype=np.float32)
    model = C.elu(data)
    verify_no_input(model, tmpdir, 'Elu_0')

    x = C.input_variable(data.shape)
    model = C.elu(x)
    verify_one_input(model, data, tmpdir, 'Elu_1')
示例#2
0
def test_Elu(tmpdir):
    data = np.asarray([[-1, -0.5, 0, 1, 2]], dtype=np.float32)
    model = C.elu(data)
    verify_no_input(model, tmpdir, 'Elu_0')

    x = C.input_variable(data.shape)
    model = C.elu(x)
    verify_one_input(model, data, tmpdir, 'Elu_1')
示例#3
0
def test_Elu(tmpdir, dtype):
    with C.default_options(dtype=dtype):
        data = np.asarray([[-1, -0.5, 0, 1, 2]], dtype=dtype)
        model = C.elu(data)
        verify_no_input(model, tmpdir, 'Elu_0')

        x = C.input_variable(data.shape)
        model = C.elu(x)
        verify_one_input(model, data, tmpdir, 'Elu_1')
示例#4
0
def test_Elu(tmpdir, dtype):
    with C.default_options(dtype = dtype):
        data = np.asarray([[-1, -0.5, 0, 1, 2]], dtype=dtype)
        model = C.elu(data)
        verify_no_input(model, tmpdir, 'Elu_0')

        x1 = C.input_variable(data.shape)
        model = C.elu(x1)
        verify_one_input(model, data, tmpdir, 'Elu_1')

        x2 = C.input_variable(data.shape)
        model = C.elu(x2, alpha=2.0)
        verify_one_input(model, data, tmpdir, 'Elu_2')
示例#5
0
 def phi(x):  # kernel
     return C.elu(x) + 1