TensorFlow安装笔记与基本操作

本文介绍了在MacOS上安装TensorFlow的步骤,包括使用virtualenv创建隔离环境,安装Jupyter Notebook,以及TensorFlow的基本数据类型和操作,如常量、线性序列和随机抽样分布。此外,还强调了TensorFlow的函数式编程特性。
摘要由CSDN通过智能技术生成

阅读原文请点

毫无疑问TensorFlow从诞生之初便是各种贵族血统,光环加身。相比于目前比较流行的一些deep learning 框架,比如TheanoCaffe2,或者是百度的PaddlePaddle,虽然TensorFlow起步比较晚,但竟后来居上获得了大多数人的青睐,不管是学术研究还是产业界。究其原因,当然每个人都能说上几点。但写TensorFlow for Machine Intelligence的哥么总结的很到位,简单的说就是TensorFlow旨在解决目前深度学习框架在学术研究的易用性和产业界的实用性不能兼得的困境。

"Unfortunately, most of these libraries have a large trade off between flexibility and production-worthiness. Flexible libraries are invaluable for researching novel model architectures, but are often either too slow or incapable of being used in production. On the other hand, fast, efficient, libraries which can be hosted on distributed hardware are available, but they often specialize in specific types of neural networks and aren’t suited to researching new and better models. This leaves decision makers with a dilemma: should we attempt to do research with inflexible libraries so that we don’t have to reimplement code, or should we use one library for research and a completely dif erent library for production? If we choose the former, we may be unable to test out dif erent types of neural network models; if we choose the latter, we have to maintain code that may have completely di erent APIs. Do we even have the resources for this?

TensorFlow aims to solve this dilemma."

好了,闲话不多扯。本篇主要介绍TensorFlow在MacOS上的的安装过程,以及配合Jupyter Notebook做些简单的入门操作。

安装配置

TensorFlow

官网提供了4种安装方法,没有优劣之分,只是针对不同用户不同场景进行选择。

  1. virtualenv. 和已有Python开发环境隔离的虚拟环境,不依赖当前工作环境的各种package版本,安装TensorFlow的所有依赖到独立的目录,需要时只要activate下就行
  2. "native" pip. 使用已有的Python环境,相关packages(比如numpy等),只安装必要的依赖,比方法1需要下载的packages一般要少。但如果原环境比较老旧或是跟TensorFlow依赖有不兼容等,安装过程较为折腾。
  3. Docker. 相对来说镜像比较大,可能有大几百M,但如果系统已经安装Docker或Docker重度用户,可以试试.
  4. installing from source. 最折腾,但有收获……

山人比较懒,直接采用第一种virtualenv安装。

安装virtualenv

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值