test_activations.py 文件源码

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

项目:deep-coref 作者: clarkkev 项目源码 文件源码
def test_relu():
    '''
    Relu implementation doesn't depend on the value being
    a theano variable. Testing ints, floats and theano tensors.
    '''

    from keras.activations import relu as r

    assert r(5) == 5
    assert r(-5) == 0
    assert r(-0.1) == 0
    assert r(0.1) == 0.1

    x = T.vector()
    exp = r(x)
    f = theano.function([x], exp)

    test_values = get_standard_values()
    result = f(test_values)

    list_assert_equal(result, test_values)  # because no negatives in test values
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号