For any queries you can reach us at / WhatsApp us: +919158876092

TensorFlow Session

TensorFlow Session

A session will execute the operation from the graph. To execute the graph with the values of a tensor, we need to initialize a session. Within a session, we must run an operator to create an output.

Following we will demonstrate using a TensorFlow Session

import tensorflow as tf  
## Create, run  and evaluate a session  
x = tf.constant([2])  
y = tf.constant([4])              
## Create operator  
multiply = tf.multiply(x, y)  
## Create a session to run the code  
sess = tf.Session()  
result_1 =  

The output will be [8]