94dbc3042f5a85b399f5ce2859d4e8fbafd235b9,tests/keras/backend/backend_test.py,,check_single_tensor_operation,#Any#Any#Any#,22

Before Change



def check_single_tensor_operation(function_name, input_shape, backend_list, **kwargs):
    val = np.random.random(input_shape) - 0.5
    x_list = [k.variable(val) for k in backend_list]

    z_list = []
    for x, k in zip(x_list, backend_list):
        z_list.append(k.eval(getattr(k, function_name)(x, **kwargs)))

    for i in range(len(z_list) - 1):
        assert z_list[i].shape == z_list[i + 1].shape
        assert_allclose(z_list[i], z_list[i + 1], atol=1e-05)
        if hasattr(z_list[i], "_keras_shape"):

After Change


            z = cntk_func_single_tensor(function_name, input_shape,
                                        **kwargs)([val])[0]
        else:
            z = k.eval(getattr(k, function_name)(k.variable(val), **kwargs))
        if hasattr(z, "_keras_shape"):
            assert z._keras_shape == z.shape
        z_list += [z]

    for (z1, z2) in zip(z_list[1:], z_list[:-1]):
        assert z1.shape == z2.shape
        assert_allclose(z1, z2, atol=1e-05)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: keras-team/keras
Commit Name: 94dbc3042f5a85b399f5ce2859d4e8fbafd235b9
Time: 2017-07-06
Author: me@taehoonlee.com
File Name: tests/keras/backend/backend_test.py
Class Name:
Method Name: check_single_tensor_operation


Project Name: keras-team/keras
Commit Name: 94dbc3042f5a85b399f5ce2859d4e8fbafd235b9
Time: 2017-07-06
Author: me@taehoonlee.com
File Name: tests/keras/backend/backend_test.py
Class Name:
Method Name: check_two_tensor_operation


Project Name: scipy/scipy
Commit Name: fafdd6001a8259f1408bc5f2c2cb91e5eb96c6ca
Time: 2020-08-05
Author: 44255917+swallan@users.noreply.github.com
File Name: benchmarks/benchmarks/stats.py
Class Name: ContinuousFitAnalyticalMLEOverride
Method Name: setup