1. tf.add(a, b) 与 a+b

在神经网络前向传播的过程中,经常可见如下两种形式的代码:

  • tf.add(tf.matmul(x, w), b)
  • tf.matmul(x, w) + b

简而言之,就是 tf.add(a, b) 与 a + b二者的区别,类似的也有,tf.assign 与 =(赋值运算符)的差异。

在计算精度上,二者并没有差别。运算符重载的形式a+b,会在内部转换为,a.__add__(b),而a.__add__(b)会再一次地映射为tf.add,在 math_ops.py中相关的映射如下:

_OverrideBinaryOperatorHelper(gen_math_ops.add, "add")

In tensorflow what is the difference between tf.add and operator (+)?

2. tf.nn.bias_add 与 tf.add

tf.nn.bias_add 是 tf.add 的一个特例,也即 tf.add 支持的操作比 tf.nn.bias_add 更多。二者均支持 broadcasting(广播机制),也即两个操作数最后一个维度保持一致。

除了支持最后一个维度保持一致的两个操作数相加外,tf.add 还支持第二个操作数是一维的情况。

转自:https://blog.csdn.net/lanchunhui/article/details/66477742

TensorFlow 辨异 —— tf.add(a, b) 与 a+b(tf.assign 与 =)、tf.nn.bias_add 与 tf.add(转)的更多相关文章

  1. TensorFlow 辨异 —— tf.add(a, b) 与 a+b(tf.assign 与 =)、tf.nn.bias_add 与 tf.add

    1. tf.add(a, b) 与 a+b 在神经网络前向传播的过程中,经常可见如下两种形式的代码: tf.add(tf.matmul(x, w), b) tf.matmul(x, w) + b 简而 ...

  2. TensorFlow 辨异 —— tf.placeholder 与 tf.Variable

    https://blog.csdn.net/lanchunhui/article/details/61712830 https://www.cnblogs.com/silence-tommy/p/70 ...

  3. 【TensorFlow基础】tf.add 和 tf.nn.bias_add 的区别

    1. tf.add(x,  y, name) Args: x: A `Tensor`. Must be one of the following types: `bfloat16`, `half`, ...

  4. TensorFlow中的L2正则化函数:tf.nn.l2_loss()与tf.contrib.layers.l2_regularizerd()的用法与异同

    tf.nn.l2_loss()与tf.contrib.layers.l2_regularizerd()都是TensorFlow中的L2正则化函数,tf.contrib.layers.l2_regula ...

  5. tf.nn.bias_add

    tf.nn.bias_add bias_add( value, bias, data_format=None, name=None ) 功能说明: 将偏差项 bias 加到 value 上面,可以看做 ...

  6. tf.nn.bias_add 激活函数

    tf.nn.bias_add(value,bias,data_format=None,name=None) 参数: value:一个Tensor,类型为float,double,int64,int32 ...

  7. sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) Cannot add a NOT NULL column with default value NULL [SQL: u'ALTER TABLE address_scopes ADD COLUMN ip_version INTEGER NOT NULL']

    root@hett-virtual-machine:~# su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neu ...

  8. Tensorflow学习笔记(2):tf.nn.dropout 与 tf.layers.dropout

    A quick glance through tensorflow/python/layers/core.py and tensorflow/python/ops/nn_ops.pyreveals t ...

  9. tensorflow 的 Batch Normalization 实现(tf.nn.moments、tf.nn.batch_normalization)

    tensorflow 在实现 Batch Normalization(各个网络层输出的归一化)时,主要用到以下两个 api: tf.nn.moments(x, axes, name=None, kee ...

随机推荐

  1. spark新闻项目环境搭建

    前面安装好三节点的centos 6.5 和配置好静态ip,这里就不多说了 创建kfk用户,然后重启 Last login: Fri Jan :: from 192.168.86.1 [spark@sp ...

  2. mysql给查询的结果添加序号

    1.法一: select  (@i:=@i+1)  i,a.url from  base_api_resources a  ,(select   @i:=0)  t2 order by a.id de ...

  3. 6、申请发布(Distribution)证书和描述文件

    发布(Production)证书用于正式发布环境下使用,用于提交到Appstore审核发布. 申请发布(Production)证书 在“Certificates, Identifiers & ...

  4. IDEA 快捷操作 Windows

    1.查找Action  ctrl+shift+A :可通过其查询其他操作快捷键等. 2.项目之间跳转:ctrl+shift+[ 与  ctrl+shift+] 3.alt + 数字 展开对应窗口 4. ...

  5. ROS学习手记 - 6 使用ROS中的工具:rqt_console & roslaunch & rosed

    http://wiki.ros.org/ROS/Tutorials/UsingRqtconsoleRoslaunch Using rqt_console and roslaunch This tuto ...

  6. python学习笔记_week9

    一.paramiko模块 SSHClient,用于连接远程服务器并执行基本命令 基于用户名密码连接: ssh执行命令:stdin,stdout,sterr:标准输入.输出.错误 import para ...

  7. PHP Yii2.0PHPexecl导入。

    use app\models\execl; use \PHPExcel; /*execl导入数据*/ public function Execlupload(){ if(Yii::$app->r ...

  8. Python3里查看某一元素的源码(检查元素定位是否准确)

    #coding:utf-8 #显示网页元素的HTML源码from selenium import webdriver driver = webdriver.Ie()driver.implicitly_ ...

  9. Android ADB 基本命令

    ADB很强大,记住一些ADB命令有助于提高工作效率. 获取序列号: adb get-serialno 查看连接计算机的设备: adb devices 重启机器: adb reboot 重启到bootl ...

  10. leetcode295

    public class MedianFinder { List<int> list = null; ; /** initialize your data structure here. ...