# -*- coding: utf-8 -*- #!/usr/bin/python import tensorflow as tf import tfutil if __name__ == '__main__': for xs in [(0, 0), (1, 0), (0, 1), (1, 1)]: const1, const2 = tf.constant(xs[0]), tf.constant(xs[1]) y = tfutil.get_operation_value( tf.logical_xor(tf.cast(const1, tf.bool), tf.cast(const2, tf.bool))) print( str(xs) + " -> " + str(tfutil.get_operation_value(tf.cast(y, tf.int32)))) #print(str(xs) + " -> " + str(y))
# -*- coding: utf-8 -*- #!/usr/bin/python import tensorflow as tf import tfutil if __name__ == '__main__': for xs in [(0, 0), (1, 0)]: const1, const2 = tf.constant(xs[0]), tf.constant(xs[1]) # y : A Tensor . Must have the same type as x y = tfutil.get_operation_value(tf.not_equal(const1, const2)) print(str(xs) + " -> " + str(y))
# -*- coding: utf-8 -*- #!/usr/bin/python import tensorflow as tf import tfutil if __name__ == '__main__': for xs in [0, 1]: const = tf.constant(xs) y = tfutil.get_operation_value(tf.logical_not(tf.cast(const, tf.bool))) print( str(xs) + " -> " + str(tfutil.get_operation_value(tf.cast(y, tf.int32)))) #print(str(xs) + " -> " + str(y))
# -*- coding: utf-8 -*- #!/usr/bin/python import tensorflow as tf import tfutil if __name__ == '__main__': for xs in [(0, 0), (0, 1), (1, 0)]: const1, const2 = tf.constant(xs[0]), tf.constant(xs[1]) # y : A Tensor . Must have the same type as x y = tfutil.get_operation_value(tf.greater(const1, const2)) print(str(xs[0]) + " > " + str(xs[1]) + " -> " + str(y))
# -*- coding: utf-8 -*- #!/usr/bin/python import tensorflow as tf import tfutil if __name__ == '__main__': for xs in [(0, 0), (0, 1), (1, 0)]: const1, const2 = tf.constant(xs[0]), tf.constant(xs[1]) # y : A Tensor . Must have the same type as x y = tfutil.get_operation_value(tf.less(const1, const2)) print(str(xs[0]) + " < " + str(xs[1]) + " -> " + str(y))