import tensorflow as tf
tf.compat.v1.enable_eager_execution() # Enable eager execution for TensorFlow 1.x compatibility mode
# Step 1: Define inputs
x = tf.constant(2.0)
y = tf.constant(3.0)
# Step 2: Define operations
z = tf.add(x, y) # z = x + y
w = tf.multiply(z, 2.0) # w = 2 * z
# Step 3: Define variables
weights = tf.Variable(initial_value=0.5)
output = tf.multiply(w, weights) # output = w * weights
# Step 4: Execute and print the result
print("Output:", output.numpy())
CmltcG9ydCB0ZW5zb3JmbG93IGFzIHRmCgp0Zi5jb21wYXQudjEuZW5hYmxlX2VhZ2VyX2V4ZWN1dGlvbigpICAjIEVuYWJsZSBlYWdlciBleGVjdXRpb24gZm9yIFRlbnNvckZsb3cgMS54IGNvbXBhdGliaWxpdHkgbW9kZQoKIyBTdGVwIDE6IERlZmluZSBpbnB1dHMKeCA9IHRmLmNvbnN0YW50KDIuMCkKeSA9IHRmLmNvbnN0YW50KDMuMCkKCiMgU3RlcCAyOiBEZWZpbmUgb3BlcmF0aW9ucwp6ID0gdGYuYWRkKHgsIHkpICAjIHogPSB4ICsgeQp3ID0gdGYubXVsdGlwbHkoeiwgMi4wKSAgIyB3ID0gMiAqIHoKCiMgU3RlcCAzOiBEZWZpbmUgdmFyaWFibGVzCndlaWdodHMgPSB0Zi5WYXJpYWJsZShpbml0aWFsX3ZhbHVlPTAuNSkKb3V0cHV0ID0gdGYubXVsdGlwbHkodywgd2VpZ2h0cykgICMgb3V0cHV0ID0gdyAqIHdlaWdodHMKCiMgU3RlcCA0OiBFeGVjdXRlIGFuZCBwcmludCB0aGUgcmVzdWx0CnByaW50KCJPdXRwdXQ6Iiwgb3V0cHV0Lm51bXB5KCkpCg==