下载APP
登录
关闭
讲堂
算法训练营
Python 进阶训练营
企业服务
极客商城
客户端下载
兑换中心
渠道合作
推荐作者
当前播放: 20 | 变量(Variable)是什么(下)
00:00 / 00:00
标清
  • 标清
1.0x
  • 2.0x
  • 1.5x
  • 1.25x
  • 1.0x
  • 0.5x
网页全屏
全屏
00:00
付费课程,可试看

TensorFlow快速入门与实战

共67讲 · 67课时,约1000分钟
6976
免费
01 | 课程介绍
免费
02 | 课程内容综述
免费
03 | 第一章内容概述
免费
04 | TensorFlow产生的历史必然...
免费
05 | TensorFlow与Jeff Dean的...
免费
06 | TensorFlow的应用场景
07 | TensorFlow的落地应用
08 | TensorFlow的发展现状
09 | 第二章内容概述
10 | 搭建你的TensorFlow开发环...
11 | Hello TensorFlow
12 | 在交互环境中使用TensorFl...
13 | 在容器中使用TensorFlow
14 | 第三章内容概述
15 | TensorFlow模块与架构介绍
16 | TensorFlow数据流图介绍
17 | 张量(Tensor)是什么(上...
18 | 张量(Tensor)是什么(下...
19 | 变量(Variable)是什么(...
20 | 变量(Variable)是什么(...
21 | 操作(Operation)是什么...
22 | 操作(Operation)是什么...
23 | 会话(Session)是什么
24 | 优化器(Optimizer)是什...
25 | 第四章内容概述
26 | 房价预测模型的前置知识
27 | 房价预测模型介绍
28 | 房价预测模型之数据处理
29 | 房价预测模型之创建与训练
30 | TensorBoard可视化工具介...
31 | 使用TensorBoard可视化数...
32 | 实战房价预测模型:数据分...
33 | 实战房价预测模型:创建与...
34 | 实战房价预测模型:可视化...
35 | 第五章内容概述
36 | 手写体数字数据集MNIST介...
37 | 手写体数字数据集MNIST介...
38 | MNIST Softmax网络介绍(...
39 | MNIST Softmax网络介绍(...
40 | 实战MNIST Softmax网络(...
41 | 实战MNIST Softmax网络(...
42 | MNIST CNN网络介绍
43 | 实战MNIST CNN网络
44 | 第六章内容概述
45 | 准备模型开发环境
46 | 生成验证码数据集
47 | 输入与输出数据处理
48 | 模型结构设计
49 | 模型损失函数设计
50 | 模型训练过程分析
51 | 模型部署与效果演示
52 | 第七部分内容介绍
53 | 人脸识别问题概述
54 | 典型人脸相关数据集介绍
55 | 人脸检测算法介绍
56 | 人脸识别算法介绍
57 | 人脸检测工具介绍
58 | 解析FaceNet人脸识别模型
59 | 实战FaceNet人脸识别模型
60 | 测试与可视化分析
61 | 番外篇内容介绍
62 | TensorFlow社区介绍
63 | TensorFlow生态:TFX
64 | TensorFlow生态:Kubeflow
65 | 如何参与TensorFlow社区开...
66 | ML GDE是TensorFlow社区...
67 | 课程总结

精选留言(8)

  • 2019-01-14
    import tensorflow as tf

    W = tf.Variable(initial_value = tf.random_normal(shape = (1 , 4) ,mean = 100 , stddev = 0.35 ), name = "W")
    b = tf.Variable(tf.zeros([4]) , name="b")
    [W , b]
    [<tf.Variable 'W:0' shape=(1, 4) dtype=float32_ref>,
     <tf.Variable 'b:0' shape=(4,) dtype=float32_ref>]

    sess = tf.Session()
    sess.run(tf.global_variables_initializer())
    sess.run( [W , b])
    [array([[100.40549 , 99.182625, 100.23513 , 99.42683 ]], dtype=float32),
     array([0., 0., 0., 0.], dtype=float32)]

    sess.run(tf.assign_add(b , [1,1,1,1] ))

    sess.run(tf.assign_add(b , [1,1,1,1] ))

    array([1., 1., 1., 1.], dtype=float32)

    sess.run(b)
    array([1., 1., 1., 1.], dtype=float32)

    saver = tf.train.Saver({'W' : W , 'b' : b})
    saver.save(sess , './summary/data.ckpt' , global_step = 0)
    WARNING:tensorflow:Issue encountered when serializing trainable_variables.
    Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
    'test' has type str, but expected one of: int, long, bool
    WARNING:tensorflow:Issue encountered when serializing variables.
    Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
    'test' has type str, but expected one of: int, long, bool
    './summary/data.ckpt-0'

    sess.run(tf.assign_add(b , [1,1,1,1] ))
    sess.run(b)
    array([2., 2., 2., 2.], dtype=float32)

    saver.restore(sess , './summary/data.ckpt-0')

    saver.restore(sess , './summary/data.ckpt-0')
    sess.run(b)
    INFO:tensorflow:Restoring parameters from ./summary/data.ckpt-0
    array([1., 1., 1., 1.], dtype=float32)
    展开
    2
  • 2019-01-12
    老师,麻烦贴一下源码地址

    作者回复: https://github.com/DjangoPeng/tensorflow-101

    2
  • 2019-08-24
    老师,有什么书籍推荐看的?英文系列也行

    作者回复: 《Python深度学习》Keras作者写的
    《深入理解TensorFlow》也可以看看

  • 2019-08-08
    从文件恢复的时候出错:
    ```
    WARNING: Logging before flag parsing goes to stderr.
    W0808 00:16:28.798274 140416759756608 deprecation.py:323] From /home/pyw/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
    Instructions for updating:
    Use standard file APIs to check for files with this prefix.
    Traceback (most recent call last):
      File "c20.py", line 39, in <module>
        saver.restore(sess, './save/1.save')
      File "/home/pyw/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1278, in restore
        compat.as_text(save_path))
    ValueError: The passed save_path is not a valid checkpoint: ./save/1.save
    ```

    c20.py的39行是:
    saver.restore(sess, './save/1.save')
    展开
  • 2019-08-07
    有的方法过期了
    ```
    W0807 23:51:48.566468 140651389855552 deprecation_wrapper.py:119] From c20.py:14: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.
    W0807 23:51:48.864450 140651389855552 deprecation_wrapper.py:119] From c20.py:15: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead.
    W0807 23:51:49.436012 140651389855552 deprecation_wrapper.py:119] From c20.py:19: The name tf.assign_add is deprecated. Please use tf.compat.v1.assign_add instead.
    ```

    如果按照提示修改,会得到

    ```
        sess.run(tf.compat.v1.global_variables_initializer())
    TypeError: unbound method run() must be called with Session instance as first argument (got Operation instance instead)
    ```
    展开
    1
  • 2019-02-26
    接上一条留言
    print(sess.run(b))
    print(b) 两者的输出结果不一样
    [1. 1. 1. 1.]
    <tf.Variable 'b:0' shape=(4,) dtype=float32_ref>
    是不是可以理解为 b的本身只是一个定义好的30位的浮点数张量
    在经过session会话后,只是在该会话改变了他的值,但并不改变他本身的属性
    还是以上理解是错的 是其他的解释
    展开

    作者回复: 在该会话(上下文)中改变(初始化、计算、赋值)了它。如果你关闭会话 ,它还是一个数据流图中的Variable 实例。

  • 2019-02-26
    执行完sess.run([W, b])后 去打印变量W后的结果并没有发生变化(在IDLE中操作)

    作者回复: print(sess.run([W, b])) 会打印出结果,因为会话执行特定节点(变量、操作)返回的是 python 数据类型。但是 W和b本身是 TensorFlow DSL 定义的数据类型,是一个抽象的“壳”。无论你执行多少次,“壳”是不会变得。

  • 2019-01-13
    终于赶上进度了😂

    作者回复: 加油加油!