示例#1
0
def test_ReduceProd(tmpdir, dtype):
    with C.default_options(dtype=dtype):
        data = np.array(
            [[[5, 1], [20, 2]], [[30, 1], [40, 2]], [[55, 1], [60, 2]]],
            dtype=dtype)
        model = C.reduce_prod(data, 0)
        verify_no_input(model, tmpdir, 'ReduceProd_0')
示例#2
0
def test_ReduceProd(tmpdir):
    data = np.array(
        [[[5, 1], [20, 2]], [[30, 1], [40, 2]], [[55, 1], [60, 2]]],
        dtype=np.float32)
    model = C.reduce_prod(data, 0)
    verify_no_input(model, tmpdir, 'ReduceProd_0')
def test_reduce_prod():
    data = np.array(
        [[[5, 1], [20, 2]], [[30, 1], [40, 2]], [[55, 1], [60, 2]]],
        dtype=np.float32)

    assert_cntk_ngraph_flat_equal(C.reduce_prod([1, 0], 0))
    assert_cntk_ngraph_flat_equal(C.reduce_prod([[1., 1.], [3., 5.]], 0))
    assert_cntk_ngraph_flat_equal(C.reduce_prod([[1., 1.], [3., 5.]], 1))
    assert_cntk_ngraph_flat_equal(C.reduce_prod([[1., 1.], [3., 5.]], -1))
    assert_cntk_ngraph_flat_equal(C.reduce_prod(data, 0))
    assert_cntk_ngraph_flat_equal(C.reduce_prod(data, 1))
    assert_cntk_ngraph_flat_equal(C.reduce_prod(data, 2))
    assert_cntk_ngraph_flat_equal(C.reduce_prod(data, -1))
    assert_cntk_ngraph_flat_equal(C.reduce_prod(data, (0, 1)))
    assert_cntk_ngraph_flat_equal(C.reduce_prod(data, (0, 2)))
    assert_cntk_ngraph_flat_equal(C.reduce_prod(data, (1, 2)))
    assert_cntk_ngraph_flat_equal(C.reduce_prod(data, (-1, -2)))
示例#4
0
def test_ReduceProd(tmpdir, dtype):
    with C.default_options(dtype = dtype):
        data = np.array([[[5,1], [20,2]],[[30,1], [40,2]],[[55,1], [60,2]]], dtype=dtype)
        model = C.reduce_prod(data, 0)
        verify_no_input(model, tmpdir, 'ReduceProd_0')
示例#5
0
def test_ReduceProd(tmpdir):
    data = np.array([[[5,1], [20,2]],[[30,1], [40,2]],[[55,1], [60,2]]], dtype=np.float32)
    model = C.reduce_prod(data, 0)
    verify_no_input(model, tmpdir, 'ReduceProd_0')