tensorflow-variable

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Sep  6 10:16:37 2018
@author: myhaspl
@email:[email protected]
"""

import tensorflow as tf

my_var=tf.Variable(1)

mutop=my_var.assign(my_var*3)

init=tf.initialize_all_variables()
with tf.Session() as sess:  
    sess.run(init)
    print sess.run(mutop)
    print sess.run(mutop)
    print sess.run(mutop)

3
9
27

猜你喜欢

转载自blog.51cto.com/13959448/2325260