zoukankan      html  css  js  c++  java
  • TensorFlow 学习(七) — 常用函数 api、tf.nn 库

    0. 四则运算

    • 平方:tf.square(),开方:tf.sqrt()
    • tf.add()、tf.sub()、tf.mul()、tf.div()、tf.mod()、tf.abs()、tf.neg()

    1. 简单数理统计

    RnR(从矢量到标量),意味着一种约简(reduce)。

    • 均值:tf.reduce_mean,求和:tf.reduce_sum
      • stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean)))
    • 最大最小(极值):tf.reduce_max/tf.reduce_min

    2. 初始化子(initializer)

    • tf.zeros_initializer()
    • tf.ones_initializer()
    • tf.constant_initializer()
      • tf.constant_initializer(0.) ⇒ float
      • tf.constant_initializer(0, dtype=tf.int64)
    • tf.random_normal_initializer()

    与 tf.global_variable_initializer() 所不同的是,以上这些返回的是对象(<tensorflow.python.ops.init_ops.Constant/RandomNormal/Ones/Zeros at 0xXXX>),而 tf.global_variable_initializer() 返回的则是一种 tf.Operation(<tf.Operation 'init_N' type=NoOp>),

    3. 矩阵矢量运算

    • tf.diag、tf.transpose、tf.matmul、
    • tf.matrix_determinant(方阵行列式)、tf.matrix_inverse(方阵求逆)

    4. tf.nn

    • softmax + cross entropy:

      tf.nn.softmax_cross_entropy_with_logits(logits, labels) ⇒ tf.reduce_mean()
  • 相关阅读:
    selenium server在页面加载超时浏览器与driver通信失败时的妙用
    selenium并行的使用
    selenium代理
    selenium鼠标拖动
    做事要是专业
    selenium select 标签选中
    从字符串中提取数字
    selenium中Alter等弹出对话框的处理
    Selenium资料
    P2048 [NOI2010]超级钢琴 (RMQ,堆)
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9422017.html
Copyright © 2011-2022 走看看