Install TensorFlow on mac

Install pip

# Mac OS X
$ sudo easy_install pip
$ sudo easy_install --upgrade six

Install tensorflow

# Mac OS X, CPU only, Python 2.7:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py2-none-any.whl

Basic Usage

The concepts in TensorFlow

Tensor : a typed multi-dimensional array. Only Tensor are passed between operations in the computation graph.

Graph : a description of computation.

op : (short for operation) the node in the graph

Session : the context in which to execute graphs

Devices : such as CPUs or GPUs, on which Session execute graphs

Variable : maintain state

numpy ndarray : the result structure returned by Sesson.run(graph), which is produced by ops in graph and transformed from tensor

Simple example

import tensorflow as tf

# Start with default graph.
matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.],[2.]])
product = tf.matmul(matrix1, matrix2)
# Now the default graph has three nodes: two constant() ops and one matmul() op. # Launch the default graph in a Session
sess = tf.Session()
result = sess.run(product)
print(result)
sess.close()

The call 'run(product)' causes the execution of three ops in the graph.

Fetches : to fech the outputs of operations, execute the graph with a run() call on the Session object. E.g. sess.run(product) in above sample

Feeds : a mechanism for patching tensors directly into operations in graph. Supply feed data as argument to a run() call. tf.placeholder is used to create "feed" operations commonly

input1 = tf.placeholder(tf.float32)
input2 = tf.placeholder(tf.float32)
output = tf.mul(input1, input2) with tf.Session() as sess:
print(sess.run([output], feed_dict={input1:[7.], input2:[2.]})) # output:
# [array([ 14.], dtype=float32)]

References

Download and Setup, TensorFlow

Basic Usage, TensorFlow

[TensorFlow] Basic Usage的更多相关文章

  1. zookeeper kazoo Basic Usage

    http://kazoo.readthedocs.org/en/latest/basic_usage.html Basic Usage Connection Handling To begin usi ...

  2. 【C++/C】指针基本用法简介-A Summary of basic usage of Pointers.

    基于谭浩强老师<C++程序设计(第三版)>做简要Summary.(2019-07-24) 一.数组与指针 1. 指针数组 一个数组,其元素均为指针类型数据,该数组称为指针数组.(type_ ...

  3. python Basic usage

    __author__ = 'student' l=[] l=list('yaoxiaohua') print l print l[0:2] l=list('abc') print l*3 l.appe ...

  4. github basic usage in windows

    1. create a new accout, create orginazation, create repo 2. install git in your local pc Note: you c ...

  5. TensorFlow 中文资源全集,官方网站,安装教程,入门教程,实战项目,学习路径。

    Awesome-TensorFlow-Chinese TensorFlow 中文资源全集,学习路径推荐: 官方网站,初步了解. 安装教程,安装之后跑起来. 入门教程,简单的模型学习和运行. 实战项目, ...

  6. TensorFlow资源整理

    什么是TensorFlow? TensorFlow 是一个采用数据流图(data flow graphs),用于数值计算的开源软件库.节点(Nodes)在图中表示数学操作,图中的线(edges)则表示 ...

  7. Awesome TensorFlow

    Awesome TensorFlow  A curated list of awesome TensorFlow experiments, libraries, and projects. Inspi ...

  8. TensorFlow 中文资源精选,官方网站,安装教程,入门教程,实战项目,学习路径。

    Awesome-TensorFlow-Chinese TensorFlow 中文资源全集,学习路径推荐: 官方网站,初步了解. 安装教程,安装之后跑起来. 入门教程,简单的模型学习和运行. 实战项目, ...

  9. R用户的福音︱TensorFlow:TensorFlow的R接口

    ------------------------------------------------------------ Matt︱R语言调用深度学习架构系列引文 R语言︱H2o深度学习的一些R语言实 ...

随机推荐

  1. iBATIS 3 试用手记 - The FUTURE - ITeye技术网站

    body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI ...

  2. SQL TOP分页

    SQL TOP分页 2010-11-12 16:35:29|  分类: SQL |  标签: |字号大中小 订阅     1.分页方案一:(利用Not In和SELECT TOP分页) 语句形式:   ...

  3. MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决方法 -摘自网络

    错误:Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 原因: 同一个i ...

  4. Postman 测试web接口(推荐)

  5. css3动画-animation

    animation驱使一组css style变化到另外一组css style,它可以定义keyframes的集合,指定style的开始和结束状态,它是transition的增强. 配置animatio ...

  6. 基于STM32的uCOS-II移植详解

    百度:基于STM32的uCOS-II移植详解 源:基于STM32的uCOS-II移植详解

  7. WebView点击图片看大图效果

    在webViewDelegate里面添加如下代码: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 - (voi ...

  8. python基础(二)字符串內建函数详解

    字符串 定义:它是一个有序的字符的集合,用于存储和表示基本的文本信息,''或""或''' '''中间包含的内容称之为字符串特性:1.只能存放一个值2.不可变,只能重新赋值3.按照从 ...

  9. 外部SRAM实验,让STM32的外部SRAM操作跟内部SRAM一样(转)

    源:外部SRAM实验,让STM32的外部SRAM操作跟内部SRAM一样 前几天看到开源电子论坛(openedv.com)有人在问这个问题,我特意去做了这个实验,这样用外部SRAM就跟用内部SRAM一样 ...

  10. cocoapod升级版本

    原文 http://blog.csdn.net/sing_sing/article/details/49762359 该方法好用 sudo gem install -n /usr/local/bin ...