Exemplo n.º 1
0
def test_prepare(_get_data_shapes):
    a_shape, b_shape, c_shape, d_shape, out_shape = _get_data_shapes
    model = _get_simple_model(a_shape, b_shape, c_shape, d_shape, out_shape)
    backend = NgraphBackend.prepare(model)

    for idx in range(10):
        input_a, input_b, input_c, input_d = _get_input_data(a_shape, b_shape, c_shape, d_shape)
        ng_results = backend.run([input_a, input_b, input_c, input_d])
        expected = np.dot(np.abs(input_a + input_b), input_c) + input_d
        assert np.allclose(ng_results, [expected])
Exemplo n.º 2
0
def test_run_model(_get_data_shapes):
    a_shape, b_shape, c_shape, d_shape, out_shape = _get_data_shapes
    input_a, input_b, input_c, input_d = _get_input_data(a_shape, b_shape, c_shape, d_shape)

    model = _get_simple_model(a_shape, b_shape, c_shape, d_shape, out_shape)

    ng_results = NgraphBackend.run_model(model, [input_a, input_b, input_c, input_d])
    expected = np.dot(np.abs(input_a + input_b), input_c) + input_d

    assert np.allclose(ng_results, [expected])