import tensorflow as tf
import numpy as np
 
def body(x):
    a = tf.random_uniform(shape=[2, 2], dtype=tf.int32, maxval=100)
    b = tf.constant(np.array([[1, 2], [3, 4]]), dtype=tf.int32)
    c = a + b
    return tf.nn.relu(x + c)
 
def condition(x):
    return tf.reduce_sum(x) < 100
 
x = tf.Variable(tf.constant(0, shape=[2, 2]))
 
with tf.Session():
    tf.global_variables_initializer().run()
    result = tf.while_loop(condition, body, [x])
    print(result.eval())
