#!/usr/bin/python from internal.test_cases import reduce_op_test import latticex.rosetta as rtt import tensorflow as tf reduce_op_test(tf.reduce_sum, "tf.reduce_sum axis=None", axis=None) reduce_op_test(rtt.SecureReduceSum, "rtt.SecureReduceSum axis=None", axis=None) reduce_op_test(tf.reduce_sum, "tf.reduce_sum axis=0", axis=0) reduce_op_test(rtt.SecureReduceSum, "rtt.SecureReduceSum axis=0", axis=0) reduce_op_test(tf.reduce_sum, "tf.reduce_sum axis=1", axis=1) reduce_op_test(rtt.SecureReduceSum, "rtt.SecureReduceSum axis=1", axis=1)
#!/usr/bin/python from internal.test_cases import reduce_op_test import latticex.rosetta as rtt import tensorflow as tf reduce_op_test(tf.reduce_min, "tf.reduce_min axis=None", axis=None) reduce_op_test(rtt.SecureMin, "rtt.SecureMin axis=None", axis=None) reduce_op_test(tf.reduce_min, "tf.reduce_min axis=0", axis=0) reduce_op_test(rtt.SecureMin, "rtt.SecureMin axis=0", axis=0) reduce_op_test(tf.reduce_min, "tf.reduce_min axis=1", axis=1) reduce_op_test(rtt.SecureMin, "rtt.SecureMin axis=1", axis=1)
#!/usr/bin/python from internal.test_cases import reduce_op_test import numpy as np import tensorflow as tf MIN_MAX_EXPECT = np.array([]) AXIS_NONE = reduce_op_test(tf.reduce_max, "tf.reduce_max axis=None", axis=None) MIN_MAX_EXPECT = np.append(MIN_MAX_EXPECT, AXIS_NONE.flatten()) AXIS_ZERO = reduce_op_test(tf.reduce_max, "tf.reduce_max axis=0", axis=0) MIN_MAX_EXPECT = np.append(MIN_MAX_EXPECT, AXIS_ZERO.flatten()) AXIS_ONE = reduce_op_test(tf.reduce_max, "tf.reduce_max axis=1", axis=1) MIN_MAX_EXPECT = np.append(MIN_MAX_EXPECT, AXIS_ONE.flatten()) AXIS_NONE = reduce_op_test(tf.reduce_min, "tf.reduce_min axis=None", axis=None) MIN_MAX_EXPECT = np.append(MIN_MAX_EXPECT, AXIS_NONE.flatten()) AXIS_ZERO = reduce_op_test(tf.reduce_min, "tf.reduce_min axis=0", axis=0) MIN_MAX_EXPECT = np.append(MIN_MAX_EXPECT, AXIS_ZERO.flatten()) AXIS_ONE = reduce_op_test(tf.reduce_min, "tf.reduce_min axis=1", axis=1) MIN_MAX_EXPECT = np.append(MIN_MAX_EXPECT, AXIS_ONE.flatten()) import latticex.rosetta as rtt #rtt.activate("SecureNN") #rtt.py_protocol_handler.set_loglevel(0) rtt.activate("Helix") MPC_RES = np.array([]) AXIS_NONE = reduce_op_test(rtt.SecureMax, "rtt.SecureMax axis=None", axis=None) MPC_RES = np.append(MPC_RES, AXIS_NONE.flatten()) AXIS_ZERO = reduce_op_test(rtt.SecureMax, "rtt.SecureMax axis=0", axis=0) MPC_RES = np.append(MPC_RES, AXIS_ZERO.flatten()) AXIS_ONE = reduce_op_test(rtt.SecureMax, "rtt.SecureMax axis=1", axis=1)
#!/usr/bin/python from internal.test_cases import reduce_op_test import latticex.rosetta as cb import tensorflow as tf reduce_op_test(tf.reduce_mean, "tf.reduce_mean axis=None", axis=None) reduce_op_test(cb.SecureMean, "cb.SecureMean axis=None", axis=None) reduce_op_test(tf.reduce_mean, "tf.reduce_mean axis=0", axis=0) reduce_op_test(cb.SecureMean, "cb.SecureMean axis=0", axis=0) reduce_op_test(tf.reduce_mean, "tf.reduce_mean axis=1", axis=1) reduce_op_test(cb.SecureMean, "cb.SecureMean axis=1", axis=1) cb.deactivate()
#!/usr/bin/python from internal.test_cases import reduce_op_test import latticex.rosetta as cb import tensorflow as tf reduce_op_test(tf.reduce_sum, "tf.reduce_sum axis=None", axis=None) reduce_op_test(cb.SecureSum, "cb.SecureSum axis=None", axis=None) reduce_op_test(tf.reduce_sum, "tf.reduce_sum axis=0", axis=0) reduce_op_test(cb.SecureSum, "cb.SecureSum axis=0", axis=0) reduce_op_test(tf.reduce_sum, "tf.reduce_sum axis=1", axis=1) reduce_op_test(cb.SecureSum, "cb.SecureSum axis=1", axis=1) cb.deactivate()