windows下安装TensorFlow

来源:互联网 发布:淘宝千牛自动回复短语 编辑:程序博客网 时间:2024/05/22 13:16

pip install --ignore-installed --upgrade tensorflow


安装后采用如下方式使用

import tensorflow as tf

y_hat = tf.constant(36, name='y_hat')#定义常量,且值为36y = tf.constant(39, name='y')        #定义常量,且值为39loss = tf.Variable((y - y_hat)**2, name='loss')  #定义变量:lossinit = tf.global_variables_initializer()#添加节点用于初始化所有的变量# the loss variable will be initialized and ready to be computedwith tf.Session() as session: # Create a session and print the output    session.run(init)    print(session.run(loss))
----------------------------------------------------------------------------
经过实验,推荐深度学习采用ubuntu系统。

原创粉丝点击