Fetching-Variable-State

Sat 17 May 2025

title: "Template" author: "Raja CSP Raman" date: 2019-05-07 description: "-" type: technical_note draft: false


import tensorflow as tf

import os

# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
a = tf.constant(2)
b = tf.constant(3)

c = tf.add(a, b)
d = tf.multiply(a, b)

'''
    tf.mul, tf.sub and tf.neg are deprecated in favor of tf.multiply, tf.subtract and tf.negative.
        https://stackoverflow.com/questions/42217059/tensorflowattributeerror-module-object-has-no-attribute-mul
'''

with tf.Session() as sess:
    # Calling sess.run(var) on a tf.Session() retrieves its value
    # We can retrieve multiple variables simultaneously like below
    result = sess.run([d, c])
    print(result)
[6, 5]


Score: 0

Category: tensorflow-work