TensorFlow2.0 学习笔记(01)

 打开Anaconda Prompt输入一下代码进行环境的安装配置:

conda create -n TF2.1 python-3.7 
conda activate TF2.1
conda install cudatoolkit=10.1
conda install cudnn=7.6
pip install tensorflow==2.1
python  //进入python
import tensorflow as tf
tf.__version__        //显示2.1.0表示安装成功

 打开pycharm,点击NewProject

选择Existing interpreter,选择刚刚配置的TF2.1,点击create创建工程

新建一个python文件,输入一下代码,运行

import tensorflow as tf

tensorflow_version = tf.__version__
gpu_available = tf.test.is_gpu_available()

print("tensorflow version:",tensorflow_version,"\t GPU available:",gpu_available)

a = tf.constant([1.0,2.0],name="a")
b = tf.constant([1.0,2.0],name="b")

result = tf.add(a,b,name="add")
print(result)

显示:

tensorflow version: 2.1.0      GPU available: True
tf.Tensor([2. 4.], shape=(2,), dtype=float32)

表示开发环境已经安装成功

 

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值