tf.subtract()
来源:互联网 发布:matlab矩阵乘法代码 编辑:程序博客网 时间:2024/05/22 10:26
参考官方文档
format:subtract(x, y, name=None)
Args:
x: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`.
y: A `Tensor`. Must have the same type as `x`.(也是强调x,y两个参数类型必须相同)
name: A name for the operation (optional).
Returns:
A `Tensor`. Has the same type as `x`.x - y element-wise.(返回的数据类型与x相同,且是x-y的操作是元素级别的,具体看栗子)
栗子
import tensorflow as tf #两个矩阵相减x=tf.constant([[1,2],[2,1]]) y=tf.constant([[1,1],[1,2]])z=tf.subtract(x,y)#一个矩阵减一个数x1=tf.constant([[1,2],[2,1]]) y1=tf.constant(2)z1=tf.subtract(x1,y1)#一个数减一个矩阵x2=tf.constant(2)y2=tf.constant([[1,2],[2,1]])z2=tf.subtract(x2,y2)with tf.Session() as sess: z_v,z1_v=sess.run([z,z1]) print('z = \n%s'%(z_v)) print('z1 = \n%s'%(z1_v))结果
阅读全文
0 0
- tf.subtract()
- poj1722 SUBTRACT
- poj1722 SUBTRACT
- F - Subtract
- poj1722 SUBTRACT
- cv::subtract
- TF
- tf
- Subtract 30 minutes
- poj 1722 SUBTRACT
- POJ 1722 SUBTRACT
- POJ 1722 SUBTRACT
- POJ 1722 SUBTRACT 背包
- +-*/()转为add,subtract,multiply,divide
- poj - 1722 - SUBTRACT(dp)
- POJ 1722 SUBTRACT(DP)
- poj 1722 SUBTRACT(经典dp)
- Spark Transformation —— subtract
- ibaits中使用迭代器遍历list
- POJ3320-Jessica's Reading Problem
- HDU 6103 Kirinriki
- jvm 类加载机制
- RedHat 6.2 Linux修改yum源免费使用CentOS源
- tf.subtract()
- 数据结构入门6—文艺平衡树(Splay)
- 1109. Group Photo (25)
- Java深入浅出——Java基础(1)
- 数据挖掘十大经典算法
- 单点登录原理与简单实现
- UIScrollView使用自动布局设置以及contentSize滚动问题
- ajax 提交及表单提交报错
- I