The whole function beneath gives me the error below, the function works fine if I take away
with tf.Session() as sess: