c59e516bb0a4fd07dc86def25564c67922e15b52,tests/test_private_compare.py,TestPrivateCompare,_core_test,#TestPrivateCompare#Any#,21

Before Change



        expected = np.bitwise_xor(x > r, beta.astype(bool)).astype(np.int32)

        res = _private_compare(
            prot,
            x_bits=PondPrivateTensor(
                prot,
                *prot._share(val_dtype.tensor(tf.convert_to_tensor(x, dtype=val_dtype.native_type)).bits(bit_dtype)),
                False),
            r=PondPublicTensor(
                prot,
                val_dtype.tensor(tf.convert_to_tensor(r, dtype=val_dtype.native_type)),
                val_dtype.tensor(tf.convert_to_tensor(r, dtype=val_dtype.native_type)),
                False),
            beta=PondPublicTensor(
                prot,
                bit_dtype.tensor(tf.convert_to_tensor(beta, dtype=bit_dtype.native_type)),
                bit_dtype.tensor(tf.convert_to_tensor(beta, dtype=bit_dtype.native_type)),
                False)
        )

        with tfe.Session() as sess:
            actual = sess.run(res.reveal().value_on_0.to_native())
            np.testing.assert_array_equal(actual, expected)

After Change


    ], dtype=np.int32).reshape(2, 2, 2)

    expected = np.bitwise_xor(x > r, beta.astype(bool)).astype(np.int32)
    x_native = tf.convert_to_tensor(x, dtype=val_dtype.native_type)
    x_bits_preshare = val_dtype.tensor(x_native).bits(bit_dtype)
    x_bits = prot._share(x_bits_preshare)  // pylint: disable=protected-access

    r_native = tf.convert_to_tensor(r, dtype=val_dtype.native_type)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: mortendahl/tf-encrypted
Commit Name: c59e516bb0a4fd07dc86def25564c67922e15b52
Time: 2019-05-10
Author: jason@dropoutlabs.com
File Name: tests/test_private_compare.py
Class Name: TestPrivateCompare
Method Name: _core_test


Project Name: tensorlayer/tensorlayer
Commit Name: aa968dad320137a31c229be3094c6538fd5ce39c
Time: 2019-03-06
Author: rundi_wu@pku.edu.cn
File Name: tensorlayer/layers/core.py
Class Name: Layer
Method Name: __call__


Project Name: tensorflow/models
Commit Name: e170a8bad93da7676dadfdc8be32072a7bb46f75
Time: 2019-08-30
Author: gardener@tensorflow.org
File Name: official/transformer/v2/transformer_main.py
Class Name: TransformerTask
Method Name: train